Sha256: 5dafc4c1cdc8a83251cfbc3b164beb531e2248ec8109e83f71de2533bc9768dc
Contents?: true
Size: 946 Bytes
Versions: 2
Compression:
Stored size: 946 Bytes
Contents
require "sinbotra/bot/conversation" require "sinbotra/bot/conversation_repo" require "sinbotra/bot/user" require "sinbotra/bot/user_repo" require "sucker_punch" module Sinbotra class Bot class << self def handle(provider, entry) Sinbotra::Config.logger.debug("ENTRY DEBUG:\n" + entry.inspect) if ENV["DEBUG"] perform_async(provider, entry) end def add_handler(provider, handler) @handlers ||= {} @handlers[provider.to_sym] = handler end def receive(provider, msg) handler = @handlers[provider.to_sym] Sinbotra::Config.logger.debug("MESSAGE DEBUG:\n" + msg.inspect) if ENV["DEBUG"] handler.handle_message(msg) end end include SuckerPunch::Job def perform(provider, msg) # THis needs to be done elsewhere msg["entry"].first["messaging"].each do |m| Sinbotra::Bot.receive(provider, m) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sinbotra-0.1.2 | lib/sinbotra/bot.rb |
sinbotra-0.1.1 | lib/sinbotra/bot.rb |