Sha256: 69b78a645aae8061f4ec64e74e0472fbeb481a7c6deb944b53377a2150d9415c
Contents?: true
Size: 984 Bytes
Versions: 2
Compression:
Stored size: 984 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) new.perform(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.4 | lib/sinbotra/bot.rb |
sinbotra-0.1.3 | lib/sinbotra/bot.rb |