Class: TelegramMeetupBot::Messenger
- Inherits:
-
Object
- Object
- TelegramMeetupBot::Messenger
- Defined in:
- lib/telegram_meetup_bot/messenger.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
-
#chat_id ⇒ Object
readonly
Returns the value of attribute chat_id.
-
#message_id ⇒ Object
readonly
Returns the value of attribute message_id.
Instance Method Summary collapse
- #edit_text(text, markup = nil) ⇒ Object
-
#initialize(args) ⇒ Messenger
constructor
A new instance of Messenger.
- #send_text(text, markup = nil) ⇒ Object
Constructor Details
#initialize(args) ⇒ Messenger
5 6 7 8 9 |
# File 'lib/telegram_meetup_bot/messenger.rb', line 5 def initialize(args) @api = args.fetch(:api) @chat_id = args.fetch(:chat_id) = args[:message_id] end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
3 4 5 |
# File 'lib/telegram_meetup_bot/messenger.rb', line 3 def api @api end |
#chat_id ⇒ Object (readonly)
Returns the value of attribute chat_id.
3 4 5 |
# File 'lib/telegram_meetup_bot/messenger.rb', line 3 def chat_id @chat_id end |
#message_id ⇒ Object (readonly)
Returns the value of attribute message_id.
3 4 5 |
# File 'lib/telegram_meetup_bot/messenger.rb', line 3 def end |
Instance Method Details
#edit_text(text, markup = nil) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/telegram_meetup_bot/messenger.rb', line 17 def edit_text(text, markup = nil) return if chat_id.nil? || .nil? api.(chat_id: chat_id, message_id: , text: text, reply_markup: markup) rescue nil end |
#send_text(text, markup = nil) ⇒ Object
11 12 13 14 15 |
# File 'lib/telegram_meetup_bot/messenger.rb', line 11 def send_text(text, markup = nil) return if chat_id.nil? api.(chat_id: chat_id, text: text, reply_markup: markup) end |