Class: YATelegramBot::TelegramAPI::Chat
- Inherits:
-
Hash
- Object
- Hash
- YATelegramBot::TelegramAPI::Chat
- Defined in:
- lib/ya_telegram_bot/telegram_api/chat.rb
Overview
represents Telegram Chat
Constant Summary collapse
- FIELDS =
[:id, :type, :title, :first_name, :last_name, :username].freeze
Instance Method Summary collapse
-
#initialize(hash, bot = nil) ⇒ Chat
constructor
A new instance of Chat.
- #method_missing(m, *args) ⇒ Object
-
#send_photo(params = {}) ⇒ Object
uses bot to send photo to this chat.
-
#send_text(params = {}) ⇒ Object
uses bot to send text to this chat.
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ Object
24 25 26 27 |
# File 'lib/ya_telegram_bot/telegram_api/chat.rb', line 24 def method_missing(m, *args) return self[m] if self[m] && args.empty? super end |
Instance Method Details
#send_photo(params = {}) ⇒ Object
uses bot to send photo to this chat.
46 47 48 49 50 51 |
# File 'lib/ya_telegram_bot/telegram_api/chat.rb', line 46 def send_photo(params = {}) fail InitWithoutBot unless @bot params[:chat] = id @bot.send_photo params end |
#send_text(params = {}) ⇒ Object
uses bot to send text to this chat.
34 35 36 37 38 39 |
# File 'lib/ya_telegram_bot/telegram_api/chat.rb', line 34 def send_text(params = {}) fail InitWithoutBot unless @bot params[:chat] = id @bot.send_text params end |