Project

chatroid

0.02
No commit activity in last 3 years
No release in over 3 years
Chatroid is a gem for quickly creating chatterbot in Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

Chatroid

Chatroid is a gem for quickly creating chatterbot in Ruby.

Installation

$ gem install chatroid

Requirements

  • Ruby >= 1.9

Supported

  • IRC
  • Twitter
  • Campfire
  • xmpp (Google Talk, HipChat, ...)

Example

For more examples, please see examples.

require "chatroid"

Chatroid.new do
  set :service,         "Twitter"
  set :consumer_key,    ENV["CONSUMER_KEY"]
  set :consumer_secret, ENV["CONSUMER_SECRET"]
  set :access_key,      ENV["ACCESS_KEY"]
  set :access_secret,   ENV["ACCESS_SECRET"]

  on_tweet do |event|
    if event["text"] =~ /chatroid/
      favorite event
    end
  end

  on_reply do |event|
    reply "Hi, i am a chatroid", event
  end

  on_time :hour => 12, :min => 0, :sec => 0 do
    tweet "Hello, world!"
  end
end.run!

Deploy to Heroku

  1. Create Procfile, Gemfile, and bot.rb
  2. Execute bundle install
  3. Create app on Heroku
  4. Configure environment variables
  5. Deploy app
$ gem install heroku
$ heroku login

$ mkdir bot
$ cd !$
$ echo "bot: bundle exec ruby bot.rb" >> Procfile
$ echo "source :rubygems" >> Gemfile
$ echo "gem 'chatroid'"   >> Gemfile
$ vim bot.rb
$ bundle install
$ heroku create your_favorite_bot_name --stack cedar
$ heroku config:add CONSUMER_KEY=... CONSUMER_SECRET=... ACCESS_KEY=... ACCESS_SECRET=...
$ git push heroku master
$ heroku ps:scale bot=1