class TelegramBot

Constants

VERSION

Attributes

history[RW]

Public Class Methods

new(history: 50) click to toggle source
# File lib/telegram_bot.rb, line 17
def initialize(history: 50)
  @history = []
  @history_length = 50
  @listener = nil
end

Public Instance Methods

append_history(message) click to toggle source
# File lib/telegram_bot.rb, line 32
def append_history(message)
  @history << message
  @history = @history.last(@history_length || 0)
end
listen(method: :poll, interval: 5, path: '/hook') click to toggle source
# File lib/telegram_bot.rb, line 23
def listen(method: :poll, interval: 5, path: '/hook')
  case method
  when :poll
    @listener = PollListener.new(self, interval)
  when :webhook
    warn 'not implemented'
  end
end
start!() click to toggle source
# File lib/telegram_bot.rb, line 37
def start!
  @listener.start!
end
stop!() click to toggle source
# File lib/telegram_bot.rb, line 41
def stop!
  @listener.stop!
end