# safubot - an evented chatbot framework for Ruby
## Installation
## Documentation
## Example Usage
require 'safubot'
class NiftyBot < Safubot::Bot
def initialize
super(:database => "niftybot")
enable_twitter({
:username => "niftybot",
:consumer_key => CONSUMER_KEY,
:consumer_secret => CONSUMER_SECRET,
:oauth_token => OAUTH_TOKEN,
:oauth_token_secret => OAUTH_TOKEN_SECRET
})
enable_xmpp({
:jid => "niftybot@jabber.org/niftyhost",
:password => JABBER_PASSWORD
})
on(:request) do |req|
if req.text.match /nifty/i
respond req, "Yep, I'm a nifty bot! :3"
else
raise ArgumentError, "This isn't nifty at all! :("
end
end
on(:request_error) do |req, e|
respond req, "#{e}"
end
end
end
# You can run this from inside another EventMachine loop if
# you don't want it to block indefinitely.
NiftyBot.new.run