class

Tourmaline::Message

Inherits JSON::Serializable / Reference / Object

This object represents a message.

Constructors

new(message_id : Int32 | Int64, date : Time, chat : Tourmaline::Chat, message_thread_id : Int32 | Int64 | Nil = nil, from : Tourmaline::User | Nil = nil, sender_chat : Tourmaline::Chat | Nil = nil, forward_from : Tourmaline::User | Nil = nil, forward_from_chat : Tourmaline::Chat | Nil = nil, forward_from_message_id : Int32 | Int64 | Nil = nil, forward_signature : String | Nil = nil, forward_sender_name : String | Nil = nil, forward_date : Int32 | Int64 | Nil = nil, is_topic_message : Bool | Nil = nil, is_automatic_forward : Bool | Nil = nil, reply_to_message : Tourmaline::Message | Nil = nil, via_bot : Tourmaline::User | Nil = nil, edit_date : Int32 | Int64 | Nil = nil, has_protected_content : Bool | Nil = nil, media_group_id : String | Nil = nil, author_signature : String | Nil = nil, text : String | Nil = nil, entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, animation : Tourmaline::Animation | Nil = nil, audio : Tourmaline::Audio | Nil = nil, document : Tourmaline::Document | Nil = nil, photo : Array(Tourmaline::PhotoSize) = [] of Tourmaline::PhotoSize, sticker : Tourmaline::Sticker | Nil = nil, video : Tourmaline::Video | Nil = nil, video_note : Tourmaline::VideoNote | Nil = nil, voice : Tourmaline::Voice | Nil = nil, caption : String | Nil = nil, caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, has_media_spoiler : Bool | Nil = nil, contact : Tourmaline::Contact | Nil = nil, dice : Tourmaline::Dice | Nil = nil, game : Tourmaline::Game | Nil = nil, poll : Tourmaline::Poll | Nil = nil, venue : Tourmaline::Venue | Nil = nil, location : Tourmaline::Location | Nil = nil, new_chat_members : Array(Tourmaline::User) = [] of Tourmaline::User, left_chat_member : Tourmaline::User | Nil = nil, new_chat_title : String | Nil = nil, new_chat_photo : Array(Tourmaline::PhotoSize) = [] of Tourmaline::PhotoSize, 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 : Tourmaline::MessageAutoDeleteTimerChanged | Nil = nil, migrate_to_chat_id : Int32 | Int64 | Nil = nil, migrate_from_chat_id : Int32 | Int64 | Nil = nil, pinned_message : Tourmaline::Message | Nil = nil, invoice : Tourmaline::Invoice | Nil = nil, successful_payment : Tourmaline::SuccessfulPayment | Nil = nil, user_shared : Tourmaline::UserShared | Nil = nil, chat_shared : Tourmaline::ChatShared | Nil = nil, connected_website : String | Nil = nil, write_access_allowed : Tourmaline::WriteAccessAllowed | Nil = nil, passport_data : Tourmaline::PassportData | Nil = nil, proximity_alert_triggered : Tourmaline::ProximityAlertTriggered | Nil = nil, forum_topic_created : Tourmaline::ForumTopicCreated | Nil = nil, forum_topic_edited : Tourmaline::ForumTopicEdited | Nil = nil, forum_topic_closed : Tourmaline::ForumTopicClosed | Nil = nil, forum_topic_reopened : Tourmaline::ForumTopicReopened | Nil = nil, general_forum_topic_hidden : Tourmaline::GeneralForumTopicHidden | Nil = nil, general_forum_topic_unhidden : Tourmaline::GeneralForumTopicUnhidden | Nil = nil, video_chat_scheduled : Tourmaline::VideoChatScheduled | Nil = nil, video_chat_started : Tourmaline::VideoChatStarted | Nil = nil, video_chat_ended : Tourmaline::VideoChatEnded | Nil = nil, video_chat_participants_invited : Tourmaline::VideoChatParticipantsInvited | Nil = nil, web_app_data : Tourmaline::WebAppData | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Nil = nil)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

animation

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

Source
animation=(animation : Tourmaline::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

Source
audio

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

Source
audio=(audio : Tourmaline::Audio | Nil)

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

Source
author_signature

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

Source
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

Source
caption

Optional. Caption for the animation, audio, document, photo, video or voice

Source
caption=(caption : String | Nil)

Optional. Caption for the animation, audio, document, photo, video or voice

Source
caption_entities

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

Source
caption_entities=(caption_entities : Array(Tourmaline::MessageEntity))

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

Source
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.

Source
channel_chat_created?

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.

Source
chat

Conversation the message belongs to

Source
chat=(chat : Tourmaline::Chat)

Conversation the message belongs to

Source
chat_shared

Optional. Service message: a chat was shared with the bot

Source
chat_shared=(chat_shared : Tourmaline::ChatShared | Nil)

Optional. Service message: a chat was shared with the bot

Source
chats
Source
chats
Source
connected_website

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

Source
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

Source
contact

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

Source
contact=(contact : Tourmaline::Contact | Nil)

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

Source
date

Date the message was sent in Unix time

Source
date=(date : Time)

Date the message was sent in Unix time

Source
delete_chat_photo=(delete_chat_photo : Bool | Nil)

Optional. Service message: the chat photo was deleted

Source
delete_chat_photo?

Optional. Service message: the chat photo was deleted

Source
dice

Optional. Message is a dice with random value

Source
dice=(dice : Tourmaline::Dice | Nil)

Optional. Message is a dice with random value

Source
document

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

Source
document=(document : Tourmaline::Document | Nil)

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

Source
edit_date

Optional. Date the message was last edited in Unix time

Source
edit_date=(edit_date : Time | Nil)

Optional. Date the message was last edited in Unix time

Source
entities

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

Source
entities=(entities : Array(Tourmaline::MessageEntity))

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

Source
file
Source
forum_topic_closed

Optional. Service message: forum topic closed

Source
forum_topic_closed=(forum_topic_closed : Tourmaline::ForumTopicClosed | Nil)

Optional. Service message: forum topic closed

Source
forum_topic_created

Optional. Service message: forum topic created

Source
forum_topic_created=(forum_topic_created : Tourmaline::ForumTopicCreated | Nil)

Optional. Service message: forum topic created

Source
forum_topic_edited

Optional. Service message: forum topic edited

Source
forum_topic_edited=(forum_topic_edited : Tourmaline::ForumTopicEdited | Nil)

Optional. Service message: forum topic edited

Source
forum_topic_reopened

Optional. Service message: forum topic reopened

Source
forum_topic_reopened=(forum_topic_reopened : Tourmaline::ForumTopicReopened | Nil)

Optional. Service message: forum topic reopened

Source
forward_date

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

Source
forward_date=(forward_date : Time | Nil)

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

Source
forward_from

Optional. For forwarded messages, sender of the original message

Source
forward_from=(forward_from : Tourmaline::User | Nil)

Optional. For forwarded messages, sender of the original message

Source
forward_from_chat

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

Source
forward_from_chat=(forward_from_chat : Tourmaline::Chat | Nil)

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

Source
forward_from_message_id

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

Source
forward_from_message_id=(forward_from_message_id : Int32 | Int64 | Nil)

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

Source
forward_sender_name

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

Source
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

Source
forward_signature

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

Source
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

Source
from

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.

Source
from=(from : Tourmaline::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.

Source
game

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

Source
game=(game : Tourmaline::Game | Nil)

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

Source
general_forum_topic_hidden

Optional. Service message: the 'General' forum topic hidden

Source
general_forum_topic_hidden=(general_forum_topic_hidden : Tourmaline::GeneralForumTopicHidden | Nil)

Optional. Service message: the 'General' forum topic hidden

Source
general_forum_topic_unhidden

Optional. Service message: the 'General' forum topic unhidden

Source
general_forum_topic_unhidden=(general_forum_topic_unhidden : Tourmaline::GeneralForumTopicUnhidden | Nil)

Optional. Service message: the 'General' forum topic unhidden

Source
group_chat_created=(group_chat_created : Bool | Nil)

Optional. Service message: the group has been created

Source
group_chat_created?

Optional. Service message: the group has been created

Source
has_media_spoiler=(has_media_spoiler : Bool | Nil)

Optional. True, if the message media is covered by a spoiler animation

Source
has_media_spoiler?

Optional. True, if the message media is covered by a spoiler animation

Source
has_protected_content=(has_protected_content : Bool | Nil)

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

Source
has_protected_content?

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

Source
invoice

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

Source
invoice=(invoice : Tourmaline::Invoice | Nil)

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

Source
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

Source
is_automatic_forward?

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

Source
is_topic_message=(is_topic_message : Bool | Nil)

Optional. True, if the message is sent to a forum topic

Source
is_topic_message?

Optional. True, if the message is sent to a forum topic

Source
left_chat_member

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

Source
left_chat_member=(left_chat_member : Tourmaline::User | Nil)

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

Source
location

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

Source
location=(location : Tourmaline::Location | Nil)

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

Source
media_group_id

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

Source
media_group_id=(media_group_id : String | Nil)

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

Source
message_auto_delete_timer_changed

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

Source
message_auto_delete_timer_changed=(message_auto_delete_timer_changed : Tourmaline::MessageAutoDeleteTimerChanged | Nil)

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

Source
message_id

Unique message identifier inside this chat

Source
message_id=(message_id : Int32 | Int64)

Unique message identifier inside this chat

Source
message_thread_id

Optional. Unique identifier of a message thread to which the message belongs; for supergroups only

Source
message_thread_id=(message_thread_id : Int32 | Int64 | Nil)

Optional. Unique identifier of a message thread to which the message belongs; for supergroups only

Source
migrate_from_chat_id

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.

Source
migrate_from_chat_id=(migrate_from_chat_id : Int32 | Int64 | 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.

Source
migrate_to_chat_id

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.

Source
migrate_to_chat_id=(migrate_to_chat_id : Int32 | Int64 | 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.

Source
new_chat_members

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

Source
new_chat_members=(new_chat_members : Array(Tourmaline::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)

Source
new_chat_photo

Optional. A chat photo was change to this value

Source
new_chat_photo=(new_chat_photo : Array(Tourmaline::PhotoSize))

Optional. A chat photo was change to this value

Source
new_chat_title

Optional. A chat title was changed to this value

Source
new_chat_title=(new_chat_title : String | Nil)

Optional. A chat title was changed to this value

Source
passport_data

Optional. Telegram Passport data

Source
passport_data=(passport_data : Tourmaline::PassportData | Nil)

Optional. Telegram Passport data

Source
photo

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

Source
photo=(photo : Array(Tourmaline::PhotoSize))

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

Source
pinned_message

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.

Source
pinned_message=(pinned_message : Tourmaline::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.

Source
poll

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

Source
poll=(poll : Tourmaline::Poll | Nil)

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

Source
proximity_alert_triggered

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

Source
proximity_alert_triggered=(proximity_alert_triggered : Tourmaline::ProximityAlertTriggered | Nil)

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

Source
reply_markup

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

Source
reply_markup=(reply_markup : Tourmaline::InlineKeyboardMarkup | Nil)

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

Source
reply_to_message

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.

Source
reply_to_message=(reply_to_message : Tourmaline::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.

Source
sender_chat

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.

Source
sender_chat=(sender_chat : Tourmaline::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.

Source
sender_type
Source
sticker

Optional. Message is a sticker, information about the sticker

Source
sticker=(sticker : Tourmaline::Sticker | Nil)

Optional. Message is a sticker, information about the sticker

Source
successful_payment

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

Source
successful_payment=(successful_payment : Tourmaline::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

Source
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.

Source
supergroup_chat_created?

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.

Source
text

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

Source
text=(text : String | Nil)

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

Source
text_entities(type : String)
Source
text_entities
Source
user_shared

Optional. Service message: a user was shared with the bot

Source
user_shared=(user_shared : Tourmaline::UserShared | Nil)

Optional. Service message: a user was shared with the bot

Source
users
Source
users
Source
venue

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

Source
venue=(venue : Tourmaline::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

Source
via_bot

Optional. Bot through which the message was sent

Source
via_bot=(via_bot : Tourmaline::User | Nil)

Optional. Bot through which the message was sent

Source
video

Optional. Message is a video, information about the video

Source
video=(video : Tourmaline::Video | Nil)

Optional. Message is a video, information about the video

Source
video_chat_ended

Optional. Service message: video chat ended

Source
video_chat_ended=(video_chat_ended : Tourmaline::VideoChatEnded | Nil)

Optional. Service message: video chat ended

Source
video_chat_participants_invited

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

Source
video_chat_participants_invited=(video_chat_participants_invited : Tourmaline::VideoChatParticipantsInvited | Nil)

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

Source
video_chat_scheduled

Optional. Service message: video chat scheduled

Source
video_chat_scheduled=(video_chat_scheduled : Tourmaline::VideoChatScheduled | Nil)

Optional. Service message: video chat scheduled

Source
video_chat_started

Optional. Service message: video chat started

Source
video_chat_started=(video_chat_started : Tourmaline::VideoChatStarted | Nil)

Optional. Service message: video chat started

Source
video_note

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

Source
video_note=(video_note : Tourmaline::VideoNote | Nil)

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

Source
voice

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

Source
voice=(voice : Tourmaline::Voice | Nil)

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

Source
web_app_data

Optional. Service message: data sent by a Web App

Source
web_app_data=(web_app_data : Tourmaline::WebAppData | Nil)

Optional. Service message: data sent by a Web App

Source
write_access_allowed

Optional. Service message: the user allowed the bot added to the attachment menu to write messages

Source
write_access_allowed=(write_access_allowed : Tourmaline::WriteAccessAllowed | Nil)

Optional. Service message: the user allowed the bot added to the attachment menu to write messages

Source

Nested types