Sha256: 1c6c6f3346e64e7bf86ebeedcf79bf8155ec07d72c4d274d590bf9ee86ab72b9
Contents?: true
Size: 762 Bytes
Versions: 1
Compression:
Stored size: 762 Bytes
Contents
module <%= class_name %> class Client attr_reader :token def initialize(token) @token = token end def start begin respond rescue Telegram::Bot::Exceptions::ResponseError => exception puts exception sleep 1 retry # run again on telegram server error end end private def run_client(&block) Telegram::Bot::Client.run(token) do |bot| yield bot if block_given? end end def respond run_client do |bot| bot.listen do |message| Responder.new(bot.api, message).call if message.text end end end def get_updates(bot, next_offset) bot.api.getUpdates(offset: next_offset, timeout: 20) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
botup-0.3.1 | lib/botup/templates/client.erb |