WheresKal, a Jabber chatbot
WheresKal is a small Jabber chatbot, written in Python. It has a modular design, allowing it to be easily extended, and has an HTTP gateway so that external processes can send messages. I use it primarily to send CVS check in notifications. Of course, because it's a Jabber client, it can gateway through to Yahoo IM, AIM and MSN too.
The release is self-contained, including the jabber.py library and a variety of sample modules for your delight and amusement.
Simply untar or unzip the package. You will need to create a Jabber account on your server of choice. The easiest way to do that is to grab a GUI client. If you want to route your messages through to Yahoo or MSN or wherever, you'll need to create an account for it on those networks too. I'm currently using myjabber.net and it works fine. If you have Yahoo Messenger, you can talk to it here . He's also on AOL as whereskal or on Jabber as email@example.com.
Edit whereskal.py and drop the server, username and password into the appropriate variables. Then simply
python whereskal.py, and you're off. I run it on Linux and Windows, so it should be okay just about anywhere. You should see something like this
Anybody who wants to talk to the bot should now add it to
their friend/buddy list. You should see output like
jez_higgins is available (None / I'm Available)
john_f_singleton is available (None / Elderflower LatteMonkey)
kal_ahmed is available (None / I'm Available)
as it subscribes to them. Have a little test by talking to it -
jez_higgins: Having fun?
whereskal: Why don't you tell me?
jez_higgins: Well, I wish my client would get a shift on and deliver the data
whereskal: How does that make you feel?
whereskal: I see.
Developing with WheresKal
WheresKal has a HTTP gateway, which external processes can you to send messages. It listens on port 8081 and accepts requests of the form
You can have as many to= parameters as you like, and the msg will be sent to all of them.
On startup, WheresKal tries to load any Python modules it finds in the
modules subdirectory. Different modules can provide different services - for instance, the
screwu just insults you. One of the more useful modules is
(13:43:34) jez: remind me to turn the oven off in 30 minutesLook at
(13:43:34) whereskal: ok, I'll remind you to turn the oven off in 30 minutes
(14:13:34) whereskal: You asked me to remind you to turn the oven off
hello.pyfor a module skeleton.
Once all the modules are loaded, they are sorted into priority order (where 1 is the highest). When a message is received, the message is tested against each module's regex in turn. If the message text matches the regex, the module's
handle method is invoked, allowing the module to perform any processing. If
handle returns a non-zero result, then that's that, otherwise WheresKal continues to try and match the message against the remaining regexes.
WheresKal is released under a BSD-style license. The jabber.py library is released under the LGPL.