Class: TelegramSupportBot::Adapters::TelegramBot
- Defined in:
- lib/telegram_support_bot/adapters/telegram_bot.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #forward_message(from_chat_id:, chat_id:, message_id:) ⇒ Object
-
#initialize(**options) ⇒ TelegramBot
constructor
A new instance of TelegramBot.
-
#send_audio(chat_id:, audio:, **options) ⇒ Object
Handles sending audio messages.
- #send_document(chat_id:, document:, **options) ⇒ Object
- #send_message(chat_id:, text:, **options) ⇒ Object (also: #send_text)
- #send_photo(chat_id:, photo:, **options) ⇒ Object
-
#send_sticker(chat_id:, sticker:, **options) ⇒ Object
Handles sending sticker messages.
- #send_video(chat_id:, video:, **options) ⇒ Object
-
#send_voice(chat_id:, voice:, **options) ⇒ Object
Handles sending audio messages.
Methods inherited from Base
#on_message, #send_media, #setup
Constructor Details
#initialize(**options) ⇒ TelegramBot
Returns a new instance of TelegramBot.
8 9 10 11 |
# File 'lib/telegram_support_bot/adapters/telegram_bot.rb', line 8 def initialize(**) super @bot = Telegram::Bot::Client.new(@options[:token], @options[:username]) end |
Instance Method Details
#forward_message(from_chat_id:, chat_id:, message_id:) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/telegram_support_bot/adapters/telegram_bot.rb', line 46 def (from_chat_id:, chat_id:, message_id:) @bot.( chat_id: chat_id, from_chat_id: from_chat_id, message_id: ) end |
#send_audio(chat_id:, audio:, **options) ⇒ Object
Handles sending audio messages
32 33 34 |
# File 'lib/telegram_support_bot/adapters/telegram_bot.rb', line 32 def send_audio(chat_id:, audio:, **) @bot.send_audio(chat_id: chat_id, audio: audio, **) end |
#send_document(chat_id:, document:, **options) ⇒ Object
27 28 29 |
# File 'lib/telegram_support_bot/adapters/telegram_bot.rb', line 27 def send_document(chat_id:, document:, **) @bot.send_document(chat_id: chat_id, document: document, **) end |
#send_message(chat_id:, text:, **options) ⇒ Object Also known as: send_text
13 14 15 |
# File 'lib/telegram_support_bot/adapters/telegram_bot.rb', line 13 def (chat_id:, text:, **) @bot.(chat_id: chat_id, text: text, **) end |
#send_photo(chat_id:, photo:, **options) ⇒ Object
19 20 21 |
# File 'lib/telegram_support_bot/adapters/telegram_bot.rb', line 19 def send_photo(chat_id:, photo:, **) @bot.send_photo(chat_id: chat_id, photo: photo, **) end |
#send_sticker(chat_id:, sticker:, **options) ⇒ Object
Handles sending sticker messages
42 43 44 |
# File 'lib/telegram_support_bot/adapters/telegram_bot.rb', line 42 def send_sticker(chat_id:, sticker:, **) @bot.send_sticker(chat_id: chat_id, sticker: sticker, **) end |
#send_video(chat_id:, video:, **options) ⇒ Object
23 24 25 |
# File 'lib/telegram_support_bot/adapters/telegram_bot.rb', line 23 def send_video(chat_id:, video:, **) @bot.send_video(chat_id: chat_id, video: video, **) end |
#send_voice(chat_id:, voice:, **options) ⇒ Object
Handles sending audio messages
37 38 39 |
# File 'lib/telegram_support_bot/adapters/telegram_bot.rb', line 37 def send_voice(chat_id:, voice:, **) @bot.send_voice(chat_id: chat_id, voice: voice, **) end |