Class: TelegramMeetupBot::Client
- Inherits:
-
Object
- Object
- TelegramMeetupBot::Client
- Defined in:
- lib/telegram_meetup_bot/client.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(token) ⇒ Client
constructor
A new instance of Client.
- #run ⇒ Object
Constructor Details
#initialize(token) ⇒ Client
Returns a new instance of Client.
5 6 7 |
# File 'lib/telegram_meetup_bot/client.rb', line 5 def initialize(token) @token = token end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
3 4 5 |
# File 'lib/telegram_meetup_bot/client.rb', line 3 def token @token end |
Instance Method Details
#run ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/telegram_meetup_bot/client.rb', line 9 def run begin Telegram::Bot::Client.run(token) do |bot| bot.listen do || if .text messenger = Messenger.new(api: bot.api, chat_id: .chat.id) CommandsHandler.new(message: , messenger: messenger).process end end end rescue Telegram::Bot::Exceptions::ResponseError => e puts e sleep 1 retry # run again on telegram server error end end |