Message

class pyrogram.Message

A message.

Parameters
  • message_id (int) – Unique message identifier inside this chat.

  • date (int, optional) – Date the message was sent in Unix time.

  • chat (Chat, optional) – Conversation the message belongs to.

  • from_user (User, optional) – Sender, empty for messages sent to channels.

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

  • 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 (int, optional) – For forwarded messages, date the original message was sent in Unix time.

  • 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 (bool, optional) – The message is a service message. A service message has one and only one of these fields set: left_chat_member, new_chat_title, new_chat_photo, delete_chat_photo, group_chat_created, supergroup_chat_created, channel_chat_created, migrate_to_chat_id, migrate_from_chat_id, pinned_message.

  • media (bool, optional) – The message is a media message. A media message has one and only one of these fields set: audio, document, photo, sticker, video, animation, voice, video_note, contact, location, venue.

  • edit_date (int, optional) – Date the message was last edited in Unix time.

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

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

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

  • 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 using Filters.command.

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