Class: Message

Inherits:
Object
  • Object
show all
Defined in:
lib/telegramObjects.rb

Overview

Object describing a Message

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Message

Returns a new instance of Message.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/telegramObjects.rb', line 55

def initialize json
  return if !json
  @message_id = json["message_id"]
  @from = User.new json["from"]
  @date = json["date"]
  @chat = !json["chat"] ? nil : (json["chat"].has_key?("title") ? GroupChat.new(json["chat"]) : User.new(json["chat"]))
  @forward_from = User.new json["forward_from"]
  @forward_date = json["forward_date"]
  @reply_to_message = Message.new json["reply_to_message"]
  @text = json["text"]
  @audio = Audio.new json["audio"]
  @document = Document.new json["document"]
  @photo = ArrayOf.new(json["photo"], PhotoSize).to_a
  @sticker = Sticker.new json["sticker"]
  @video = Video.new json["video"]
  @contact = Contact.new json["contact"]
  @location = Location.new json["location"]
  @new_chat_participant = User.new json["new_chat_participant"]
  @left_chat_participant = User.new json["left_chat_participant"]
  @new_chat_title = json["new_chat_title"]
  @new_chat_photo = ArrayOf.new(json["new_chat_photo"],PhotoSize).to_a
  @delete_chat_photo = json["delete_chat_photo"]
  @group_chat_create = json["group_chat_create"]
end

Instance Attribute Details

#audioObject

Returns the value of attribute audio.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def audio
  @audio
end

#chatObject

Returns the value of attribute chat.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def chat
  @chat
end

#contactObject

Returns the value of attribute contact.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def contact
  @contact
end

#dateObject

Returns the value of attribute date.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def date
  @date
end

#delete_chat_photoObject

Returns the value of attribute delete_chat_photo.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def delete_chat_photo
  @delete_chat_photo
end

#documentObject

Returns the value of attribute document.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def document
  @document
end

#forward_dateObject

Returns the value of attribute forward_date.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def forward_date
  @forward_date
end

#forward_fromObject

Returns the value of attribute forward_from.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def forward_from
  @forward_from
end

#fromObject

Returns the value of attribute from.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def from
  @from
end

#group_chat_createObject

Returns the value of attribute group_chat_create.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def group_chat_create
  @group_chat_create
end

#left_chat_participantObject

Returns the value of attribute left_chat_participant.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def left_chat_participant
  @left_chat_participant
end

#locationObject

Returns the value of attribute location.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def location
  @location
end

#message_idObject

Returns the value of attribute message_id.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def message_id
  @message_id
end

#new_chat_participantObject

Returns the value of attribute new_chat_participant.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def new_chat_participant
  @new_chat_participant
end

#new_chat_photoObject

Returns the value of attribute new_chat_photo.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def new_chat_photo
  @new_chat_photo
end

#new_chat_titleObject

Returns the value of attribute new_chat_title.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def new_chat_title
  @new_chat_title
end

#photoObject

Returns the value of attribute photo.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def photo
  @photo
end

#reply_to_messageObject

Returns the value of attribute reply_to_message.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def reply_to_message
  @reply_to_message
end

#stickerObject

Returns the value of attribute sticker.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def sticker
  @sticker
end

#textObject

Returns the value of attribute text.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def text
  @text
end

#videoObject

Returns the value of attribute video.



50
51
52
# File 'lib/telegramObjects.rb', line 50

def video
  @video
end