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 ||
puts "im here"
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request