Message
- class pyrogram.types.Message
A message.
- Parameters:
id (
int
) – Unique message identifier inside this chat.message_thread_id (
int
, optional) – Unique identifier of a message thread to which the message belongs. for supergroups onlyfrom_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.sender_business_bot (
User
, optional) – Sender of the message, sent on behalf of a business bot.date (
datetime
, optional) – Date the message was sent.chat (
Chat
, optional) – Conversation the message belongs to.topic (
ForumTopic
, optional) – Topic the message belongs to. only returned using when client.get_messages.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.is_topic_message (
bool
, optional) – True, if the message is sent to a forum topicreply_to_chat_id (
int
, optional) – Unique identifier of the chat where the replied message belongs to.reply_to_message_id (
int
, optional) – The id of the message which this message directly replied to.reply_to_story_id (
int
, optional) – The id of the story which this message directly replied to.reply_to_story_user_id (
int
, optional) – The id of the story sender which this message directly replied to.reply_to_story_chat_id (
int
, optional) – The id of the chat where the story was sent 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.reply_to_story (
Story
, optional) – For replies, the original story.business_connection_id (
str
, optional) – The business connection identifier.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.edit_hide (
bool
, optional) – The message shown as not modified. A message can be not modified in case it has received a reaction.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.quote_text (
str
, optional) – Quoted reply text.quote_entities (List of
MessageEntity
, optional) – For quote text, special entities like usernames, URLs, bot commands, etc. that appear in the quote text.effect_id (
str
, optional) – Unique identifier of the message effect added to the message.invert_media (
bool
, optional) – True, If the media position is inverted. only animation, photo, video, and webpage preview messages.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.paid_media (
PaidMedia
, optional) – Message is a paid media, information about the paid media.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.giveaway (
Giveaway
, optional) – Message is a giveaway, information about the giveaway.giveaway_result (
GiveawayResult
, optional) – Message is a giveaway result, information about the giveaway result.invoice (
Invoice
, optional) – Message is an invoice for a payment, information about the invoice.story (
MessageStory
|Story
, optional) – Message is a forwarded story, information about the forwarded story.video (
Video
, optional) – Message is a video, information about the video.alternative_videos (List of
AlternativeVideo
, optional) – Alternative qualities of the video, if the message is a 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.web_page_preview (
WebPagePreview
, optional) – Message is a web page preview, information about the web page preview 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.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).chat_joined_by_request (
ChatJoinedByRequest
, optional) – New members chat join request has been approved in group or supergroup.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
.bot_allowed (
BotAllowed
, optional) – Contains information about a allowed bot.chats_shared (List of
RequestedChats
, optional) – Service message: chats sharedforum_topic_created (
ForumTopicCreated
, optional) – Service message: forum topic createdforum_topic_closed (
ForumTopicClosed
, optional) – Service message: forum topic closedforum_topic_reopened (
ForumTopicReopened
, optional) – Service message: forum topic reopenedforum_topic_edited (
ForumTopicEdited
, optional) – Service message: forum topic editedgeneral_topic_hidden (
GeneralTopicHidden
, optional) – Service message: forum general topic hiddengeneral_topic_unhidden (
GeneralTopicUnhidden
, optional) – Service message: forum general topic unhiddengifted_premium (
GiftedPremium
, optional) – Info about a gifted Telegram Premium subscriptiongiveaway_launcheded (
GiveawayLaunched
, optional) – Service message: giveaway launched.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.successful_payment (
SuccessfulPayment
, optional) – Service message: successful payment.payment_refunded (
PaymentRefunded
, optional) – Service message: payment refunded.boosts_applied (
int
, optional) – Service message: how many boosts were applied.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.raw (
pyrogram.raw.types.Message
, optional) – The raw message object, as received from the Telegram API.gift_code (
GiftCode
, optional) – Service message: gift code information. Contains a Telegram Premium giftcode link.contact_registered (
ContactRegistered
, optional) – A service message that a contact has registered with Telegram.chat_join_type (
ChatJoinType
, optional) – The message is a service message of the typeNEW_CHAT_MEMBERS
. This field will contain the enumeration type of how the user had joined the chat.screenshot_taken (
ScreenshotTaken
, optional) – A service message that a screenshot of a message in the chat has been taken.user_gift (
UserGift
, optional) – Service message: Represents a gift received by a user.star_gift (
StarGift
, optional) – Service message: star gift information.gifted_premium (
GiftedPremium
, optional) – Info about a gifted Telegram Premium subscriptionlink (
str
, property) – Generate a link to this message, only for groups and channels.scheduled (
bool
, optional) – Message is a scheduled message and still in schedule.from_scheduled (
bool
, optional) – Message is a scheduled message and has been sent.chat_join_type (
ChatJoinType
, optional) – The message is a service message of the typeNEW_CHAT_MEMBERS
. This field will contain the enumeration type of how the user had joined the chat.