class Telegram::API::Message

Overview

This object represents a message.

Defined in:

telegram/api/generated/types.cr
telegram/api/overrides/message.cr

Constructors

Instance Method Summary

Instance methods inherited from class Telegram::API::Type

==(other) ==, client client

Constructor methods inherited from class Telegram::API::Type

new(pull : JSON::PullParser) new

Constructor Detail

def self.new(message_id : Int32, date : Time, chat : Chat, from : User | Nil = nil, sender_chat : Chat | Nil = nil, forward_from : User | Nil = nil, forward_from_chat : Chat | Nil = nil, forward_from_message_id : Int32 | Nil = nil, forward_signature : String | Nil = nil, forward_sender_name : String | Nil = nil, forward_date : Time | Nil = nil, is_automatic_forward : Bool | Nil = nil, reply_to_message : Message | Nil = nil, via_bot : User | Nil = nil, edit_date : Time | Nil = nil, has_protected_content : Bool | Nil = nil, media_group_id : String | Nil = nil, author_signature : String | Nil = nil, text : String | Nil = nil, animation : Animation | Nil = nil, audio : Audio | Nil = nil, document : Document | Nil = nil, sticker : Sticker | Nil = nil, video : Video | Nil = nil, video_note : VideoNote | Nil = nil, voice : Voice | Nil = nil, caption : String | Nil = nil, contact : Contact | Nil = nil, dice : Dice | Nil = nil, game : Game | Nil = nil, poll : Poll | Nil = nil, venue : Venue | Nil = nil, location : Location | Nil = nil, left_chat_member : User | Nil = nil, new_chat_title : String | Nil = nil, delete_chat_photo : Bool | Nil = nil, group_chat_created : Bool | Nil = nil, supergroup_chat_created : Bool | Nil = nil, channel_chat_created : Bool | Nil = nil, message_auto_delete_timer_changed : MessageAutoDeleteTimerChanged | Nil = nil, migrate_to_chat_id : Int32 | Nil = nil, migrate_from_chat_id : Int32 | Nil = nil, pinned_message : Message | Nil = nil, invoice : Invoice | Nil = nil, successful_payment : SuccessfulPayment | Nil = nil, connected_website : String | Nil = nil, passport_data : PassportData | Nil = nil, proximity_alert_triggered : ProximityAlertTriggered | Nil = nil, voice_chat_scheduled : VoiceChatScheduled | Nil = nil, voice_chat_started : VoiceChatStarted | Nil = nil, voice_chat_ended : VoiceChatEnded | Nil = nil, voice_chat_participants_invited : VoiceChatParticipantsInvited | Nil = nil, reply_markup : InlineKeyboardMarkup | Nil = nil, entities : Array(MessageEntity) = Array(MessageEntity).new, photo : Array(PhotoSize) = Array(PhotoSize).new, caption_entities : Array(MessageEntity) = Array(MessageEntity).new, new_chat_members : Array(User) = Array(User).new, new_chat_photo : Array(PhotoSize) = Array(PhotoSize).new) #

[View source]
def self.new(pull : JSON::PullParser) #

This object represents a message.


[View source]

Instance Method Detail

def animation : Animation | Nil #

Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set


[View source]
def animation=(animation : Animation | Nil) #

Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set


[View source]
def audio : Audio | Nil #

Optional. Message is an audio file, information about the file


[View source]
def audio=(audio : Audio | Nil) #

Optional. Message is an audio file, information about the file


[View source]
def author_signature : String | Nil #

Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator


[View source]
def author_signature=(author_signature : String | Nil) #

Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator


[View source]
def caption : String | Nil #

Optional. Caption for the animation, audio, document, photo, video or voice, 0-1024 characters


[View source]
def caption=(caption : String | Nil) #

Optional. Caption for the animation, audio, document, photo, video or voice, 0-1024 characters


[View source]
def caption_entities : Array(MessageEntity) #

Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption


[View source]
def caption_entities=(caption_entities : Array(MessageEntity)) #

Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption


[View source]
def channel_chat_created : Bool | Nil #

Optional. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.


[View source]
def channel_chat_created=(channel_chat_created : Bool | Nil) #

Optional. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.


[View source]
def chat : Chat #

Conversation the message belongs to


[View source]
def chat=(chat : Chat) #

Conversation the message belongs to


[View source]
def chats #

[View source]
def chats(&block : Chat -> ) #

[View source]
def connected_website : String | Nil #

Optional. The domain name of the website on which the user has logged in. More about Telegram Login: https://core.telegram.org/widgets/login


[View source]
def connected_website=(connected_website : String | Nil) #

Optional. The domain name of the website on which the user has logged in. More about Telegram Login: https://core.telegram.org/widgets/login


[View source]
def contact : Contact | Nil #

Optional. Message is a shared contact, information about the contact


[View source]
def contact=(contact : Contact | Nil) #

Optional. Message is a shared contact, information about the contact


[View source]
def date : Time #

Date the message was sent in Unix time


[View source]
def date=(date : Time) #

Date the message was sent in Unix time


[View source]
def delete #

Delete the message. See Telegram::API#delete_message.


[View source]
def delete_chat_photo : Bool | Nil #

Optional. Service message: the chat photo was deleted


[View source]
def delete_chat_photo=(delete_chat_photo : Bool | Nil) #

Optional. Service message: the chat photo was deleted


[View source]
def dice : Dice | Nil #

Optional. Message is a dice with random value


[View source]
def dice=(dice : Dice | Nil) #

Optional. Message is a dice with random value


[View source]
def document : Document | Nil #

Optional. Message is a general file, information about the file


[View source]
def document=(document : Document | Nil) #

Optional. Message is a general file, information about the file


[View source]
def edit_caption(caption, **kwargs) #

Edits the message's caption. See Telegram::API#edit_message_caption


[View source]
def edit_date : Time | Nil #

Optional. Date the message was last edited in Unix time


[View source]
def edit_date=(edit_date : Time | Nil) #

Optional. Date the message was last edited in Unix time


[View source]
def edit_live_location(latitude, longitude, **kwargs) #

Edits the message's live_location. See Telegram::API#edit_message_live_location


[View source]
def edit_media(media, **kwargs) #

Edits the message's media. See Telegram::API#edit_message_media


[View source]
def edit_reply_markup(reply_markup) #

Set the reply markup for the message. See Telegram::API#edit_message_reply_markup.


[View source]
def edit_text(text, **kwargs) #

Edits the text of a message. See Telegram::API#edit_message_text.


[View source]
def entities : Array(MessageEntity) #

Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text


[View source]
def entities=(entities : Array(MessageEntity)) #

Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text


[View source]
def file #

[View source]
def forward(to_chat, **kwargs) #

Forward the message to another chat. See Telegram::API#forward_message.


[View source]
def forward_date : Time | Nil #

Optional. For forwarded messages, date the original message was sent in Unix time


[View source]
def forward_date=(forward_date : Time | Nil) #

Optional. For forwarded messages, date the original message was sent in Unix time


[View source]
def forward_from : User | Nil #

Optional. For forwarded messages, sender of the original message


[View source]
def forward_from=(forward_from : User | Nil) #

Optional. For forwarded messages, sender of the original message


[View source]
def forward_from_chat : Chat | Nil #

Optional. For messages forwarded from channels or from anonymous administrators, information about the original sender chat


[View source]
def forward_from_chat=(forward_from_chat : Chat | Nil) #

Optional. For messages forwarded from channels or from anonymous administrators, information about the original sender chat


[View source]
def forward_from_message_id : Int32 | Nil #

Optional. For messages forwarded from channels, identifier of the original message in the channel


[View source]
def forward_from_message_id=(forward_from_message_id : Int32 | Nil) #

Optional. For messages forwarded from channels, identifier of the original message in the channel


[View source]
def forward_sender_name : String | Nil #

Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages


[View source]
def forward_sender_name=(forward_sender_name : String | Nil) #

Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages


[View source]
def forward_signature : String | Nil #

Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present


[View source]
def forward_signature=(forward_signature : String | Nil) #

Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present


[View source]
def from : User | Nil #

Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.


[View source]
def from=(from : User | Nil) #

Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.


[View source]
def game : Game | Nil #

Optional. Message is a game, information about the game. More about games: https://core.telegram.org/bots/api#games


[View source]
def game=(game : Game | Nil) #

Optional. Message is a game, information about the game. More about games: https://core.telegram.org/bots/api#games


[View source]
def group_chat_created : Bool | Nil #

Optional. Service message: the group has been created


[View source]
def group_chat_created=(group_chat_created : Bool | Nil) #

Optional. Service message: the group has been created


[View source]
def has_protected_content : Bool | Nil #

Optional. True, if the message can't be forwarded


[View source]
def has_protected_content=(has_protected_content : Bool | Nil) #

Optional. True, if the message can't be forwarded


[View source]
def invoice : Invoice | Nil #

Optional. Message is an invoice for a payment, information about the invoice. More about payments: https://core.telegram.org/bots/api#payments


[View source]
def invoice=(invoice : Invoice | Nil) #

Optional. Message is an invoice for a payment, information about the invoice. More about payments: https://core.telegram.org/bots/api#payments


[View source]
def is_automatic_forward : Bool | Nil #

Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group


[View source]
def is_automatic_forward=(is_automatic_forward : Bool | Nil) #

Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group


[View source]
def left_chat_member : User | Nil #

Optional. A member was removed from the group, information about them (this member may be the bot itself)


[View source]
def left_chat_member=(left_chat_member : User | Nil) #

Optional. A member was removed from the group, information about them (this member may be the bot itself)


[View source]
def link #

[View source]
def location : Location | Nil #

Optional. Message is a shared location, information about the location


[View source]
def location=(location : Location | Nil) #

Optional. Message is a shared location, information about the location


[View source]
def media_group_id : String | Nil #

Optional. The unique identifier of a media message group this message belongs to


[View source]
def media_group_id=(media_group_id : String | Nil) #

Optional. The unique identifier of a media message group this message belongs to


[View source]
def message_auto_delete_timer_changed : MessageAutoDeleteTimerChanged | Nil #

Optional. Service message: auto-delete timer settings changed in the chat


[View source]
def message_auto_delete_timer_changed=(message_auto_delete_timer_changed : MessageAutoDeleteTimerChanged | Nil) #

Optional. Service message: auto-delete timer settings changed in the chat


[View source]
def message_id : Int32 #

Unique message identifier inside this chat


[View source]
def message_id=(message_id : Int32) #

Unique message identifier inside this chat


[View source]
def migrate_from_chat_id : Int32 | Nil #

Optional. The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.


[View source]
def migrate_from_chat_id=(migrate_from_chat_id : Int32 | Nil) #

Optional. The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.


[View source]
def migrate_to_chat_id : Int32 | Nil #

Optional. The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.


[View source]
def migrate_to_chat_id=(migrate_to_chat_id : Int32 | Nil) #

Optional. The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.


[View source]
def new_chat_members : Array(User) #

Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)


[View source]
def new_chat_members=(new_chat_members : Array(User)) #

Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)


[View source]
def new_chat_photo : Array(PhotoSize) #

Optional. A chat photo was change to this value


[View source]
def new_chat_photo=(new_chat_photo : Array(PhotoSize)) #

Optional. A chat photo was change to this value


[View source]
def new_chat_title : String | Nil #

Optional. A chat title was changed to this value


[View source]
def new_chat_title=(new_chat_title : String | Nil) #

Optional. A chat title was changed to this value


[View source]
def passport_data : PassportData | Nil #

Optional. Telegram Passport data


[View source]
def passport_data=(passport_data : PassportData | Nil) #

Optional. Telegram Passport data


[View source]
def photo : Array(PhotoSize) #

Optional. Message is a photo, available sizes of the photo


[View source]
def photo=(photo : Array(PhotoSize)) #

Optional. Message is a photo, available sizes of the photo


[View source]
def pin(**kwargs) #

Pin the message. See Telegram::API#pin_chat_message.


[View source]
def pinned_message : Message | Nil #

Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply.


[View source]
def pinned_message=(pinned_message : Message | Nil) #

Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply.


[View source]
def poll : Poll | Nil #

Optional. Message is a native poll, information about the poll


[View source]
def poll=(poll : Poll | Nil) #

Optional. Message is a native poll, information about the poll


[View source]
def proximity_alert_triggered : ProximityAlertTriggered | Nil #

Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location.


[View source]
def proximity_alert_triggered=(proximity_alert_triggered : ProximityAlertTriggered | Nil) #

Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location.


[View source]
def raw_caption(parse_mode : ParseMode = :markdown) #

[View source]
def raw_text(parse_mode : ParseMode = :markdown) #

[View source]
def reply(message, **kwargs) #

Reply to a message. See Telegram::API#send_message.


[View source]
def reply_markup : InlineKeyboardMarkup | Nil #

Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.


[View source]
def reply_markup=(reply_markup : InlineKeyboardMarkup | Nil) #

Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.


[View source]
def reply_to_message : Message | Nil #

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.


[View source]
def reply_to_message=(reply_to_message : Message | Nil) #

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.


[View source]
def reply_with_animation(*args, **kwargs) #

[View source]
def reply_with_audio(*args, **kwargs) #

[View source]
def reply_with_basketball(*args, **kwargs) #

[View source]
def reply_with_contact(*args, **kwargs) #

[View source]
def reply_with_dart(*args, **kwargs) #

[View source]
def reply_with_dice(*args, **kwargs) #

[View source]
def reply_with_document(*args, **kwargs) #

[View source]
def reply_with_invoice(*args, **kwargs) #

[View source]
def reply_with_location(*args, **kwargs) #

[View source]
def reply_with_media_group(*args, **kwargs) #

[View source]
def reply_with_photo(*args, **kwargs) #

[View source]
def reply_with_poll(*args, **kwargs) #

[View source]
def reply_with_sticker(*args, **kwargs) #

[View source]
def reply_with_venu(*args, **kwargs) #

[View source]
def reply_with_video(*args, **kwargs) #

[View source]
def reply_with_video_note(*args, **kwargs) #

[View source]
def reply_with_voice(*args, **kwargs) #

[View source]
def respond(message, **kwargs) #

Respond to a message. See Telegram::API#send_message.


[View source]
def respond_with_animation(*args, **kwargs) #

[View source]
def respond_with_audio(*args, **kwargs) #

[View source]
def respond_with_basketball(*args, **kwargs) #

[View source]
def respond_with_contact(*args, **kwargs) #

[View source]
def respond_with_dart(*args, **kwargs) #

[View source]
def respond_with_dice(*args, **kwargs) #

[View source]
def respond_with_document(*args, **kwargs) #

[View source]
def respond_with_invoice(*args, **kwargs) #

[View source]
def respond_with_location(*args, **kwargs) #

[View source]
def respond_with_media_group(*args, **kwargs) #

[View source]
def respond_with_photo(*args, **kwargs) #

[View source]
def respond_with_poll(*args, **kwargs) #

[View source]
def respond_with_sticker(*args, **kwargs) #

[View source]
def respond_with_venu(*args, **kwargs) #

[View source]
def respond_with_video(*args, **kwargs) #

[View source]
def respond_with_video_note(*args, **kwargs) #

[View source]
def respond_with_voice(*args, **kwargs) #

[View source]
def sender_chat : Chat | Nil #

Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.


[View source]
def sender_chat=(sender_chat : Chat | Nil) #

Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.


[View source]
def sender_type #

[View source]
def sticker : Sticker | Nil #

Optional. Message is a sticker, information about the sticker


[View source]
def sticker=(sticker : Sticker | Nil) #

Optional. Message is a sticker, information about the sticker


[View source]
def stop_live_location(**kwargs) #

[View source]
def successful_payment : SuccessfulPayment | Nil #

Optional. Message is a service message about a successful payment, information about the payment. More about payments: https://core.telegram.org/bots/api#payments


[View source]
def successful_payment=(successful_payment : SuccessfulPayment | Nil) #

Optional. Message is a service message about a successful payment, information about the payment. More about payments: https://core.telegram.org/bots/api#payments


[View source]
def supergroup_chat_created : Bool | Nil #

Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.


[View source]
def supergroup_chat_created=(supergroup_chat_created : Bool | Nil) #

Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.


[View source]
def text : String | Nil #

Optional. For text messages, the actual UTF-8 text of the message, 0-4096 characters


[View source]
def text=(text : String | Nil) #

Optional. For text messages, the actual UTF-8 text of the message, 0-4096 characters


[View source]
def text_entities #

[View source]
def unpin(**kwargs) #

Unpin the message. See Telegram::API#unpin_chat_message.


[View source]
def users #

[View source]
def users(&block : User -> ) #

[View source]
def venue : Venue | Nil #

Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set


[View source]
def venue=(venue : Venue | Nil) #

Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set


[View source]
def via_bot : User | Nil #

Optional. Bot through which the message was sent


[View source]
def via_bot=(via_bot : User | Nil) #

Optional. Bot through which the message was sent


[View source]
def video : Video | Nil #

Optional. Message is a video, information about the video


[View source]
def video=(video : Video | Nil) #

Optional. Message is a video, information about the video


[View source]
def video_note : VideoNote | Nil #

Optional. Message is a video note, information about the video message


[View source]
def video_note=(video_note : VideoNote | Nil) #

Optional. Message is a video note, information about the video message


[View source]
def voice : Voice | Nil #

Optional. Message is a voice message, information about the file


[View source]
def voice=(voice : Voice | Nil) #

Optional. Message is a voice message, information about the file


[View source]
def voice_chat_ended : VoiceChatEnded | Nil #

Optional. Service message: voice chat ended


[View source]
def voice_chat_ended=(voice_chat_ended : VoiceChatEnded | Nil) #

Optional. Service message: voice chat ended


[View source]
def voice_chat_participants_invited : VoiceChatParticipantsInvited | Nil #

Optional. Service message: new participants invited to a voice chat


[View source]
def voice_chat_participants_invited=(voice_chat_participants_invited : VoiceChatParticipantsInvited | Nil) #

Optional. Service message: new participants invited to a voice chat


[View source]
def voice_chat_scheduled : VoiceChatScheduled | Nil #

Optional. Service message: voice chat scheduled


[View source]
def voice_chat_scheduled=(voice_chat_scheduled : VoiceChatScheduled | Nil) #

Optional. Service message: voice chat scheduled


[View source]
def voice_chat_started : VoiceChatStarted | Nil #

Optional. Service message: voice chat started


[View source]
def voice_chat_started=(voice_chat_started : VoiceChatStarted | Nil) #

Optional. Service message: voice chat started


[View source]