ecube8

Bash IRC Bot

Apr 10th, 2014
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.48 KB | None | 0 0
  1. ecube@chrome ~ % cat bashbot.sh
  2. #!/bin/bash
  3.  
  4. nick="cubencbot"
  5. channel="#bots"
  6. server="wazu.info.tm"
  7.  
  8. config=/tmp/irclog
  9.  
  10. config="${config}"
  11.  
  12. echo "NICK $nick" > $config
  13. echo "USER $nick +i * :$0" >> $config
  14. echo "JOIN $channel" >> $config
  15.  
  16. tail -f $config | nc $server 6667 | while read msg
  17. do
  18.   echo $msg
  19.   case "$msg" in
  20.     :*PRIVMSG $nick :!nick*)
  21.       nick=`echo $msg | awk -F '!nick' '{print $2}'` | tr -d ' ' >> $config
  22.       echo "NICK" $nick
  23.     ;;
  24.   esac
  25. done
Advertisement
Add Comment
Please, Sign In to add comment