I needed to setup an IRC channel bot and battled with it for almost a week. Finally I've done it and am pleased to share this hassle-free tutorial with the Ubuntu community.
What this will do for you:
1. Setup an IRC channel of your choice
2. Keep a bot nickname of your choice in the channel to keep it alive
Tutorial begins here:
1. First install eggdrop using apt-get or synaptic if you prefer that:
Code:
sudo apt-get install eggdrop
2. Download the simple.conf file from here: http://www.egghelp.org/files/conf/simple.conf.gz and unpack it.
Code:
cd ~
wget http://www.egghelp.org/files/conf/simple.conf.gz
gunzip simple.conf.gz
3. Open the simple.conf file in your home directory with a text editor of your choice (vi, nano, pico whatever). I'll use nano in my example because that's what I'm most familiar with:
4. Now we are editing the simple.conf configuration file. This simple file has very self-explanatory comments to explain what each setting does. Edit them to suit your needs. There are very few things you need to change, and each line has instructions preceding it. The only thing you must take care of is this line:
Code:
set username "user"
Here, you should replace the user within the quotes to your local username in the Ubuntu. If you don't know your local username, you can use whoami command to find it 
If you still need help with a particular line in the simple.conf file, please ask here and I'll try to answer.
5. For some reason, I could get eggdrop to work only from /usr/lib/eggdrop directory, and only as a regular user (sudo will not work). So let's make the eggdrop directory writable first:
Code:
sudo chmod 777 /usr/lib/eggdrop -R
(777 is not the most secure setting but it's good to begin with. You should try to lower this number later and use the lowest number that works for you)
6. Now let's run eggdrop for the first time using the simple.conf file.
Code:
/usr/lib/eggdrop -m ~/simple.conf
Notice closely the terminal for any errors. Also login to the IRC channel you created to see if the bot is actually there. If everything goes fine, Eggdrop will create the channel or join if it already exists, and will sit there nicely.
7. in the IRC channel, you will also be given instructions to prove your ownership of the bot. By default, you can send HELLO as a private message to the bot and it'll recognize your ownership. Remember to login to IRC using the same nickname as you defined in the simple.conf file in the bot owner section.
Code:
/msg yourbotname HELLO
(replace yourbotname with the bot nick you set in the simple.conf file)
8. Now let's set this bot to start with the Ubuntu startup.
First make a shell script that starts eggdrop with your conf file:
Code:
sudo nano /etc/init.d/eggbot
Text editor will open up. Type this:
Code:
#!/bin/sh
Echo "Starting Eggdrop IRC bot..."
cd /usr/lib/eggdrop
sudo -u username eggdrop /home/username/simple.conf
(remember to replace username with your user name in Ubuntu)
Press ctrl+O to write the file, and then ctrl+X to exit the text editor.
9. Now let's make the file executable.
Code:
sudo chmod a+x /etc/init.d/eggbot
10. Finally let's tell the system about the new file named eggbot we put in /etc/init.d directory so it updates its information:
Code:
sudo update-rc.d eggbot defaults
That's it!
If you're like me (and don't know much about Linux) you want to restart your computer to see if it actually works. Always check the IRC channel to see if the bot showed up there.
If you can contribute anything to this thread, or want to ask any questions, go ahead.
Wish you a very happy and Ubuntuous new year 2009
Bookmarks