Hack 76 Set Up an Eggdrop Bot
Eggdrops have been around for quite a few
years, so plenty of authors have had time to write Tcl scripts or C
modules that make these kinds of bots very powerful. This hack shows
you how to install and set up a simple Eggdrop.
the oldest IRC bot still in active development. It supports multiple
channels and can be extended using Tcl scripts or C
modules—thousands of which can be downloaded freely to perform
common tasks, which Eggdrop does not support natively.
Downloading, installing, and configuring Eggdrop is relatively
simple. The first step is to connect to the server you will run the
bot on, probably via SSH or Telnet. When you are connected, you can
obtain a copy of the Eggdrop source code. The easiest way to obtain
the latest version of the source code is to use
wget. If you type wget
eggheads.org, the current (stable) version of
the Eggdrop code will be
downloaded to the current directory, as shown in Figure 12-1.
Figure 12-1. Using wget to get the Eggdrop source code
If your server does not have wget installed or you
would rather not use it, you can download the files manually from
upload the files to the server via FTP or SCP.
The Eggdrop source code is distributed as a tarball, so the next
thing to do is "untar" it. This is
done using the tar command, like so:
% tar zxvf eggdrop1.6.15.tar.gz
You may need to change the
filename if you have downloaded a more recent version.
This will copy all of the files in the tarball to a new directory, as
shown in Figure 12-2.
Figure 12-2. Eggdrop extracted into its own directory
Now change to the new directory:
% cd eggdrop1.6.15
If you are curious about Eggdrop, you may want to read the README and
INSTALL files. They contain information on installing and running
you have read these files, you can run Eggdrop's
This allows Eggdrop to adjust its settings so it can work correctly
on your system. When this has finished, type:
% make config
This allows Eggdrop to configure the modules it needs. When the
default modules have finished compiling, you should see something
like Figure 12-3.
Figure 12-3. Configuring the required modules with make config
Next, you can type:
This will compile the bot, but it may take a few minutes depending on
the speed of your server. Now you're ready to
install the bot. Type this:
% make install
and you should see something like Figure 12-4.
Figure 12-4. Installing Eggdrop
This will install Eggdrop into
~/eggdrop—that is, it will create an
eggdrop directory in your home directory.
cd to this folder, and you are now ready to edit
the configuration file for your Eggdrop.
12.5.1 Configuring Eggdrop
first step is to open the config file in your favorite editor, for
% pico -w eggdrop.conf
As you look through the file, remember that all the lines that begin
with a hash (#) are comments and will not be
interpreted by Eggdrop. You can safely ignore most of these if
you're in a rush, but they can often provide
valuable help when it comes to setting up the more exotic features.
Most of Eggdrop's settings are in the form of
set variable "value", which assigns the
"value" to the variable. For
example set nick "Hacky" would set the
Eggdrop's nickname to
"Hacky." The most important
This is the login that Eggdrop will use as its Ident if there is no
This should tell users how to contact the administrator of the bot
(most likely you). The information is given out when a user types
/msg bot help.
This is used only if you are linking your Eggdrop to another bot and
allows the bots to establish a connection whether they are on the
same network or not. It should be either the name of the network (for
example, "freenode") or a server
This controls which time zone the bot will be running in and should
probably be set to the same time zone as the server.
This determines where Eggdrop will look for its user file. This
contains details about all of the users known to the bot. It can be
named anything you like. Something like
hacky.users is the easiest to keep track of,
This command takes a different format than most others. The syntax is
listen port type, and it needs to be uncommented
and altered if you wish to link your Eggdrop to other bots or if you
wish to telnet to it. Chose a number for the port, somewhere between
1024 and 10000, and make sure the # is removed
from the line.
This command is required for your bot to recognize you as its owner.
Uncomment the line, and replace the value with the nickname you use
A few lines beneath the owner setting is a line
beginning with die. This must be removed or
commented out; otherwise your bot will not start. This is cunningly
placed there to ensure that people edit the config file fully before
using the bot.
This is the file that Eggdrop will store its channels and settings
in. You may like to name it in a similar fashion to the user file.
This setting allows the bot to determine which commands it can use on
the server it is connecting to. Most networks will probably be of
This is the nickname the bot uses on IRC. It can be anything you
like, as long as the IRC server allows it. Most servers will not
allow a nickname beginning with numbers, for example.
This is the nickname the bot will try to use if its preferred
nickname is in use. It can contain a question mark, which tells
Eggdrop to insert a random number at that point. For example, setting
this to "Hacky?" could result in
the nick ending up as "Hacky123."
This is what will be displayed as the bot's real
name on IRC. Most people set this to "/msg botname
hello" or list the bot's primary
channel. Other users are then able to view this information when they
type /whois hacky.
This is a list of servers the bot will try to connect to. Delete the
two examples and add the addresses of one or more servers on the
network you want the bot to connect to.
This controls whether users can create their own account on the bot
by saying "hello" to it. Setting it
to "1" will make it easier to set
up the bot via IRC.
This is the file in which the bot will store notes (messages from one
user to another). This should probably be named similarly to the user
Shortly after the notefile setting is another
die command that needs to be commented out.
This is a commented-out loadmodule command. You
must uncomment this line, as blowfish is required to encrypt the
passwords in the bot's user file.
When you have finished editing the file, save the changes and quit
back to the shell. You can now start the bot by typing:
% ./eggdrop -m eggdrop.conf
This launches the bot for the first time. To run it again, type:
% ./eggdrop eggdrop.conf