peyk.platforms.telegram.types.message¶
Classes
|
This object represents a message. |
- class peyk.platforms.telegram.types.message.Message(message_id: int, date: int, chat: Chat, message_thread_id: int | None = None, from_: User | None = None, sender_chat: Chat | None = None, sender_boost_count: int | None = None, sender_business_bot: User | None = None, business_connection_id: str | None = None, forward_origin: object | None = None, is_topic_message: bool | None = None, is_automatic_forward: bool | None = None, reply_to_message: Message | None = None, external_reply: ExternalReplyInfo | None = None, quote: TextQuote | None = None, reply_to_story: object | None = None, via_bot: User | None = None, author_signature: str | None = None, text: str | None = None, entities: List[MessageEntity] | None = None, link_preview_options: object | None = None, effect_id: str | None = None, animation: Animation | None = None, audio: Audio | None = None, document: Document | None = None, paid_media: object | None = None, photo: List[PhotoSize] | None = None, sticker: object | None = None, story: object | None = None, video: Video | None = None, video_note: VideoNote | None = None, voice: Voice | None = None, live_photo: LivePhoto | None = None, caption: str | None = None, caption_entities: List[MessageEntity] | None = None, show_caption_above_media: bool | None = None, has_media_spoiler: bool | None = None, contact: Contact | None = None, dice: Dice | None = None, game: object | None = None, poll: Poll | None = None, venue: Venue | None = None, location: Location | None = None, new_chat_members: List[User] | None = None, left_chat_member: User | None = None, new_chat_title: str | None = None, new_chat_photo: object | None = None, delete_chat_photo: bool | None = None, group_chat_created: bool | None = None, supergroup_chat_created: bool | None = None, channel_chat_created: bool | None = None, message_auto_delete_timer_changed: object | None = None, migrate_to_chat_id: int | None = None, migrate_from_chat_id: int | None = None, pinned_message: Message | None = None, invoice: object | None = None, successful_payment: object | None = None, users_shared: object | None = None, chat_shared: object | None = None, connected_website: str | None = None, write_access_allowed: object | None = None, passport_data: object | None = None, proximity_alert_triggered: object | None = None, boost_added: object | None = None, chat_background_set: object | None = None, forum_topic_created: ForumTopicCreated | None = None, forum_topic_edited: ForumTopicEdited | None = None, forum_topic_closed: ForumTopicClosed | None = None, forum_topic_reopened: ForumTopicReopened | None = None, general_forum_topic_hidden: GeneralForumTopicHidden | None = None, general_forum_topic_unhidden: GeneralForumTopicUnhidden | None = None, giveaway_created: object | None = None, giveaway: object | None = None, giveaway_winners: object | None = None, giveaway_completed: object | None = None, paid_message_price_changed: object | None = None, video_chat_scheduled: object | None = None, video_chat_started: object | None = None, video_chat_ended: object | None = None, video_chat_participants_invited: object | None = None, web_app_data: object | None = None, reply_markup: InlineKeyboardMarkup | None = None)[source]¶
Bases:
objectThis object represents a message.
- Variables:
message_id (int) – Unique message identifier inside this chat; 0 for ephemeral messages. In specific instances (e.g., a message containing a video sent to a big chat), the server might automatically schedule a message instead of sending it immediately. In such cases, this field will be 0 and the relevant message will be unusable until it is actually sent.
date (int) – Date the message was sent in Unix time. It is always a positive number, representing a valid date.
chat (peyk.platforms.telegram.types.chat.Chat) – Chat the message belongs to
message_thread_id (int | None) – Unique identifier of a message thread or forum topic to which the message belongs; for supergroups and private chats only
direct_messages_topic – Information about the direct messages chat topic that contains the message
from – Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats.
sender_chat (peyk.platforms.telegram.types.chat.Chat | None) – Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel’s discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field from contains a fake sender user in non-channel chats.
sender_boost_count (int | None) – If the sender of the message boosted the chat, the number of boosts added by the user
sender_business_bot (peyk.platforms.telegram.types.user.User | None) – 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.
sender_tag – Tag or custom title of the sender of the message; for supergroups only
guest_query_id – The unique identifier for the guest query. Use this identifier with the method answerGuestQuery to send a response message. If non-empty, the message belongs to the chat where the guest bot was summoned, which may not coincide with other existing bot chats sharing the same identifier.
business_connection_id (str | None) – 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.
forward_origin (object | None) – Information about the original message for forwarded messages
is_topic_message (bool | None) – True, if the message is sent to a topic in a forum supergroup or a private chat with the bot
is_automatic_forward (bool | None) – True, if the message is a channel post that was automatically forwarded to the connected discussion group
reply_to_message (peyk.platforms.telegram.types.message.Message | None) – For replies in the same chat and message thread, 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. If the message is a reply to an ephemeral message, then this field may be omitted.
external_reply (peyk.platforms.telegram.types.external_reply_info.ExternalReplyInfo | None) – Information about the message that is being replied to, which may come from another chat or forum topic
quote (peyk.platforms.telegram.types.text_quote.TextQuote | None) – For replies that quote part of the original message, the quoted part of the message
reply_to_story (object | None) – For replies to a story, the original story
reply_to_checklist_task_id – Identifier of the specific checklist task that is being replied to
reply_to_poll_option_id – Persistent identifier of the specific poll option that is being replied to
via_bot (peyk.platforms.telegram.types.user.User | None) – Bot through which the message was sent
guest_bot_caller_user – For a message sent by a guest bot, this is the user whose original message triggered the bot’s response
guest_bot_caller_chat – For a message sent by a guest bot, this is the chat whose original message triggered the bot’s response
edit_date – Date the message was last edited in Unix time
has_protected_content – True, if the message can’t be forwarded
is_from_offline – 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
is_paid_post – True, if the message is a paid post. Note that such posts must not be deleted for 24 hours to receive the payment and can’t be edited.
media_group_id – The unique identifier inside this chat of a media message group this message belongs to
author_signature (str | None) – Signature of the post author for messages in channels, or the custom title of an anonymous group administrator
paid_star_count – The number of Telegram Stars that were paid by the sender of the message to send it
text (str | None) – For text messages, the actual UTF-8 text of the message
entities (List[peyk.platforms.telegram.types.message_entity.MessageEntity] | None) – For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
link_preview_options (object | None) – Options used for link preview generation for the message, if it is a text message and link preview options were changed
suggested_post_info – Information about suggested post parameters if the message is a suggested post in a channel direct messages chat. If the message is an approved or declined suggested post, then it can’t be edited.
effect_id (str | None) – Unique identifier of the message effect added to the message
animation (peyk.platforms.telegram.types.animation.Animation | None) – Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set.
audio (peyk.platforms.telegram.types.audio.Audio | None) – Message is an audio file, information about the file
document (peyk.platforms.telegram.types.document.Document | None) – Message is a general file, information about the file
live_photo (peyk.platforms.telegram.types.live_photo.LivePhoto | None) – Message is a live photo, information about the live photo. For backward compatibility, when this field is set, the photo field will also be set.
paid_media (object | None) – Message contains paid media; information about the paid media
photo (List[peyk.platforms.telegram.types.photo_size.PhotoSize] | None) – Message is a photo, available sizes of the photo
sticker (object | None) – Message is a sticker, information about the sticker
story (object | None) – Message is a forwarded story
video (peyk.platforms.telegram.types.video.Video | None) – Message is a video, information about the video
video_note (peyk.platforms.telegram.types.video_note.VideoNote | None) – Message is a video note, information about the video message
voice (peyk.platforms.telegram.types.voice.Voice | None) – Message is a voice message, information about the file
caption (str | None) – Caption for the animation, audio, document, paid media, photo, video or voice
caption_entities (List[peyk.platforms.telegram.types.message_entity.MessageEntity] | None) – For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
show_caption_above_media (bool | None) – True, if the caption must be shown above the message media
has_media_spoiler (bool | None) – True, if the message media is covered by a spoiler animation
checklist – Message is a checklist
contact (peyk.platforms.telegram.types.contact.Contact | None) – Message is a shared contact, information about the contact
dice (peyk.platforms.telegram.types.dice.Dice | None) – Message is a dice with random value
game (object | None) – Message is a game, information about the game.
poll (peyk.platforms.telegram.types.poll.Poll | None) – Message is a native poll, information about the poll
venue (peyk.platforms.telegram.types.venue.Venue | None) – Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set.
location (peyk.platforms.telegram.types.location.Location | None) – Message is a shared location, information about the location
new_chat_members (List[peyk.platforms.telegram.types.user.User] | None) – 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 (peyk.platforms.telegram.types.user.User | None) – A member was removed from the group, information about them (this member may be the bot itself)
chat_owner_left – Service message: chat owner has left
chat_owner_changed – Service message: chat owner has changed
new_chat_title (str | None) – A chat title was changed to this value
new_chat_photo (object | None) – A chat photo was change to this value
delete_chat_photo (bool | None) – Service message: the chat photo was deleted
group_chat_created (bool | None) – Service message: the group has been created
supergroup_chat_created (bool | None) – 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 | None) – 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.
message_auto_delete_timer_changed (object | None) – Service message: auto-delete timer settings changed in the chat
migrate_to_chat_id (int | None) – 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.
migrate_from_chat_id (int | None) – 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.
pinned_message (peyk.platforms.telegram.types.message.Message | None) – Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.
invoice (object | None) – Message is an invoice for a payment, information about the invoice.
successful_payment (object | None) – Message is a service message about a successful payment, information about the payment.
refunded_payment – Message is a service message about a refunded payment, information about the payment.
users_shared (object | None) – Service message: users were shared with the bot
chat_shared (object | None) – Service message: a chat was shared with the bot
gift – Service message: a regular gift was sent or received
unique_gift – Service message: a unique gift was sent or received
gift_upgrade_sent – Service message: upgrade of a gift was purchased after the gift was sent
connected_website (str | None) – The domain name of the website on which the user has logged in.
write_access_allowed (object | None) – Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess
passport_data (object | None) – Telegram Passport data
proximity_alert_triggered (object | None) – Service message. A user in the chat triggered another user’s proximity alert while sharing Live Location.
boost_added (object | None) – Service message: user boosted the chat
chat_background_set (object | None) – Service message: chat background set
checklist_tasks_done – Service message: some tasks in a checklist were marked as done or not done
checklist_tasks_added – Service message: tasks were added to a checklist
direct_message_price_changed – Service message: the price for paid messages in the corresponding direct messages chat of a channel has changed
forum_topic_created (peyk.platforms.telegram.types.forum_topic_created.ForumTopicCreated | None) – Service message: forum topic created
forum_topic_edited (peyk.platforms.telegram.types.forum_topic_edited.ForumTopicEdited | None) – Service message: forum topic edited
forum_topic_closed (peyk.platforms.telegram.types.forum_topic_closed.ForumTopicClosed | None) – Service message: forum topic closed
forum_topic_reopened (peyk.platforms.telegram.types.forum_topic_reopened.ForumTopicReopened | None) – Service message: forum topic reopened
general_forum_topic_hidden (peyk.platforms.telegram.types.general_forum_topic_hidden.GeneralForumTopicHidden | None) – Service message: the ‘General’ forum topic hidden
general_forum_topic_unhidden (peyk.platforms.telegram.types.general_forum_topic_unhidden.GeneralForumTopicUnhidden | None) – Service message: the ‘General’ forum topic unhidden
giveaway_created (object | None) – Service message: a scheduled giveaway was created
giveaway (object | None) – The message is a scheduled giveaway message
giveaway_winners (object | None) – A giveaway with public winners was completed
giveaway_completed (object | None) – Service message: a giveaway without public winners was completed
managed_bot_created – Service message: user created a bot that will be managed by the current bot
paid_message_price_changed (object | None) – Service message: the price for paid messages has changed in the chat
poll_option_added – Service message: answer option was added to a poll
poll_option_deleted – Service message: answer option was deleted from a poll
suggested_post_approved – Service message: a suggested post was approved
suggested_post_approval_failed – Service message: approval of a suggested post has failed
suggested_post_declined – Service message: a suggested post was declined
suggested_post_paid – Service message: payment for a suggested post was received
suggested_post_refunded – Service message: payment for a suggested post was refunded
video_chat_scheduled (object | None) – Service message: video chat scheduled
video_chat_started (object | None) – Service message: video chat started
video_chat_ended (object | None) – Service message: video chat ended
video_chat_participants_invited (object | None) – Service message: new participants invited to a video chat
web_app_data (object | None) – Service message: data sent by a Web App
reply_markup (peyk.platforms.telegram.types.inline_keyboard_markup.InlineKeyboardMarkup | None) – Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.
rich_message – Message is a rich formatted message
receiver_user – For ephemeral messages, the user who received the message
ephemeral_message_id – For ephemeral messages, identifier of the ephemeral message inside this chat. The identifier may be reused for another ephemeral message after the message is deleted or expires.
community_chat_added – Service message: chat added to a Community
community_chat_removed – Service message: chat removed from a Community
forward_date – For forwarded messages, date the original message was sent in Unix time
forward_from – For forwarded messages, sender of the original message
forward_from_chat – For messages forwarded from channels or from anonymous administrators, information about the original sender chat
forward_from_message_id – For messages forwarded from channels, identifier of the original message in the channel
forward_sender_name – Sender’s name for messages forwarded from users who disallow adding a link to their account in forwarded messages
forward_signature – For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present
user_shared – Service message: a user was shared with the bot
- message_id: int¶
- date: int¶
- message_thread_id: int | None = None¶
- sender_boost_count: int | None = None¶
- business_connection_id: str | None = None¶
- forward_origin: object | None = None¶
- is_topic_message: bool | None = None¶
- is_automatic_forward: bool | None = None¶
- external_reply: ExternalReplyInfo | None = None¶
- reply_to_story: object | None = None¶
- author_signature: str | None = None¶
- text: str | None = None¶
- entities: List[MessageEntity] | None = None¶
- link_preview_options: object | None = None¶
- effect_id: str | None = None¶
- paid_media: object | None = None¶
- sticker: object | None = None¶
- story: object | None = None¶
- caption: str | None = None¶
- caption_entities: List[MessageEntity] | None = None¶
- show_caption_above_media: bool | None = None¶
- has_media_spoiler: bool | None = None¶
- game: object | None = None¶
- new_chat_title: str | None = None¶
- new_chat_photo: object | None = None¶
- delete_chat_photo: bool | None = None¶
- group_chat_created: bool | None = None¶
- supergroup_chat_created: bool | None = None¶
- channel_chat_created: bool | None = None¶
- message_auto_delete_timer_changed: object | None = None¶
- migrate_to_chat_id: int | None = None¶
- migrate_from_chat_id: int | None = None¶
- invoice: object | None = None¶
- successful_payment: object | None = None¶
- connected_website: str | None = None¶
- write_access_allowed: object | None = None¶
- passport_data: object | None = None¶
- proximity_alert_triggered: object | None = None¶
- boost_added: object | None = None¶
- chat_background_set: object | None = None¶
- forum_topic_created: ForumTopicCreated | None = None¶
- forum_topic_edited: ForumTopicEdited | None = None¶
- forum_topic_closed: ForumTopicClosed | None = None¶
- forum_topic_reopened: ForumTopicReopened | None = None¶
- giveaway_created: object | None = None¶
- giveaway: object | None = None¶
- giveaway_winners: object | None = None¶
- giveaway_completed: object | None = None¶
- paid_message_price_changed: object | None = None¶
- video_chat_scheduled: object | None = None¶
- video_chat_started: object | None = None¶
- video_chat_ended: object | None = None¶
- video_chat_participants_invited: object | None = None¶
- web_app_data: object | None = None¶
- reply_markup: InlineKeyboardMarkup | None = None¶
- classmethod from_dict(data)¶
- classmethod list_from_result(data: List[dict] | None) List[Message][source]¶
Parse a Telegram API result list into this type.
- Parameters:
data – Raw result list, or
None.- Returns:
Parsed type instances.
- chat_boost = None¶
- chat_owner_changed = None¶
- chat_owner_left = None¶
- checklist = None¶
- community_chat_added = None¶
- community_chat_joined = None¶
- community_chat_removed = None¶
- direct_messages_topic = None¶
- edit_date = None¶
- ephemeral_message_id = None¶
- guest_bot_caller_chat = None¶
- guest_bot_caller_user = None¶
- guest_query_id = None¶
- has_protected_content = None¶
- is_from_offline = None¶
- is_paid_post = None¶
- media_group_id = None¶
- paid_star_count = None¶
- receiver_user = None¶
- refunded_payment = None¶
- removed_chat_boost = None¶
- rich_message = None¶
- sender_tag = None¶
- suggested_post_info = None¶