Message#
- class pyrogram.types.Message#
A message.
- Parameters:
id (
int
) – Unique message identifier inside this chat.from_user (
User
, optional) – Sender, empty for messages sent to channels.sender_chat (
Chat
, optional) – Sender of the message, sent on behalf of a chat. The channel itself for channel messages. The supergroup itself for messages from anonymous group administrators. The linked channel for messages automatically forwarded to the discussion group.date (
datetime
, optional) – Date the message was sent.chat (
Chat
, optional) – Conversation the message belongs to.forward_from (
User
, optional) – For forwarded messages, sender of the original message.forward_sender_name (
str
, optional) – For messages forwarded from users who have hidden their accounts, name of the user.forward_from_chat (
Chat
, optional) – For messages forwarded from channels, information about the original channel. For messages forwarded from anonymous group administrators, information about the original supergroup.forward_from_message_id (
int
, optional) – For messages forwarded from channels, identifier of the original message in the channel.forward_signature (
str
, optional) – For messages forwarded from channels, signature of the post author if present.forward_date (
datetime
, optional) – For forwarded messages, date the original message was sent.reply_to_message_id (
int
, optional) – The id of the message which this message directly replied to.reply_to_top_message_id (
int
, optional) – The id of the first message which started this message thread.reply_to_message (
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.mentioned (
bool
, optional) – The message contains a mention.empty (
bool
, optional) – The message is empty. A message can be empty in case it was deleted or you tried to retrieve a message that doesn’t exist yet.service (
MessageServiceType
, optional) – The message is a service message. This field will contain the enumeration type of the service message. You can useservice = getattr(message, message.service.value)
to access the service message.media (
MessageMediaType
, optional) – The message is a media message. This field will contain the enumeration type of the media message. You can usemedia = getattr(message, message.media.value)
to access the media message.edit_date (
datetime
, optional) – Date the message was last edited.media_group_id (
str
, optional) – The unique identifier of a media message group this message belongs to.author_signature (
str
, optional) – Signature of the post author for messages in channels, or the custom title of an anonymous group administrator.has_protected_content (
bool
, optional) – True, if the message can’t be forwarded.has_media_spoiler (
bool
, optional) – True, if the message media is covered by a spoiler animation.text (
str
, optional) – For text messages, the actual UTF-8 text of the message, 0-4096 characters. If the message contains entities (bold, italic, …) you can access text.markdown or text.html to get the marked up message text. In case there is no entity, the fields will contain the same text as text.entities (List of
MessageEntity
, optional) – For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text.caption_entities (List of
MessageEntity
, optional) – For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption.audio (
Audio
, optional) – Message is an audio file, information about the file.document (
Document
, optional) – Message is a general file, information about the file.photo (
Photo
, optional) – Message is a photo, information about the photo.sticker (
Sticker
, optional) – Message is a sticker, information about the sticker.animation (
Animation
, optional) – Message is an animation, information about the animation.game (
Game
, optional) – Message is a game, information about the game.video (
Video
, optional) – Message is a video, information about the video.voice (
Voice
, optional) – Message is a voice message, information about the file.video_note (
VideoNote
, optional) – Message is a video note, information about the video message.caption (
str
, optional) – Caption for the audio, document, photo, video or voice, 0-1024 characters. If the message contains caption entities (bold, italic, …) you can access caption.markdown or caption.html to get the marked up caption text. In case there is no caption entity, the fields will contain the same text as caption.contact (
Contact
, optional) – Message is a shared contact, information about the contact.location (
Location
, optional) – Message is a shared location, information about the location.venue (
Venue
, optional) – Message is a venue, information about the venue.web_page (
WebPage
, optional) – Message was sent with a webpage preview.poll (
Poll
, optional) – Message is a native poll, information about the poll.dice (
Dice
, optional) – A dice containing a value that is randomly generated by Telegram.new_chat_members (List of
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).left_chat_member (
User
, optional) – A member was removed from the group, information about them (this member may be the bot itself).new_chat_title (
str
, optional) – A chat title was changed to this value.new_chat_photo (
Photo
, optional) – A chat photo was change to this value.delete_chat_photo (
bool
, optional) – Service message: the chat photo was deleted.group_chat_created (
bool
, optional) – Service message: the group has been created.supergroup_chat_created (
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.channel_chat_created (
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.migrate_to_chat_id (
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.migrate_from_chat_id (
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.pinned_message (
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.game_high_score (
GameHighScore
, optional) – The game score for a user. The reply_to_message field will contain the game Message.views (
int
, optional) – Channel post views.forwards (
int
, optional) – Channel post forwards.via_bot (
User
) – The information of the bot that generated the message from an inline query of a user.outgoing (
bool
, optional) – Whether the message is incoming or outgoing. Messages received from other chats are incoming (outgoing is False). Messages sent from yourself to other chats are outgoing (outgoing is True). An exception is made for your own personal chat; messages sent there will be incoming.matches (List of regex Matches, *optional*) – A list containing all Match Objects that match the text of this message. Only applicable when using
Filters.regex
.command (List of
str
, optional) – A list containing the command and its arguments, if any. E.g.: “/start 1 2 3” would produce [“start”, “1”, “2”, “3”]. Only applicable when usingcommand
.video_chat_scheduled (
VideoChatScheduled
, optional) – Service message: voice chat scheduled.video_chat_started (
VideoChatStarted
, optional) – Service message: the voice chat started.video_chat_ended (
VideoChatEnded
, optional) – Service message: the voice chat has ended.video_chat_members_invited (
VoiceChatParticipantsInvited
, optional) – Service message: new members were invited to the voice chat.web_app_data (
WebAppData
, optional) – Service message: web app data sent to the bot.reply_markup (
InlineKeyboardMarkup
|ReplyKeyboardMarkup
|ReplyKeyboardRemove
|ForceReply
, optional) – Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.reactions (List of
Reaction
) – List of the reactions to this message.link (
str
, property) – Generate a link to this message, only for groups and channels.