October 10th, 2008 |
eggdrop IRC bot with logging to website
After playing around a bit with the php bot logging to mysql, I turned to a little more industrial solution, which involved installing an eggdrop bot and a script which lives inside the bot to convert its log files to html. This turned out to be the easiest solution, albeit a time consuming one. First it was necessary to install an eggdrop bot, which on Debian and Ubuntu can be done like so:
apt-get install eggdrop
This installs the eggdrop to its global area, and if like me you want to run it from a specific user's home you need to copy the configuration file (eggdrop.conf) to the home dir of your choice (example: /home/logbotuser/eggdrop.conf) You must thoroughly go through the configuration file, and uncomment various locations that stop you from executing the bot without reading through ALL the configuration options. The important stuff is at the top, like the botnick, the channel, etc, but there is also important stuff further down, like which irc servers to connect to and the like. When you are done, you should start the bot doing:
eggdrop -m eggdrop.conf
you use the -m option only the first time, as this tells it to create a new user list, after which you can msg the bot hello from irc, or telnet into it and type NEW as the username. The bot should now be happily running on the channel of your choice. One other thing you can do is setup a cron job that makes sure your bot is running always. Basically the crontab checks every 10 minutes to see that the bot is still active, if it isn't it relaunches it. To set it up, move the botchk script from /usr/share/eggdrop/scripts/ to your user directory:
mv /usr/share/eggdrop/scripts/botchk /home/user/eggdrop/
Then you need to edit the bothck script which has some self explanatory settings corresponding to what you already configured in eggdrop.conf, but something that is not mentioned is the need to replace the 3 entries that have the string ./ $botdir to:
/path/to/eggdrop/dir/ $botdir
In the example above that would be /home/username/eggdrop/ $botdir
You then need to do the final part which is add the crontab entry like so:crontab -e
Here you add the following line:
0,10,20,30,40,50 * * * * /path/to/botchk
Now you can now download the logs2html script from here.
To install it, unzip it and follow the readme instructions. One thing not mentioned is that the actual compiled module is in the precompiled/eggdrop 3/ directory.You need to move this to /usr/lib/eggdrop/modules/
Then you must edit the logs2html.conf script and the chan.list file. You must also re-edit the eggdrop.conf file and add a line in the end that contains:
source logs2html.conf
When you are done, you should be able to view your irc logs on a website as defined in chan.list. There is an example here: www.nubae.com/logs


