class Yorgi::MessageRouter

Attributes

bot[R]
message[R]
responder[R]

Public Class Methods

new(bot, message) click to toggle source
# File lib/yorgi/message_router.rb, line 8
def initialize(bot, message)
  @bot = bot
  @message = message
  @responder = MessageResponder.new(bot, message)
end

Public Instance Methods

route() click to toggle source
# File lib/yorgi/message_router.rb, line 14
def route
  case message.text
  when "/list"
    @responder.list
  when "/j"
    Settings.journaling = !Settings.journaling
    bot.api.send_message(chat_id: message.chat.id,
                         text: "journaling: #{Settings.journaling}")
  else
    if Settings.journaling
      @responder.journal
    else
      @responder.capture
    end
  end
end