Message¶
Description¶
This object represents a message.
Attributes¶
Name | Type | Description |
---|---|---|
message_id |
int |
Unique message identifier inside this chat |
date |
datetime.datetime |
Date the message was sent in Unix time |
chat |
Chat |
Conversation the message belongs to |
from_user |
Optional[User] |
Optional. Sender, empty for messages sent to channels |
forward_from |
Optional[User] |
Optional. For forwarded messages, sender of the original message |
forward_from_chat |
Optional[Chat] |
Optional. For messages forwarded from channels, information about the original channel |
forward_from_message_id |
Optional[int] |
Optional. For messages forwarded from channels, identifier of the original message in the channel |
forward_signature |
Optional[str] |
Optional. For messages forwarded from channels, signature of the post author if present |
forward_sender_name |
Optional[str] |
Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages |
forward_date |
Optional[int] |
Optional. For forwarded messages, date the original message was sent in Unix time |
reply_to_message |
Optional[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. |
edit_date |
Optional[int] |
Optional. Date the message was last edited in Unix time |
media_group_id |
Optional[str] |
Optional. The unique identifier of a media message group this message belongs to |
author_signature |
Optional[str] |
Optional. Signature of the post author for messages in channels |
text |
Optional[str] |
Optional. For text messages, the actual UTF-8 text of the message, 0-4096 characters |
entities |
Optional[List[MessageEntity]] |
Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text |
caption_entities |
Optional[List[MessageEntity]] |
Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption |
audio |
Optional[Audio] |
Optional. Message is an audio file, information about the file |
document |
Optional[Document] |
Optional. Message is a general file, information about the file |
animation |
Optional[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 |
game |
Optional[Game] |
Optional. Message is a game, information about the game. |
photo |
Optional[List[PhotoSize]] |
Optional. Message is a photo, available sizes of the photo |
sticker |
Optional[Sticker] |
Optional. Message is a sticker, information about the sticker |
video |
Optional[Video] |
Optional. Message is a video, information about the video |
voice |
Optional[Voice] |
Optional. Message is a voice message, information about the file |
video_note |
Optional[VideoNote] |
Optional. Message is a video note, information about the video message |
caption |
Optional[str] |
Optional. Caption for the animation, audio, document, photo, video or voice, 0-1024 characters |
contact |
Optional[Contact] |
Optional. Message is a shared contact, information about the contact |
location |
Optional[Location] |
Optional. Message is a shared location, information about the location |
venue |
Optional[Venue] |
Optional. Message is a venue, information about the venue |
poll |
Optional[Poll] |
Optional. Message is a native poll, information about the poll |
dice |
Optional[Dice] |
Optional. Message is a dice with random value from 1 to 6 |
new_chat_members |
Optional[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) |
left_chat_member |
Optional[User] |
Optional. A member was removed from the group, information about them (this member may be the bot itself) |
new_chat_title |
Optional[str] |
Optional. A chat title was changed to this value |
new_chat_photo |
Optional[List[PhotoSize]] |
Optional. A chat photo was change to this value |
delete_chat_photo |
Optional[bool] |
Optional. Service message: the chat photo was deleted |
group_chat_created |
Optional[bool] |
Optional. Service message: the group has been created |
supergroup_chat_created |
Optional[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 |
Optional[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 |
Optional[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 |
Optional[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 |
Optional[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. |
invoice |
Optional[Invoice] |
Optional. Message is an invoice for a payment, information about the invoice. |
successful_payment |
Optional[SuccessfulPayment] |
Optional. Message is a service message about a successful payment, information about the payment. |
connected_website |
Optional[str] |
Optional. The domain name of the website on which the user has logged in. |
passport_data |
Optional[PassportData] |
Optional. Telegram Passport data |
reply_markup |
Optional[InlineKeyboardMarkup] |
Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. |
Location¶
from aiogram.types import Message
from aiogram.api.types import Message
from aiogram.api.types.message import Message
Aliases¶
Instance of message has many contextual aliases for API methods and with the similar specification. Aliases is always returns related API method (Awaitable) and can be used directly or as answer's into webhook.
Reply & Answer¶
This methods has the same specification with the API but without chat_id
and reply_to_message_id
arguments.
Reply method | Answer method | Alias for | Description |
---|---|---|---|
reply |
answer |
Bot.send_message | Reply or Answer with text |
reply_sticker |
answer_sticker |
Bot.send_sticker | Reply or Answer with sticker |
reply_photo |
answer_photo |
Bot.send_photo | Reply or Answer with photo |
reply_document |
answer_document |
Bot.send_document | Reply or Answer with document |
reply_audio |
answer_audio |
Bot.send_audio | Reply or Answer with audio |
reply_video |
answer_video |
Bot.send_video | Reply or Answer with video |
reply_animation |
answer_animation |
Bot.send_animation | Reply or Answer with animation |
reply_media_group |
answer_media_group |
Bot.send_media_group | Reply or Answer with media_group |
reply_location |
answer_location |
Bot.send_location | Reply or Answer with location |
reply_contact |
answer_contact |
Bot.send_contact | Reply or Answer with contact |
reply_game |
answer_game |
Bot.send_game | Reply or Answer with game |
reply_voice |
answer_voice |
Bot.send_voice | Reply or Answer with voice |
reply_video_note |
answer_video_note |
Bot.send_video_note | Reply or Answer with video_note |
reply_venue |
answer_venue |
Bot.send_venue | Reply or Answer with venue |
reply_poll |
answer_poll |
Bot.send_poll | Reply or Answer with poll |
reply_dice |
answer_dice |
Bot.send_dice | Reply or Answer with dice |
reply_invoice |
answer_invoice |
Bot.send_invoice | Reply or Answer with invoice |
Related pages:¶
- Official documentation
- aiogram.types.Animation
- aiogram.types.Audio
- aiogram.types.Chat
- aiogram.types.Contact
- aiogram.types.Dice
- aiogram.types.Document
- aiogram.types.Game
- aiogram.types.InlineKeyboardMarkup
- aiogram.types.Invoice
- aiogram.types.Location
- aiogram.types.MessageEntity
- aiogram.types.PassportData
- aiogram.types.PhotoSize
- aiogram.types.Poll
- aiogram.types.Sticker
- aiogram.types.SuccessfulPayment
- aiogram.types.User
- aiogram.types.Venue
- aiogram.types.Video
- aiogram.types.VideoNote
- aiogram.types.Voice