Class: TelegramBot::Chat
- Inherits:
-
Struct
- Object
- Struct
- TelegramBot::Chat
- Includes:
- AutoFromMethods
- Defined in:
- lib/telegram_bot/chat.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
Class Method Summary collapse
Methods included from AutoFromMethods
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id
3 4 5 |
# File 'lib/telegram_bot/chat.rb', line 3 def id @id end |
Class Method Details
.from(id) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/telegram_bot/chat.rb', line 6 def self.from(id) case id when Integer TelegramBot::Chat.new(id) when TelegramBot::GroupChat, TelegramBot::User id when Hash if id.has_key? 'title' TelegramBot::GroupChat.from(id) elsif id.has_key? 'first_name' TelegramBot::User.from(id) else TelegramBot::Chat.from(id['id']) end else super end end |