Sha256: bdfb80f9ccd0cb6f3b89eec288532eb925182f2fd22449ee0e88e1a1ff8195f4
Contents?: true
Size: 631 Bytes
Versions: 1
Compression:
Stored size: 631 Bytes
Contents
module Telegram module Bot class Runner attr_reader :api, :offset def self.run(*args, &block) new(*args).run(&block) end def initialize(token) @api = Api.new(token) @offset = 0 end def run yield self end def listen loop do response = api.getUpdates(offset: offset) next unless response['ok'] response['result'].each do |data| update = Types::Update.new(data) @offset = update.update_id.next yield update.message end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
telegram-bot-ruby-0.1.0 | lib/telegram/bot/runner.rb |