Build the Bot

With the database squared away, it was now time to set up the bot. The code resided in a file dubbed aimbot.pl, and basically consists of a section which logs into the AIM service, waits for the on_im event to be triggered, and then uses Perl's DBI module to query the database and return a result set.

See It in Action

At this point, things are ready to roll. You can fire up the bot from the command line simply by typing perl rtfmbot.pl. Once you do, it will log in to AIM and you can converse with it like anyone else on your buddy list (see Figure 2).

Figure 2. The rtfmbot in action (click for full-size image).

Need some help with the syntax of the GRANT command? No problem. The new guy wants to know about using PostgreSQL on Windows? Okay. Need to do some research on PostgreSQL replication? Here are a few links you might want to look at.

Signing Off

You can probably see how such a bot might be helpful to your organization. On its face it could be a handy reference point for new employees, or serve as a quick reference for those a bit more seasoned. Looking deeper, the shell provided here could really connect to any database and retrieve any kind of information your company might want to transmit. Perhaps your docbot could take a keyword such as "holidays" and send back all of the official holidays for your company; that would be pretty handy stuff and none of it would take very much code to put together.

It is worth pointing out that this information goes across AOL's network, so you wouldn't want to send anything sensitive across it, but for regular information, or customer accessible information such as store hours, customer support phone numbers, or product information, it should work just fine.

(If you do need more privacy, running your own Jabber server can give you more control.)

One more link I found helpful is AOL's bot homepage. If you are thinking about building your own bot, I recommend the resources I used.

Robert Treat
is a long-time user, developer, and advocate for free and open source software.