Chatbot
Chatbot lets you define chat commands easily.
Installation
gem install chatbot
Or add this line to your application's Gemfile:
gem 'chatbot'
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
- 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