Chatbot

Chatbot lets you define chat commands easily.

Installation

Clone this repo and then run gem build and gem install, or

Add this line to your application's Gemfile:

gem 'chatbot', :git => "git://github.com/ronandi/chatbot.git"

And then execute:

$ bundle

Remember to:

require('chatbot')

Usage

Here's an example how to write an echo bot. It just repeats what its given:

require 'sinatra'
require 'chatbot'

Chatbot.configure do |config|
  config.bot_id = "your_bot_id"
end

post '/' do
  Chatbot.processMessage(request.body.read)
end

Chatbot.command "!echo" do |message|
  puts "im here"
  message
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request