class Chat
Is a representation of Telegrams Chat
object
Attributes
first_name[R]
id[R]
last_name[R]
title[R]
type[R]
username[R]
Public Class Methods
from_hash(chat)
click to toggle source
# File lib/telegram/chat.rb, line 7 def self.from_hash(chat) return nil unless chat.is_a? Hash Chat.new(id: chat['id'], type: chat['type'], title: chat['title'], username: chat['username'], first_name: chat['first_name'], last_name: chat['last_name']) end
new(id:, type:, title: nil, username: nil, first_name: nil, last_name: nil)
click to toggle source
# File lib/telegram/chat.rb, line 13 def initialize(id:, type:, title: nil, username: nil, first_name: nil, last_name: nil) @id = id @type = type @title = title @username = username @first_name = first_name @last_name = last_name end
Public Instance Methods
reply(text, opts = {})
click to toggle source
# File lib/telegram/chat.rb, line 22 def reply(text, opts = {}) Telegram.sendMessage opts.merge(chat_id: id, text: text) end