Hi, everyone. I'm creating a gem for building your own chatterbot named "Chatroid". Using Chatroid, you can create a chatterbot for any chat services in a breeze (but currently, it supports only twitter...)

require "chatroid" do set :service, "Twitter" set :consumer\_key, "..." set :consumer\_secret, "..." set :access\_key, "..." set :access\_secret, "..." on\_tweet do |event| if event["text"] =~ /yunotti/ favorite event follow event end end on\_reply do |event| reply "✘╹◡╹✘", event end!


Chatroid is inspired by Hubot, a version of GitHub's Campfire bot. I heard about Hubot and the usage of GitHub from David Calavera's talk at Sapporo RubyKaigi2012, and I was motivated to create my own bot that would work for me. Hubot is an awesome chatterbot system, but it's too complex to customize for a beginner like me. So I started to create a customizable, easy-to-use library for building a bot during this trip of Sapporo RubyKaigi2012.


As you see above, Chatroid has a sinatra-like interface to configure its behavior and simple methods to interact with the specified chat service. In this library, I used two basic programming patterns, the observer pattern and the adapter pattern. The observer pattern is used to register and trigger callbacks like on_tweet and on_reply. The adapter pattern is used to provide a common interface of Chatroid class to each chat service.


I have two missions about the chatterbot. The first is to adapt it to major chat services such as IRC, Skype, and HipChat. This will be achieved by writing the adapters for each service. The second is, this is more challenging but also fun, to let it perform all jobs for me. For instance, I'd like my bot to write code, test it, and even deploy it. We should give our bots odd jobs, and focus more creative issues.