added what I had done
This commit is contained in:
parent
8202f070e4
commit
943c5b5e3f
4
bot.properties
Normal file
4
bot.properties
Normal file
@ -0,0 +1,4 @@
|
||||
server="irc.freenode.net"
|
||||
channel="linux"
|
||||
nick="irc-bash-bot"
|
||||
user="username hostname servername :realname"
|
27
bot.sh
Executable file
27
bot.sh
Executable file
@ -0,0 +1,27 @@
|
||||
# !/bin/bash
|
||||
|
||||
. bot.properties
|
||||
config=".bot.cfg"
|
||||
echo "NICK $nick" > $config
|
||||
echo "USER $user" >> $config
|
||||
echo "JOIN #$channel" >> $config
|
||||
|
||||
tail -f $config | telnet $server 6667 | while read res; do
|
||||
# do things when you see output
|
||||
case "$res" in
|
||||
PING*)
|
||||
echo "$res" | sed "s/PING/PONG/" >> $config
|
||||
;;
|
||||
# for pings on nick/user
|
||||
*"You have not"*)
|
||||
echo "JOIN #$channel" >> $config
|
||||
;;
|
||||
*JOIN*)
|
||||
whojoin=$(echo "$res" | sed -r "s/:(.*)\!.*@.*/\1/")
|
||||
echo "PRIVMSG #$channel :Welcome $whojoin :)" >> $config
|
||||
;;
|
||||
*)
|
||||
echo "$res"
|
||||
;;
|
||||
esac
|
||||
done
|
Loading…
Reference in New Issue
Block a user