Step 3: Start up ChatBot
Now we have our new plug-in script, let's start up ChatBot in the normal way:
[dj@cicero chatbot]$ ./chatbot
This time, Chatbot's been configured to join the room "test" on my local server, and go by the name "chatbot". To try out the currency-conversion service, don't forget to toggle the feature on, first, like this:
!toggle_flag flags currency
Now you can have ChatBot convert currencies for you ad nauseam. Figure 1 shows a typical interaction.
Figure 1. ChatBot providing currency-conversion services in the "test" room
Wrapping It Up
Through the power of Perl, we've now given ChatBot the facility to perform currency conversions for us. Wonderful. And what's more, we've not at all been slack in our pursuit of the three key values: we were impatient enough to want a currency-conversion function without having to write one from scratch, we were lazy enough to do as little as possible with the exchange.pl script once we found it, as well as being lazy enough to want a bot to perform the conversions for us in the first place, and we had enough hubris to combine code from infobot and ChatBot (after all, "hubris" has the same etymological root as "hybrid," and implies an "insult" to both parties being combined) to get the job done.
It's clear to see that ChatBot has a great framework for adding new features; I hope I've shown you how straightforward it is.
Go on--make a new acquaintance today, and get ChatBot working for you!
- Infobot: http://www.infobot.org
- Infobot's currency exchange facility: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/infobot/infobot/extras/exchange.pl
O'Reilly & Associates published (June 2001) Programming Jabber.
Sample Chapter 5: Jabber Technology Basics, is available free online.
For more information, or to order the book, click here.