Message class

This object represents a message.

https://core.telegram.org/bots/api#message

Available extensions
Annotations
  • @JsonSerializable.new(includeIfNull: false)

Constructors

Message({int? messageID, int? messageThreadID, bool? isTopicMessage, User? from, DateTime? date, Chat? chat, User? forwardFrom, Chat? forwardFromChat, int? forwardFromMessageID, String? forwardSignature, String? forwardSenderName, DateTime? forwardDate, Message? replyToMessage, TextQuote? quote, LinkPreviewOptions? linkPreviewOptions, DateTime? editDate, String? mediaGroupID, String? authorSignature, String? text, List<MessageEntity>? entities, List<MessageEntity>? captionEntities, Audio? audio, Document? document, Animation? animation, Game? game, List<PhotoSize>? photo, Sticker? sticker, Video? video, Voice? voice, VideoNote? videoNote, String? caption, Contact? contact, Location? location, Venue? venue, Poll? poll, List<User>? newChatMembers, User? leftChatMember, String? newChatTitle, List<PhotoSize>? newChatPhoto, bool? deleteChatPhoto, bool? groupChatCreated, bool? supergroupChatCreated, bool? channelChatCreated, int? migrateToChatID, int? migrateFromChatID, Message? pinnedMessage, Invoice? invoice, SuccessfulPayment? successfulPayment, String? connectedWebsite, PassportData? passportData, InlineKeyboardMarkup? replyMarkup})
Message.fromJson(Map<String, dynamic> json)
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.
getter/setter pair
audio ↔ Audio?
Optional. Message is an audio file, information about the file.
getter/setter pair
authorSignature ↔ String?
Optional. Signature of the post author for messages in channels.
getter/setter pair
caption ↔ String?
Optional. Caption for the animation, audio, document, photo, video or voice, 0-1024 characters.
getter/setter pair
captionEntities ↔ List<MessageEntity>?
Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
getter/setter pair
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.
getter/setter pair
chat ↔ Chat?
Conversation the message belongs to.
getter/setter pair
connectedWebsite ↔ String?
Optional. The domain name of the website on which the user has logged in. More about Telegram Login »
getter/setter pair
contact ↔ Contact?
Optional. Message is a shared contact, information about the contact.
getter/setter pair
date ↔ DateTime?
Date the message was sent in Unix time.
getter/setter pair
deleteChatPhoto ↔ bool?
Optional. Service message: the chat photo was deleted.
getter/setter pair
dice ↔ Dice?
Optional. Message is a dice with random value from 1 to 6.
getter/setter pair
document ↔ Document?
Optional. Message is a general file, information about the file.
getter/setter pair
editDate ↔ DateTime?
Optional. Date the message was last edited in Unix time.
getter/setter pair
entities ↔ List<MessageEntity>?
Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
getter/setter pair
forwardDate ↔ DateTime?
Optional. For forwarded messages, date the original message was sent in Unix time.
getter/setter pair
forwardFrom ↔ User?
Optional. For forwarded messages, sender of the original message.
getter/setter pair
forwardFromChat ↔ Chat?
Optional. For messages forwarded from channels, information about the original channel.
getter/setter pair
forwardFromMessageID ↔ int?
Optional. For messages forwarded from channels, identifier of the original message in the channel.
getter/setter pair
forwardSenderName ↔ String?
Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages.
getter/setter pair
forwardSignature ↔ String?
Optional. For messages forwarded from channels, signature of the post author if present.
getter/setter pair
from ↔ User?
Optional. Sender, empty for messages sent to channels.
getter/setter pair
game ↔ Game?
Optional. Message is a game, information about the game. More about games »
getter/setter pair
groupChatCreated ↔ bool?
Optional. Service message: the group has been created.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
invoice ↔ Invoice?
Optional. Message is an invoice for a payment, information about the invoice. More about payments »
getter/setter pair
isTopicMessage ↔ bool?
Optional. Whether the message is sent to a forum topic.
getter/setter pair
leftChatMember ↔ User?
Optional. A member was removed from the group, information about them (this member may be the bot itself).
getter/setter pair
linkPreviewOptions ↔ LinkPreviewOptions?
Optional. Options used for link preview generation for the message, if it is a text message and link preview options were specified.
getter/setter pair
location ↔ Location?
Optional. Message is a shared location, information about the location.
getter/setter pair
mediaGroupID ↔ String?
Optional. The unique identifier of a media message group this message belongs to.
getter/setter pair
messageID ↔ int?
Unique message identifier inside this chat.
getter/setter pair
messageThreadID ↔ int?
Optional. Unique identifier of a message thread to which the message belongs; for supergroups only.
getter/setter pair
migrateFromChatID ↔ int?
Optional. The supergroup has been migrated from a group with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
getter/setter pair
migrateToChatID ↔ int?
Optional. The group has been migrated to a supergroup with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
getter/setter pair
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).
getter/setter pair
newChatPhoto ↔ List<PhotoSize>?
Optional. A chat photo was change to this value.
getter/setter pair
newChatTitle ↔ String?
Optional. A chat title was changed to this value.
getter/setter pair
passportData ↔ PassportData?
Optional. Telegram Passport data.
getter/setter pair
photo ↔ List<PhotoSize>?
Optional. Message is a photo, available sizes of the photo.
getter/setter pair
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.
getter/setter pair
poll ↔ Poll?
Optional. Message is a native poll, information about the poll.
getter/setter pair
quote ↔ TextQuote?
Optional. For replies that quote part of the original message, information about the quoted part of the message.
getter/setter pair
replyMarkup ↔ InlineKeyboardMarkup?
Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.
getter/setter pair
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.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sticker ↔ Sticker?
Optional. Message is a sticker, information about the sticker.
getter/setter pair
successfulPayment ↔ SuccessfulPayment?
Optional. Message is a service message about a successful payment, information about the payment. More about payments »
getter/setter pair
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.
getter/setter pair
text ↔ String?
Optional. For text messages, the actual UTF-8 text of the message, 0-4096 characters.
getter/setter pair
venue ↔ Venue?
Optional. Message is a venue, information about the venue.
getter/setter pair
video ↔ Video?
Optional. Message is a video, information about the video.
getter/setter pair
videoNote ↔ VideoNote?
Optional. Message is a video note, information about the video message.
getter/setter pair
voice ↔ Voice?
Optional. Message is a voice message, information about the file.
getter/setter pair

Methods

copy({required ChatID toChatID, int? messageThreadID, String? caption, ParseMode? parseMode, List<MessageEntity>? captionEntities, bool? showCaptionAboveMedia, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, int? replyToMessageID, bool? allowSendingWithoutReply, ReplyMarkup? replyMarkup}) → Future<MessageId>

Available on Message, provided by the MessageHelper extension

Copies the current message to a target chat.
delete() → Future<bool>

Available on Message, provided by the MessageHelper extension

Deletes the current message.
entityIndex(MessageEntityType type) → int

Available on Message, provided by the MessageEntityHelper extension

It returns the entity index given a type.
forward({required ChatID toChatID, int? messageThreadID, bool? disableNotification, bool? protectContent}) → Future<Message>

Available on Message, provided by the MessageHelper extension

Forwards the current message to a target chat.
getEntitiesByType(MessageEntityType type) → List<MessageEntity>

Available on Message, provided by the MessageEntityHelper extension

It returns the entities list of a type.
getEntityText(MessageEntityType type) → String?

Available on Message, provided by the MessageEntityHelper extension

It returns the text of a given message entity.
getMessageEntity(MessageEntityType type) → MessageEntity?

Available on Message, provided by the MessageEntityHelper extension

It returns the message entity.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
replyAnimation({required Luggage animation, bool quoteMessage = true, Duration? duration, int? width, int? height, Luggage? thumb, String? caption, ParseMode? parseMode, bool? disableNotification, ReplyMarkup? replyMarkup}) → Future<Message>

Available on Message, provided by the MessageHelper extension

Helps replying with an animation directly.
replyAudio({required Luggage audio, bool quoteMessage = true, String? caption, ParseMode? parseMode, Duration? duration, String? performer, String? title, Luggage? thumb, bool? disableNotification, ReplyMarkup? replyMarkup}) → Future<Message>

Available on Message, provided by the MessageHelper extension

Helps replying with an audio directly.
replyChatAction({required ChatAction action}) → Future<bool>

Available on Message, provided by the MessageHelper extension

Helps replying with a chat action directly.
replyContact({required String phoneNumber, required String firstName, bool quoteMessage = true, String? lastName, String? vcard, bool? disableNotification, ReplyMarkup? replyMarkup}) → Future<Message>

Available on Message, provided by the MessageHelper extension

Helps replying with a contact directly.
replyDice({DiceType? emoji, bool quoteMessage = true, bool? disableNotification, ReplyMarkup? replyMarkup}) → Future<Message>

Available on Message, provided by the MessageHelper extension

Helps replying with a dice directly.
replyDocument({required Luggage document, bool quoteMessage = true, Luggage? thumb, String? caption, ParseMode? parseMode, bool? disableNotification, ReplyMarkup? replyMarkup}) → Future<Message>

Available on Message, provided by the MessageHelper extension

Helps replying a document directly.
replyLocation({required double latitude, required double longitude, bool quoteMessage = true, int? livePeriod, bool? disableNotification, ReplyMarkup? replyMarkup}) → Future<Message>

Available on Message, provided by the MessageHelper extension

Helps replying with a location directly.
replyMediaGroup({required List<InputMediaLuggage> media, bool quoteMessage = true, bool? disableNotification}) → Future<List<Message>>

Available on Message, provided by the MessageHelper extension

Helps replying with a media group directly.
replyPhoto({required Luggage photo, bool quoteMessage = true, String? caption, ParseMode? parseMode, bool? disableNotification, ReplyMarkup? replyMarkup}) → Future<Message>

Available on Message, provided by the MessageHelper extension

Helps replying with a photo directly.
replyPoll({required String question, required List<String> options, bool quoteMessage = true, bool? isAnonymous, PollType? type, bool? allowsMultipleAnswers, int? correctOptionId, String? explanation, ParseMode? explanationParseMode, Duration? openPeriod, DateTime? closeDate, bool? isClosed, bool? disableNotification, ReplyMarkup? replyMarkup}) → Future<Message>

Available on Message, provided by the MessageHelper extension

Helps replying with a poll directly.
replyText({required String text, bool quoteMessage = true, ParseMode? parseMode, bool? disableWebPagePreview, bool? disableNotification, ReplyMarkup? replyMarkup}) → Future<Message>

Available on Message, provided by the MessageHelper extension

Helps replying with a text directly.
replyVenue({required double latitude, required double longitude, required String title, required String address, bool quoteMessage = true, String? foursquareId, String? foursquareType, bool? disableNotification, ReplyMarkup? replyMarkup}) → Future<Message>

Available on Message, provided by the MessageHelper extension

Helps replying with a venue directly.
replyVideo({required Luggage video, bool quoteMessage = true, Duration? duration, int? width, int? height, Luggage? thumb, String? caption, ParseMode? parseMode, bool? supportsStreaming, bool? disableNotification, ReplyMarkup? replyMarkup}) → Future<Message>

Available on Message, provided by the MessageHelper extension

Helps replying with a video directly.
replyVideoNote({required Luggage videoNote, bool quoteMessage = true, Duration? duration, int? length, Luggage? thumb, bool? disableNotification, ReplyMarkup? replyMarkup}) → Future<Message>

Available on Message, provided by the MessageHelper extension

Helps replying with a video note directly.
replyVoice({required Luggage voice, bool quoteMessage = true, String? caption, ParseMode? parseMode, Duration? duration, bool? disableNotification, ReplyMarkup? replyMarkup}) → Future<Message>

Available on Message, provided by the MessageHelper extension

Helps replying with a voice directly.
toJson() → Map<String, dynamic>
toString() → String
A string representation of this object.
inherited

Operators

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