Class: TelegramMeetupBot::Messenger

Inherits:
Object
  • Object
show all
Defined in:
lib/telegram_meetup_bot/messenger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Messenger

Returns a new instance of Messenger.



5
6
7
8
# File 'lib/telegram_meetup_bot/messenger.rb', line 5

def initialize(args)
  @api = args.fetch(:api)
  @chat_id = args.fetch(:chat_id)
end

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



3
4
5
# File 'lib/telegram_meetup_bot/messenger.rb', line 3

def api
  @api
end

#chat_idObject (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

Instance Method Details

#send_text(text) ⇒ Object



10
11
12
# File 'lib/telegram_meetup_bot/messenger.rb', line 10

def send_text(text)
  api.send_message(chat_id: chat_id, text: text, reply_markup: keyboard)
end