Class: TelegramMeetupBot::Client
- Inherits:
-
Object
- Object
- TelegramMeetupBot::Client
- Defined in:
- lib/telegram_meetup_bot/client.rb
Constant Summary collapse
- TIMEOUT =
1
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.
7 8 9 |
# File 'lib/telegram_meetup_bot/client.rb', line 7 def initialize(token) @token = token end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
5 6 7 |
# File 'lib/telegram_meetup_bot/client.rb', line 5 def token @token end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/telegram_meetup_bot/client.rb', line 11 def run Telegram::Bot::Client.run(token) do |bot| bot.enable_botan!(botan_key) if botan_key bot.listen do || (bot, ) if .text end end rescue Telegram::Bot::Exceptions::ResponseError => e write_log_and_sleep(e) retry # run again on telegram server error end |