class TelegramBot::Chat

Public Class Methods

from(id) click to toggle source
Calls superclass method
# 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