In a past life I ran an IRC server that formed part of a private chat network, and off the back of that I had developed an IRC bot called Stutbot. One of my clients recently informed me that they want to set up an IRC server to facilitate realtime communication between their remote developers, with some status information being squirted in from various sources. This occurred to me as an ideal opportunity to revive and update that project.
Stutbot has been through many rewrites since the first version. Initially he was written in PHP, the I rewrote him in C++, and most recently Python. Continuing that tradition I have started rewriting him again, in node.js.
As always the code is up on our github account.
The project has always supported a plugin architecture in al of its implementations and I was excited to see what node had to offer in this regard. After a number of iterations the final architecture is broadly similar to the original PHP implementation, with the added bonus that you can reload the plugins on the fly — or you could if I hadn’t broken that earlier today!
So far I’ve not implemented many of the plugins the previous versions have supported, but now the architecture is there it’s fairly trivial to extend. Stutbot can currently do the following…
- Be a magic 8-ball
- Tell you the date and time
- Dance, but not boogie
- Respond to a ping
- Play hangman
It’s the last of these that I’ve spent most time on. Games are started via a private message, and there can only be one game per channel at any one time. The current state of the games is persisted across bot restarts. I chose to focus on this plugin because it demonstrates how to use most of the bot features.
I’m currently working on an Unfuddle plugin which will allow the developers to get info on their project without needing to load the web interface. I’m also hoping I can hook into Unfuddle’s support for callback URLs on git repositories, so Stutbot can post commit messages to an IRC channel.
Beyond that I have a list of plugins I’ve previously implemented in other languages that I will build as and when the need or desire arises.
Is there anything you’d want an IRC bot in your dev channel to be capable of?