class TelegramWebProxy

WebProxy for a Telegram bot which handles chats and process messages

Constants

KeyboardGenerator
MessageProcessor
PageFetcher
PageSanitizer
VERSION

Attributes

bot[RW]

Public Class Methods

new(bot) click to toggle source
# File lib/telegram_web_proxy.rb, line 12
def initialize(bot)
  self.bot = bot
end

Public Instance Methods

message_processors() click to toggle source
# File lib/telegram_web_proxy.rb, line 16
def message_processors
  @message_processors ||= {}
end
process(message) click to toggle source
# File lib/telegram_web_proxy.rb, line 20
def process(message)
  chat = get_chat(message)
  message_processors[chat.id] ||= MessageProcessor.new(bot, chat)
  message_processors[chat.id].process(message)
end

Private Instance Methods

get_chat(message) click to toggle source
# File lib/telegram_web_proxy.rb, line 28
def get_chat(message)
  message.respond_to?(:chat) ? message.chat : message.message.chat
end