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.

Download

whereskal.tar.gz (30208 bytes)
whereskal.zip (35495 bytes)
These packages were uploaded on 4 September 2007.

The release is self-contained, including the jabber.py library and a variety of sample modules for your delight and amusement.

Installation

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 whereskal@myjabber.net.

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

    Connected
    Logged in
    Registered google
    Registered hello
    Registered screwu
    Registered therapist
    Registered locatekal
    HTTPGateway started

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: hi
    whereskal: hi.
    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?
    jez_higgins: Annoyed
    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
http://machine:8081/?to=username1&to=username2&msg=Message%20to%20send
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 google module runs a Google query, while screwu just insults you. One of the more useful modules is remindme

(13:43:34) jez: remind me to turn the oven off in 30 minutes
(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
Look at hello.py for 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.

License

WheresKal is released under a BSD-style license. The jabber.py library is released under the LGPL.


ho


by anonymous on 6th Mar 2006

Kal logs out every ten minutes for some reason... not sure why yet.
by James [e] on 24th Jul 2006

Is there anywhere where I can find some good documentation for WheresKal?
by Michael Mulqueen [e] [w] on 29th Jul 2006

Enter your comment

Name Email
URL
If you have an account, please log in.
No account? Just create one.

Jez Higgins