added logging
This commit is contained in:
parent
9ac2cf758c
commit
6fa615ca02
@ -2,3 +2,4 @@ server="irc.freenode.net"
|
|||||||
channel="linux"
|
channel="linux"
|
||||||
nick="bashbot"
|
nick="bashbot"
|
||||||
user="username hostname servername :realname"
|
user="username hostname servername :realname"
|
||||||
|
log="log.txt"
|
||||||
|
4
bot.sh
4
bot.sh
@ -2,12 +2,15 @@
|
|||||||
|
|
||||||
. bot.properties
|
. bot.properties
|
||||||
input=".bot.cfg"
|
input=".bot.cfg"
|
||||||
|
echo "Starting session: $(date "+[%y:%m:%d %T]")">$log
|
||||||
echo "NICK $nick" > $input
|
echo "NICK $nick" > $input
|
||||||
echo "USER $user" >> $input
|
echo "USER $user" >> $input
|
||||||
echo "JOIN #$channel" >> $input
|
echo "JOIN #$channel" >> $input
|
||||||
|
|
||||||
tail -f $input | telnet $server 6667 | while read res
|
tail -f $input | telnet $server 6667 | while read res
|
||||||
do
|
do
|
||||||
|
# log the session
|
||||||
|
echo "$(date "+[%y:%m:%d %T]")$res" >> $log
|
||||||
# do things when you see output
|
# do things when you see output
|
||||||
case "$res" in
|
case "$res" in
|
||||||
# respond to ping requests from the server
|
# respond to ping requests from the server
|
||||||
@ -42,7 +45,6 @@ do
|
|||||||
fi
|
fi
|
||||||
will=$(echo "$will" | perl -pe "s/^ //")
|
will=$(echo "$will" | perl -pe "s/^ //")
|
||||||
com=$(echo "$will" | cut -d " " -f1)
|
com=$(echo "$will" | cut -d " " -f1)
|
||||||
echo "COM:$com"
|
|
||||||
if [ -z "$(ls modules/ | grep -i -- "$com.sh")" ]
|
if [ -z "$(ls modules/ | grep -i -- "$com.sh")" ]
|
||||||
then
|
then
|
||||||
./modules/help.sh $who $from >> $input
|
./modules/help.sh $who $from >> $input
|
||||||
|
Loading…
x
Reference in New Issue
Block a user