Techlahoma Chat Bot
Today while I was talking in #techlahoma, the topic of chatbots came up. Being something of a chat bot connoisseur, I (with @amandaharlin's blessing) have set out to tell you how to get your very own hubot up and running on IRC.
First, let's talk briefly about my chat bot history. I've written a Python chat bot from scratch to connect with an XMPP server. His name was kittenbot, and he was awesome. As a result, I got very familiar with XMPP's XEP-0045, which is the specification for multi user chat. Fortunately, the good folks over at @github have given us a lot more to work with than I did in the Kittenbot days.
Awesome. So let's get cracking.
First thing you should do is go grab an ice-cold beer. I've gone with Prarie Wine Barrel Noir. It's particularly delicious and well suited to making hubots.
The second thing you need to do is install the latest version of node. I've built it from source on ubuntu, which is an amazingly simple process. Instructions can be found over at Joyent.
You need then to get the required npm packages for hubot:
npm install -g hubot coffee-script
After you have that installed, you'll need to create your new hubot. This is done simply with:
hubot --create techlahoma-bot
This will create a new techlahoma-bot directory in whatever root directory you specified. I'll be putting this code up athttps://github.com/cthos/techlahoma-bot.
Next step is to install the new hubot's brain! This runs on redis by default, which is fine. I'm not going to be super picky and just install the redis-server package provided by my host. Once that's installed, it is running on the proper port by default, so that's all we need to do.
After that, we need to make some minor modifications to the Package.json file. For some reason, the one generated by hubot --create does not include the correct version for hubot-scripts. We need to change the line:
'hubot-scripts': '>= 3.5.0 < 3.0.0',
Great! Now hubot is able to actually run. Now we need to pick and choose some awesome things from the Hubot Script Catalog to have our bot be capable of by editing hubot-scripts.json:
[ 'redis-brain.coffee', 'shipit.coffee', 'abstract.coffee', 'ackbar.coffee', 'alot.coffee', 'beeradvocate.coffee', 'karma.coffee', 'tell.coffee' ]
We are close now! The only thing left to do is set 3 environment variables, and install the irc adapter!
npm install hubot-irc --save
Cool! Everything is good to go, just need to fire it up with:
bin/hubot -n amandaharlin_v2 --adapter irc
WE NOW HAVE BOT. ALL GLORY TO amandaharlin_v2! Postscript: I did most of this work from a Microsoft Surface. It's a really solid tablet, and I'm actually pretty impressed by it.