Message class

This object represents a message.

Implemented types
Available extensions

Constructors

Message({User? from, Chat? senderChat, Message? replyToMessage, User? viaBot, int? editDate, String? mediaGroupId, String? authorSignature, String? text, List<MessageEntity>? entities, Animation? animation, Audio? audio, Document? document, List<PhotoSize>? photo, Sticker? sticker, Video? video, VideoNote? videoNote, Voice? voice, String? caption, List<MessageEntity>? captionEntities, Contact? contact, Dice? dice, Game? game, Poll? poll, Venue? venue, Location? location, List<User>? newChatMembers, User? leftChatMember, String? newChatTitle, List<PhotoSize>? newChatPhoto, bool? deleteChatPhoto, bool? groupChatCreated, bool? supergroupChatCreated, bool? channelChatCreated, MessageAutoDeleteTimerChanged? messageAutoDeleteTimerChanged, int? migrateToChatId, int? migrateFromChatId, Message? pinnedMessage, Invoice? invoice, SuccessfulPayment? successfulPayment, String? connectedWebsite, PassportData? passportData, ProximityAlertTriggered? proximityAlertTriggered, ForumTopicCreated? forumTopicCreated, ForumTopicClosed? forumTopicClosed, ForumTopicReopened? forumTopicReopened, VideoChatScheduled? videoChatScheduled, VideoChatStarted? videoChatStarted, VideoChatEnded? videoChatEnded, VideoChatParticipantsInvited? videoChatParticipantsInvited, WebAppData? webAppData, InlineKeyboardMarkup? replyMarkup, bool? hasProtectedContent, bool? isAutomaticForward, bool? isTopicMessage, int? messageThreadId, UsersShared? usersShared, ChatShared? chatShared, bool? hasMediaSpoiler, ForumTopicEdited? forumTopicEdited, GeneralForumTopicHidden? generalForumTopicHidden, GeneralForumTopicUnhidden? generalForumTopicUnhidden, WriteAccessAllowed? writeAccessAllowed, Story? story, ExternalReplyInfo? externalReply, TextQuote? quote, LinkPreviewOptions? linkPreviewOptions, Giveaway? giveaway, GiveawayCreated? giveawayCreated, GiveawayWinners? giveawayWinners, GiveawayCompleted? giveawayCompleted, MessageOrigin? forwardOrigin, required Chat chat, required int date, required int messageId, ChatBoostAdded? boostAdded, int? senderBoostCount, Story? replyToStory, String? businessConnectionId, User? senderBusinessBot, bool? isFromOffline, ChatBackground? chatBackgroundSet, String? effectId, bool? showCaptionAboveMedia, PaidMediaInfo? paidMedia, RefundedPayment? refundedPayment})
Creates a Message object.
const
Message.fromJson(Map<String, dynamic> json)
Creates a Message object from json map.
factory

Properties

animation 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
final
audio Audio?
Optional. Message is an audio file, information about the file
final
authorSignature String?
Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator
final
boostAdded ChatBoostAdded?
Optional. Service message: user boosted the chat
final
businessConnectionId String?
Optional. Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier.
final
caption String?
Optional. Caption for the animation, audio, document, photo, video or voice
final
captionEntities List<MessageEntity>?
Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
final
channelChatCreated bool?
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.
final
chat Chat
Chat the message belonged to
final
chatBackgroundSet ChatBackground?
Optional. Service message: chat background set
final
chatShared ChatShared?
Optional. Service message: a chat was shared with the bot
final
connectedWebsite String?
Optional. The domain name of the website on which the user has logged in. More about Telegram Login »
final
contact Contact?
Optional. Message is a shared contact, information about the contact
final
date int
Date the message was sent in Unix time. It is always a positive number, representing a valid date.
final
deleteChatPhoto bool?
Optional. Service message: the chat photo was deleted
final
dice Dice?
Optional. Message is a dice with random value
final
document Document?
Optional. Message is a general file, information about the file
final
editDate int?
Optional. Date the message was last edited in Unix time
final
effectId String?
Optional. Unique identifier of the message effect added to the message
final
entities List<MessageEntity>?
Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
final
externalReply ExternalReplyInfo?
Optional. Information about the message that is being replied to, which may come from another chat or forum topic
final
forumTopicClosed ForumTopicClosed?
Optional. Service message: forum topic closed
final
forumTopicCreated ForumTopicCreated?
Optional. Service message: forum topic created
final
forumTopicEdited ForumTopicEdited?
Optional. Service message: forum topic edited
final
forumTopicReopened ForumTopicReopened?
Optional. Service message: forum topic reopened
final
forwardOrigin MessageOrigin?
Optional. Information about the original message for forwarded messages
final
from User?
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.
final
game Game?
Optional. Message is a game, information about the game. More about games »
final
generalForumTopicHidden GeneralForumTopicHidden?
Optional. Service message: the 'General' forum topic hidden
final
generalForumTopicUnhidden GeneralForumTopicUnhidden?
Optional. Service message: the 'General' forum topic unhidden
final
giveaway Giveaway?
Optional. The message is a scheduled giveaway message
final
giveawayCompleted GiveawayCompleted?
Optional. Service message: a giveaway without public winners was completed
final
giveawayCreated GiveawayCreated?
Optional. Service message: a scheduled giveaway was created
final
giveawayWinners GiveawayWinners?
Optional. A giveaway with public winners was completed
final
groupChatCreated bool?
Optional. Service message: the group has been created
final
hashCode int
The hash code for this object.
no setterinherited
hasMediaSpoiler bool?
Optional. True, if the message media is covered by a spoiler animation
final
hasProtectedContent bool?
Optional. True, if the message can't be forwarded
final
invoice Invoice?
Optional. Message is an invoice for a payment, information about the invoice. More about payments »
final
isAccessible bool
Returns true if this message is accessible.
no setteroverride
isAutomaticForward bool?
Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group
final
isFromOffline bool?
Optional. True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message
final
isInaccessible bool
Returns true if this message is inaccessible.
no setteroverride
isTopicMessage bool?
Optional. True, if the message is sent to a forum topic
final
leftChatMember User?
Optional. A member was removed from the group, information about them (this member may be the bot itself)
final
linkPreviewOptions LinkPreviewOptions?
Optional. Options used for link preview generation for the message, if it is a text message and link preview options were changed
final
location Location?
Optional. Message is a shared location, information about the location
final
mediaGroupId String?
Optional. The unique identifier of a media message group this message belongs to
final
messageAutoDeleteTimerChanged MessageAutoDeleteTimerChanged?
Optional. Service message: auto-delete timer settings changed in the chat
final
messageId int
Unique message identifier inside the chat
final
messageThreadId int?
Optional. Unique identifier of a message thread to which the message belongs; for supergroups only
final
migrateFromChatId int?
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.
final
migrateToChatId int?
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.
final
newChatMembers List<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)
final
newChatPhoto List<PhotoSize>?
Optional. A chat photo was change to this value
final
newChatTitle String?
Optional. A chat title was changed to this value
final
paidMedia PaidMediaInfo?
Optional. Message contains paid media; information about the paid media
final
passportData PassportData?
Optional. Telegram Passport data
final
photo List<PhotoSize>?
Optional. Message is a photo, available sizes of the photo
final
pinnedMessage 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.
final
poll Poll?
Optional. Message is a native poll, information about the poll
final
proximityAlertTriggered ProximityAlertTriggered?
Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location.
final
quote TextQuote?
Optional. For replies that quote part of the original message, the quoted part of the message
final
refundedPayment RefundedPayment?
Optional. Message is a service message about a refunded payment, information about the payment. More about payments »
final
replyMarkup InlineKeyboardMarkup?
Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.
final
replyToMessage 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.
final
replyToStory Story?
Optional. For replies to a story, the original story
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
senderBoostCount int?
Optional. If the sender of the message boosted the chat, the number of boosts added by the user
final
senderBusinessBot User?
Optional. The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account.
final
senderChat 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.
final
showCaptionAboveMedia bool?
Optional. True, if the caption must be shown above the message media
final
sticker Sticker?
Optional. Message is a sticker, information about the sticker
final
story Story?
Optional. Message is a forwarded story
final
successfulPayment SuccessfulPayment?
Optional. Message is a service message about a successful payment, information about the payment. More about payments »
final
supergroupChatCreated bool?
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.
final
text String?
Optional. For text messages, the actual UTF-8 text of the message
final
usersShared UsersShared?
Optional. Service message: a user was shared with the bot
final
venue 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
final
viaBot User?
Optional. Bot through which the message was sent
final
video Video?
Optional. Message is a video, information about the video
final
videoChatEnded VideoChatEnded?
Optional. Service message: video chat ended
final
videoChatParticipantsInvited VideoChatParticipantsInvited?
Optional. Service message: new participants invited to a video chat
final
videoChatScheduled VideoChatScheduled?
Optional. Service message: video chat scheduled
final
videoChatStarted VideoChatStarted?
Optional. Service message: video chat started
final
videoNote VideoNote?
Optional. Message is a video note, information about the video message
final
voice Voice?
Optional. Message is a voice message, information about the file
final
webAppData WebAppData?
Optional. Service message: data sent by a Web App
final
writeAccessAllowed WriteAccessAllowed?
Optional. Service message: the user allowed the bot added to the attachment menu to write messages
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Returns the JSON representation of the Message object.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited