Some students wanted me to get involved with GHOULL again, and I agreed to. However, these guys will be in charge and I’ll just be lecturing..
Anyway, I decided we should have an IRC channel (freenode #GHOULL) and if we’re going to do that, then we should have a bot!
I found this guide for basic bot writing and wrote my own which can be found here.
It’s a very basic an primitive bot and needs a lot of improvements; however, I did want to mention some notes:
- As mentioned in the README, you’ll php5-sockets (or whatever version of php you’re using)
- Don’t try to send a lot of data, you’ll get throttled and then messages will be lost. You can get around this by giving your bot a voice with the following command:
/msg ChanServ #GHOULL add GHOULL_bot +V
- All commands end with a `:` so
write_socket($socket, "PRIVMSG #GHOULL: my text");
This is important otherwise things will get messed up. - sqlite and sqlie3 are not the same thing and the APIs are not compatible.
Those are the three big challenges that I’ve faced so far; however, I’m sure there will be more and I’ll try to remember to put them in the README.
The code is a little messy and uncommented; however, I tried to make everything as basic as I could. The hard stuff is in scripts/*.php as that deals with interacting with sqlite.