Chatroid

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...)
https://github.com/r7kamura/chatroid

require "chatroid"

Chatroid.new 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
end.run!

Motivation

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.

Architecture

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.

Goal

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.

広告を非表示にする