Class: TelegramBot::OutMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/telegram_bot/out_message.rb

Instance Method Summary collapse

Instance Method Details

#chat_friendly_nameObject



15
16
17
# File 'lib/telegram_bot/out_message.rb', line 15

def chat_friendly_name
  chat.friendly_name
end

#send_with(bot) ⇒ Object



11
12
13
# File 'lib/telegram_bot/out_message.rb', line 11

def send_with(bot)
  bot.send_message(self)
end

#to_hObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/telegram_bot/out_message.rb', line 19

def to_h
  message = {
      text: text,
      chat_id: chat.id
  }

  message[:reply_to_message_id] = reply_to.id unless reply_to.nil?
  message[:parse_mode] = parse_mode unless parse_mode.nil?
  message[:disable_web_page_preview] = disable_web_page_preview unless disable_web_page_preview.nil?
  message[:reply_markup] = reply_markup.to_h.to_json unless reply_markup.nil?

  message
end