class Message
Monday
, August
24
2020
EAT
This object represents a message.¶ ↑
Public Instance Methods
Optional.
Message
is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set. Returns Animation
object
# File lib/objects/message.rb, line 159 def animation an = @message.animation return Animation.new(an) if an false end
# File lib/objects/message.rb, line 305 def animation_msg? @message.animation ? true : false end
Optional
. message is an Audio
file, information about the file.
# File lib/objects/message.rb, line 167 def audio ad = @message.audio return Audio.new(ad) if ad false end
# File lib/objects/message.rb, line 289 def audio_msg? @message.audio ? true : false end
Optional
. Caption for the animation, audio, document, photo, video or voice, 0-1024 characters.
# File lib/objects/message.rb, line 233 def caption @message.caption end
Optional.
For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption.
# File lib/objects/message.rb, line 239 def caption_entities c_entitys = @message.caption_entities if c_entitys.empty? return false end ary_ent = [] c_entitys.each do |ent| ary_ent << MessageEntity.new(ent) end ary_ent end
Conversation the message belongs to. Returns Chat
object
# File lib/objects/message.rb, line 49 def chat Chat.new(@message.chat) end
Optional
. Message
is a shared contact, information about the contact.
# File lib/objects/message.rb, line 253 def contact kontakt = @message.contact return Contact.new(kontakt) if kontakt false end
# File lib/objects/message.rb, line 297 def contact_msg? @message.contact ? true : false end
TDate Object the message was sent in Unix time
# File lib/objects/message.rb, line 43 def date return TDate.new(@message.date) end
# File lib/objects/message.rb, line 361 def delete_chat_photo? @message.delete_chat_photo ? true : false end
Optional
. message is a general file, information about the file. Returns Document
object.
# File lib/objects/message.rb, line 176 def document doc = @message.document return Document.new(doc) if doc false end
# File lib/objects/message.rb, line 293 def document_msg? @message.document ? true : false end
Optional
. Retuns TDate object.
# File lib/objects/message.rb, line 118 def edit_date TDate.new(@messag.edit_date) end
Optional.
For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text. Returns array of MessageEntity
object
# File lib/objects/message.rb, line 142 def entities ary_entity = [] entitys = @message.entities if entitys.empty? return false end entitys.each do |ent| ary_entity << MessageEntity.new(ent) end ary_entity end
Optional.
For forwarded messages, date the original message was sent in Unix time. Returns TDate object.
# File lib/objects/message.rb, line 93 def forward_date TDate.new(@message.forward_date) end
Optional.
For forwarded messages, sender of the original message. Returns Chat
object
# File lib/objects/message.rb, line 55 def forward_from f_from = @message.forward_from return User.new(f_from) if f_from false end
Optional.
For messages forwarded from channels, information about the original channel. Returns Chat
object.
# File lib/objects/message.rb, line 65 def forward_from_chat ff_chat = @message.forward_from_chat return Chat.new(ff_chat) if ff_chat false end
# File lib/objects/message.rb, line 369 def forward_from_chat? @message.forward_from_chat ? true : false end
Optional.
For messages forwarded from channels, identifier of the original message in the channel.
# File lib/objects/message.rb, line 74 def forward_from_message_id @message.forward_from_message_id end
# File lib/objects/message.rb, line 301 def forward_msg? (@update.forward_from) or (@update.forward_from_chat) ? true : false end
Optional
. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages.
# File lib/objects/message.rb, line 86 def forward_sender_name @message.forward_sender_name end
Optional.
For messages forwarded from channels, signature of the post author if present.
# File lib/objects/message.rb, line 80 def forward_signature @message.forward_signature end
Optional.
Sender, empty for messages sent to channels. Returns User
object.
# File lib/objects/message.rb, line 35 def from frm = @message.from return User.new(frm) if frm false end
# File lib/objects/message.rb, line 325 def game_msg? @message.game ? true : false end
# File lib/objects/message.rb, line 373 def has_entities? @message.entities.empty? ? false : true end
# File lib/objects/message.rb, line 345 def left_chat_member? @message.left_chat_member ? true : false end
# File lib/objects/message.rb, line 337 def location_msg? @message.location ? true : false end
Optional
. The unique identifier of a media message group this message belongs to.
# File lib/objects/message.rb, line 124 def media_group_id @message.media_group_id end
Unique message identifier inside the chat.
# File lib/objects/message.rb, line 29 def message_id @message.message_id end
# File lib/objects/message.rb, line 341 def new_chat_member? @message.new_chat_member ? true : false end
# File lib/objects/message.rb, line 353 def new_chat_photo? @message.new_chat_photo ? true : false end
# File lib/objects/message.rb, line 349 def new_chat_title? @message.new_chat_title ? true : false end
Optional
. message is a Photo, available sizes of the photo. returns array of PhotoSize
object
# File lib/objects/message.rb, line 185 def photo poto = @message.photo if poto.empty? return false end e_photo = [] poto.each do e_photo << PhotoSize.new(e_photo) end e_photo end
# File lib/objects/message.rb, line 309 def photo_msg? @message.photo.empty? ? false : true end
# File lib/objects/message.rb, line 357 def pinned_msg? @message.pinned_message ? true : false end
# File lib/objects/message.rb, line 329 def poll_msg? @message.poll ? true : false end
# File lib/objects/message.rb, line 365 def reply_markup? @message.reply_markup ? true : false end
returns true if the update is for replied msg
# File lib/objects/message.rb, line 281 def reply_msg? @message.reply_to_message ? true : false end
Optional.
For replies, the original message. Note that the Message
object in this field will not contain further reply_to_message
fields even if it itself is a reply. Returns Message
object
# File lib/objects/message.rb, line 101 def reply_to_message r_t_msg = @message.reply_to_message return Message.new(r_t_msg) if r_t_msg false end
# File lib/objects/message.rb, line 321 def sticker_msg? @message.sticker ? true : false end
Optional
. For text messages, the actual UTF-8 text of the message, 0-4096 characters
# File lib/objects/message.rb, line 135 def text @message.text end
# File lib/objects/message.rb, line 276 def text_msg? text ? true : false end
# File lib/objects/message.rb, line 333 def venue_msg? @message.venue ? true : false end
Optional
. Bot through which the message was sent. Returns User
object.
# File lib/objects/message.rb, line 110 def via_bot v_bot = @message.via_bot return User.new(v_bot) if v_bot false end
# File lib/objects/message.rb, line 285 def video_msg? @message.video ? true : false end
# File lib/objects/message.rb, line 317 def video_note_msg? @message.video_note ? true : false end
Optional
. message is a Voice
message, information about the file.
# File lib/objects/message.rb, line 224 def voice vc = @message.voice return Voice.new(vc) if vc false end
# File lib/objects/message.rb, line 313 def voice_msg? @message.voice ? true : false end