eggdrop, telnet, tcl, pisg how to



In this article, I aim to cover the steps it takes to setup and use an Eggdrop IRC bot along with channel stats generated via Pisg.


Introduction

Your shell will come with a pre-complied version of eggdrop, this is because you won't be able to compile it by yourself, due to the security risk this can pose allowing users to compile their own scripts. It also allows control over that is being run on your shell, as CPU time and power is - as they say - money. Also since all the eggdrops on the shell are linked to one actual binary, it is very easy to upgrade everybody's eggdrop when a new version comes out. To get your eggdrop, simply type:
geteggdrop
in your homedir after you have logged in. This will place a dir called 'eggdrop' in your homedir, with all the files that you will need.

Setup

Type
cd eggdrop
to switch to your new eggdrop dir, and
nano eggdrop.conf
to open the eggdrop config file for editing. Be sure to read the whole file carefully, and make your changes according to your needs. An area of interest is the telnet section. Be sure to set your bot to listen at a port, you can choose any port 1024+. After editing all the options that you need, save and quit your editor.
nano commands:
Save - CTRL+o, Exit - CTRL+x
You can also download the config file using FTP, and edit it on your computer*, or find a sample config file (for example see www.egghelp.org - they have some simplified config for beginners on the 'Eggdrop files' section) and upload that instead.

* If you edit your conf file on your computer, you must be sure to use a unix compatible editor. unix/dos/mac computers have three different ways to make line endings. Most advanced editors (or anything made to edit code) should be able to autodetect and use whatever is already in your file, but if you have massive problems, or an error "cannot read file format" this was probably the problem.

Running your Eggdrop

Now, to run your eggdrop for the first time. Make sure you are in the eggdrop dir (type
pwd
if you are not sure) and then type:
./eggdrop -m nameofconfig.conf
(The -m means that the eggdrop is in new user file creation mode, you only have to do this once). If you get an error while it is starting, read what it says, and try and determine what is wrong. You probably have messed up the config file. After it has started successfully, it should join the channel(s) you specified in the config (if any). In IRC, you can type:
/msg botnick hello
(assumming you didn't change that command). The bot will now recognise you as its owner. It will then ask you to set a password, so do as it says.

Telnet

Now, you should make sure that you can telnet to your bot, this is useful for maintenance and management of your bot. From your shell, type:
telnet localhost port
(where port is the port number you put in your config.) The eggdrop login screen should appear, if you get 'connection refused', you will have to try another port (or your bot might not be running). If it has worked, type the user name and password you gave when you used the 'hello' command. If you did everthing right, you should see
nick joined the partyline
If it rejected your password, check your IRC logs for the password you gave it. Once you're in, type
.help
to see the list of all the commands available to you. See the eggdrop docs for advanced use of telnet.

Tcl Programming

You might be thinking now, "Ok, my eggdrop is running fine, but I want it to to do something!". Well, I will now guide you through adding a tcl script to your bot (This is the way I like to do it, so you don't always have to do it like this if you don't want to). First, find a script you want (a good place is the script archive on http://www.egghelp.org) and download it. Extract the file using a program like winrar (for windows) or if you are using Linux,
tar -zxvf filename
will extract a tar.gz file, while:
gunzip filename
will handle .zip files. Other commands can by found by searching.

Read any docs that might come with the script, this will tell you how to install them. Otherwise just open the .tcl file in your favorite text editor. The script will have several comments (lines begining with #) that may tell you how to customize and/or use the script. After making any changes you want (but don't actually edit the tcl code unless you know what you are doing) put it to your '~/eggdrop/scripts' dir. Then, find your bot's config file, and open that and scroll down to near the very bottom (fastest way in nano is to hold 'CTRL+v', which is page down) until you see several lines that begin with:
source scripts/somename.tcl
This is where you add your tcl script into the config. Under the others, (you guessed it) add:
source scripts/yourfile.tcl
then save and quit the editor. Now, rehash your bot, do this by either querying it on IRC
rehash password
or telnet to it and just type:
.rehash
Your bot should now load the new script. If there is an error in the tcl file, probably caused by careless editing, the bot will die. You would then need to look closely at your tcl script and the error messages to find out what is wrong, or start again with editing by taking extra care this time.

Unfortunately the site I've always linked to in this part of the tutorial appears to be gone, however an alternate beginers guide to tcl can be found at http://tcl.powersource.cx/index.php - However I'm sure you can find a much better site with a quick google search.

Pisg

Your bot is thriving on your channel now, maybe greeting users, providing !help. To add a bit more interest to IRC life, you might now want to setup pisg. Pisg can parse your eggdrop's log files and create highly customizable webpage stats. In your homedir, typing:
getpisg
will add a dir called 'pisg'. So type:
cd pisg
to get into the dir, then open the pisg.cfg file ('nano pisg.cfg'). I will now show you a sample cfg file for pisg, explaining what each thing does:

[see attached file pisg.cfg.txt]

Now to test it. In the pisg dir (remember: 'pwd' to check), type:
./pisg --configfile=pisg.cfg
Pisg should now parse your logs files and generate the html page according to the settings in the file 'pisg.cfg'. If you get an error, then check your pisg config file, especially your file paths. Next we need to copy the images that pisg uses to where ever we just generated the stats.html file (in this case the public_html folder)
cd ~/pisg/
cp gfx/ ../public_html

Finally open up your web browser and goto the URL of the stats.html (http://aeshells.org/~username/stats.html in this example).
You should see the stats page you just generated, congratulations. You might think its looking basic compared to say alex's http://aeshells.org/~ae/, but you can add all that stuff by adding things in the extra settings. Read the documentation that came with pisg to find out all the features you can add.

Final Words

I think I've covered just about everything you need to know about eggdrop/telnet/tcl/pisg, hope you find it useful! Please let me know if there is some mistake. Any further help will be given in the IRC channel #aeshells on irc.aeirc.net

-mtxf