Class: TelegramSupportBot::Adapters::TelegramBotRuby

Inherits:
Base
  • Object
show all
Defined in:
lib/telegram_support_bot/adapters/telegram_bot_ruby.rb

Instance Attribute Summary

Attributes inherited from Base

#bot

Instance Method Summary collapse

Methods inherited from Base

#on_message, #send_media, #setup

Constructor Details

#initialize(**options) ⇒ TelegramBotRuby

Returns a new instance of TelegramBotRuby.



8
9
10
11
# File 'lib/telegram_support_bot/adapters/telegram_bot_ruby.rb', line 8

def initialize(**options)
  super
  @bot = Telegram::Bot::Client.new(@options[:token])
end

Instance Method Details

#forward_message(from_chat_id:, chat_id:, message_id:) ⇒ Object



43
44
45
# File 'lib/telegram_support_bot/adapters/telegram_bot_ruby.rb', line 43

def forward_message(from_chat_id:, chat_id:, message_id:)
  bot.api.forward_message(chat_id: chat_id, from_chat_id: from_chat_id, message_id: message_id)
end

#send_audio(chat_id:, audio:, **options) ⇒ Object



31
32
33
# File 'lib/telegram_support_bot/adapters/telegram_bot_ruby.rb', line 31

def send_audio(chat_id:, audio:, **options)
  bot.api.send_audio(chat_id: chat_id, audio: audio, **options)
end

#send_document(chat_id:, document:, **options) ⇒ Object



27
28
29
# File 'lib/telegram_support_bot/adapters/telegram_bot_ruby.rb', line 27

def send_document(chat_id:, document:, **options)
  bot.api.send_document(chat_id: chat_id, document: document, **options)
end

#send_message(chat_id:, text:, **options) ⇒ Object Also known as: send_text



13
14
15
# File 'lib/telegram_support_bot/adapters/telegram_bot_ruby.rb', line 13

def send_message(chat_id:, text:, **options)
  bot.api.send_message(chat_id: chat_id, text: text, **options)
end

#send_photo(chat_id:, photo:, **options) ⇒ Object



19
20
21
# File 'lib/telegram_support_bot/adapters/telegram_bot_ruby.rb', line 19

def send_photo(chat_id:, photo:, **options)
  bot.api.send_photo(chat_id: chat_id, photo: photo, **options)
end

#send_sticker(chat_id:, sticker:, **options) ⇒ Object



39
40
41
# File 'lib/telegram_support_bot/adapters/telegram_bot_ruby.rb', line 39

def send_sticker(chat_id:, sticker:, **options)
  bot.api.send_sticker(chat_id: chat_id, sticker: sticker, **options)
end

#send_video(chat_id:, video:, **options) ⇒ Object



23
24
25
# File 'lib/telegram_support_bot/adapters/telegram_bot_ruby.rb', line 23

def send_video(chat_id:, video:, **options)
  bot.api.send_video(chat_id: chat_id, video: video, **options)
end

#send_voice(chat_id:, voice:, **options) ⇒ Object



35
36
37
# File 'lib/telegram_support_bot/adapters/telegram_bot_ruby.rb', line 35

def send_voice(chat_id:, voice:, **options)
  bot.api.send_voice(chat_id: chat_id, voice: voice, **options)
end