Message#

class aiogram.types.message.Message(*, message_id: int, date: datetime.datetime, chat: Chat, from_user: Optional[User] = None, sender_chat: Optional[Chat] = None, forward_from: Optional[User] = None, forward_from_chat: Optional[Chat] = None, forward_from_message_id: Optional[int] = None, forward_signature: Optional[str] = None, forward_sender_name: Optional[str] = None, forward_date: Optional[int] = None, is_automatic_forward: Optional[bool] = None, reply_to_message: Optional[Message] = None, via_bot: Optional[User] = None, edit_date: Optional[int] = None, has_protected_content: Optional[bool] = None, media_group_id: Optional[str] = None, author_signature: Optional[str] = None, text: Optional[str] = None, entities: Optional[List[MessageEntity]] = None, animation: Optional[Animation] = None, audio: Optional[Audio] = None, document: Optional[Document] = None, photo: Optional[List[PhotoSize]] = None, sticker: Optional[Sticker] = None, video: Optional[Video] = None, video_note: Optional[VideoNote] = None, voice: Optional[Voice] = None, caption: Optional[str] = None, caption_entities: Optional[List[MessageEntity]] = None, contact: Optional[Contact] = None, dice: Optional[Dice] = None, game: Optional[Game] = None, poll: Optional[Poll] = None, venue: Optional[Venue] = None, location: Optional[Location] = None, new_chat_members: Optional[List[User]] = None, left_chat_member: Optional[User] = None, new_chat_title: Optional[str] = None, new_chat_photo: Optional[List[PhotoSize]] = None, delete_chat_photo: Optional[bool] = None, group_chat_created: Optional[bool] = None, supergroup_chat_created: Optional[bool] = None, channel_chat_created: Optional[bool] = None, message_auto_delete_timer_changed: Optional[MessageAutoDeleteTimerChanged] = None, migrate_to_chat_id: Optional[int] = None, migrate_from_chat_id: Optional[int] = None, pinned_message: Optional[Message] = None, invoice: Optional[Invoice] = None, successful_payment: Optional[SuccessfulPayment] = None, connected_website: Optional[str] = None, passport_data: Optional[PassportData] = None, proximity_alert_triggered: Optional[ProximityAlertTriggered] = None, video_chat_scheduled: Optional[VideoChatScheduled] = None, video_chat_started: Optional[VideoChatStarted] = None, video_chat_ended: Optional[VideoChatEnded] = None, video_chat_participants_invited: Optional[VideoChatParticipantsInvited] = None, web_app_data: Optional[WebAppData] = None, reply_markup: Optional[InlineKeyboardMarkup] = None, **extra_data: Any)[source]#

This object represents a message.

Source: https://core.telegram.org/bots/api#message

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 of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.

sender_chat: Optional[Chat]#

Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.

forward_from: Optional[User]#

Optional. For forwarded messages, sender of the original message

forward_from_chat: Optional[Chat]#

Optional. For messages forwarded from channels or from anonymous administrators, information about the original sender chat

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 forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender 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

is_automatic_forward: Optional[bool]#

Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group

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.

via_bot: Optional[User]#

Optional. Bot through which the message was sent

edit_date: Optional[int]#

Optional. Date the message was last edited in Unix time

has_protected_content: Optional[bool]#

Optional. True, if the message can’t be forwarded

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, or the custom title of an anonymous group administrator

text: Optional[str]#

Optional. For text messages, the actual UTF-8 text of the message

entities: Optional[List[MessageEntity]]#

Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text

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

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

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

video_note: Optional[VideoNote]#

Optional. Message is a video note, information about the video message

voice: Optional[Voice]#

Optional. Message is a voice message, information about the file

caption: Optional[str]#

Optional. Caption for the animation, audio, document, photo, video or voice

caption_entities: Optional[List[MessageEntity]]#

Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption

contact: Optional[Contact]#

Optional. Message is a shared contact, information about the contact

dice: Optional[Dice]#

Optional. Message is a dice with random value

game: Optional[Game]#

Optional. Message is a game, information about the game. More about games »

poll: Optional[Poll]#

Optional. Message is a native poll, information about the poll

venue: Optional[Venue]#

Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set

location: Optional[Location]#

Optional. Message is a shared location, information about the location

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.

message_auto_delete_timer_changed: Optional[MessageAutoDeleteTimerChanged]#

Optional. Service message: auto-delete timer settings changed in the chat

migrate_to_chat_id: Optional[int]#

Optional. 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: Optional[int]#

Optional. 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: 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. More about payments »

successful_payment: Optional[SuccessfulPayment]#

Optional. Message is a service message about a successful payment, information about the payment. More about payments »

connected_website: Optional[str]#

Optional. The domain name of the website on which the user has logged in. More about Telegram Login »

passport_data: Optional[PassportData]#

Optional. Telegram Passport data

proximity_alert_triggered: Optional[ProximityAlertTriggered]#

Optional. Service message. A user in the chat triggered another user’s proximity alert while sharing Live Location.

video_chat_scheduled: Optional[VideoChatScheduled]#

Optional. Service message: video chat scheduled

video_chat_started: Optional[VideoChatStarted]#

Optional. Service message: video chat started

video_chat_ended: Optional[VideoChatEnded]#

Optional. Service message: video chat ended

video_chat_participants_invited: Optional[VideoChatParticipantsInvited]#

Optional. Service message: new participants invited to a video chat

web_app_data: Optional[WebAppData]#

Optional. Service message: data sent by a Web App

reply_markup: Optional[InlineKeyboardMarkup]#

Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.

property content_type: str#
property html_text: str#
property md_text: str#
reply_animation(animation: Union[InputFile, str], duration: Optional[int] = None, width: Optional[int] = None, height: Optional[int] = None, thumb: Optional[Union[InputFile, str]] = None, caption: Optional[str] = None, parse_mode: Optional[str] = sentinel.UNSET, disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendAnimation[source]#

Reply with animation

Parameters
  • animation

  • duration

  • width

  • height

  • thumb

  • caption

  • parse_mode

  • disable_notification

  • allow_sending_without_reply

  • reply_markup

Returns

answer_animation(animation: Union[InputFile, str], duration: Optional[int] = None, width: Optional[int] = None, height: Optional[int] = None, thumb: Optional[Union[InputFile, str]] = None, caption: Optional[str] = None, parse_mode: Optional[str] = sentinel.UNSET, disable_notification: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendAnimation[source]#

Answer with animation

Parameters
  • animation

  • duration

  • width

  • height

  • thumb

  • caption

  • parse_mode

  • disable_notification

  • reply_markup

Returns

reply_audio(audio: Union[InputFile, str], caption: Optional[str] = None, parse_mode: Optional[str] = sentinel.UNSET, duration: Optional[int] = None, performer: Optional[str] = None, title: Optional[str] = None, thumb: Optional[Union[InputFile, str]] = None, disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendAudio[source]#

Reply with audio

Parameters
  • audio

  • caption

  • parse_mode

  • duration

  • performer

  • title

  • thumb

  • disable_notification

  • allow_sending_without_reply

  • reply_markup

Returns

answer_audio(audio: Union[InputFile, str], caption: Optional[str] = None, parse_mode: Optional[str] = sentinel.UNSET, duration: Optional[int] = None, performer: Optional[str] = None, title: Optional[str] = None, thumb: Optional[Union[InputFile, str]] = None, disable_notification: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendAudio[source]#

Answer with audio

Parameters
  • audio

  • caption

  • parse_mode

  • duration

  • performer

  • title

  • thumb

  • disable_notification

  • reply_markup

Returns

reply_contact(phone_number: str, first_name: str, last_name: Optional[str] = None, vcard: Optional[str] = None, disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendContact[source]#

Reply with contact

Parameters
  • phone_number

  • first_name

  • last_name

  • vcard

  • disable_notification

  • allow_sending_without_reply

  • reply_markup

Returns

answer_contact(phone_number: str, first_name: str, last_name: Optional[str] = None, vcard: Optional[str] = None, disable_notification: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendContact[source]#

Answer with contact

Parameters
  • phone_number

  • first_name

  • last_name

  • vcard

  • disable_notification

  • reply_markup

Returns

reply_document(document: Union[InputFile, str], thumb: Optional[Union[InputFile, str]] = None, caption: Optional[str] = None, parse_mode: Optional[str] = sentinel.UNSET, disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendDocument[source]#

Reply with document

Parameters
  • document

  • thumb

  • caption

  • parse_mode

  • disable_notification

  • allow_sending_without_reply

  • reply_markup

Returns

answer_document(document: Union[InputFile, str], thumb: Optional[Union[InputFile, str]] = None, caption: Optional[str] = None, parse_mode: Optional[str] = sentinel.UNSET, disable_notification: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendDocument[source]#

Answer with document

Parameters
  • document

  • thumb

  • caption

  • parse_mode

  • disable_notification

  • reply_markup

Returns

reply_game(game_short_name: str, disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[InlineKeyboardMarkup] = None) SendGame[source]#

Reply with game

Parameters
  • game_short_name

  • disable_notification

  • allow_sending_without_reply

  • reply_markup

Returns

answer_game(game_short_name: str, disable_notification: Optional[bool] = None, reply_markup: Optional[InlineKeyboardMarkup] = None) SendGame[source]#

Answer with game

Parameters
  • game_short_name

  • disable_notification

  • reply_markup

Returns

reply_invoice(title: str, description: str, payload: str, provider_token: str, start_parameter: str, currency: str, prices: List[LabeledPrice], provider_data: Optional[str] = None, photo_url: Optional[str] = None, photo_size: Optional[int] = None, photo_width: Optional[int] = None, photo_height: Optional[int] = None, need_name: Optional[bool] = None, need_phone_number: Optional[bool] = None, need_email: Optional[bool] = None, need_shipping_address: Optional[bool] = None, send_phone_number_to_provider: Optional[bool] = None, send_email_to_provider: Optional[bool] = None, is_flexible: Optional[bool] = None, disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[InlineKeyboardMarkup] = None) SendInvoice[source]#

Reply with invoice

Parameters
  • title

  • description

  • payload

  • provider_token

  • start_parameter

  • currency

  • prices

  • provider_data

  • photo_url

  • photo_size

  • photo_width

  • photo_height

  • need_name

  • need_phone_number

  • need_email

  • need_shipping_address

  • send_phone_number_to_provider

  • send_email_to_provider

  • is_flexible

  • disable_notification

  • allow_sending_without_reply

  • reply_markup

Returns

answer_invoice(title: str, description: str, payload: str, provider_token: str, start_parameter: str, currency: str, prices: List[LabeledPrice], provider_data: Optional[str] = None, photo_url: Optional[str] = None, photo_size: Optional[int] = None, photo_width: Optional[int] = None, photo_height: Optional[int] = None, need_name: Optional[bool] = None, need_phone_number: Optional[bool] = None, need_email: Optional[bool] = None, need_shipping_address: Optional[bool] = None, send_phone_number_to_provider: Optional[bool] = None, send_email_to_provider: Optional[bool] = None, is_flexible: Optional[bool] = None, disable_notification: Optional[bool] = None, reply_markup: Optional[InlineKeyboardMarkup] = None) SendInvoice[source]#

Answer with invoice

Parameters
  • title

  • description

  • payload

  • provider_token

  • start_parameter

  • currency

  • prices

  • provider_data

  • photo_url

  • photo_size

  • photo_width

  • photo_height

  • need_name

  • need_phone_number

  • need_email

  • need_shipping_address

  • send_phone_number_to_provider

  • send_email_to_provider

  • is_flexible

  • disable_notification

  • reply_markup

Returns

reply_location(latitude: float, longitude: float, live_period: Optional[int] = None, disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendLocation[source]#

Reply with location

Parameters
  • latitude

  • longitude

  • live_period

  • disable_notification

  • allow_sending_without_reply

  • reply_markup

Returns

answer_location(latitude: float, longitude: float, live_period: Optional[int] = None, disable_notification: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendLocation[source]#

Answer with location

Parameters
  • latitude

  • longitude

  • live_period

  • disable_notification

  • reply_markup

Returns

reply_media_group(media: List[Union[InputMediaPhoto, InputMediaVideo]], disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None) SendMediaGroup[source]#

Reply with media group

Parameters
  • media

  • disable_notification

  • allow_sending_without_reply

Returns

answer_media_group(media: List[Union[InputMediaPhoto, InputMediaVideo]], disable_notification: Optional[bool] = None) SendMediaGroup[source]#

Answer with media group

Parameters
  • media

  • disable_notification

Returns

reply(text: str, parse_mode: Optional[str] = sentinel.UNSET, disable_web_page_preview: Optional[bool] = None, disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendMessage[source]#

Reply with text message

Parameters
  • text

  • parse_mode

  • disable_web_page_preview

  • disable_notification

  • allow_sending_without_reply

  • reply_markup

Returns

answer(text: str, parse_mode: Optional[str] = sentinel.UNSET, disable_web_page_preview: Optional[bool] = None, disable_notification: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendMessage[source]#

Answer with text message

Parameters
  • text

  • parse_mode

  • disable_web_page_preview

  • disable_notification

  • reply_markup

Returns

reply_photo(photo: Union[InputFile, str], caption: Optional[str] = None, parse_mode: Optional[str] = sentinel.UNSET, disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendPhoto[source]#

Reply with photo

Parameters
  • photo

  • caption

  • parse_mode

  • disable_notification

  • allow_sending_without_reply

  • reply_markup

Returns

answer_photo(photo: Union[InputFile, str], caption: Optional[str] = None, parse_mode: Optional[str] = sentinel.UNSET, disable_notification: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendPhoto[source]#

Answer with photo

Parameters
  • photo

  • caption

  • parse_mode

  • disable_notification

  • reply_markup

Returns

reply_poll(question: str, options: List[str], is_anonymous: Optional[bool] = None, type: Optional[str] = None, allows_multiple_answers: Optional[bool] = None, correct_option_id: Optional[int] = None, explanation: Optional[str] = None, explanation_parse_mode: Optional[str] = sentinel.UNSET, open_period: Optional[int] = None, close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None, is_closed: Optional[bool] = None, disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendPoll[source]#

Reply with poll

Parameters
  • question

  • options

  • is_anonymous

  • type

  • allows_multiple_answers

  • correct_option_id

  • explanation

  • explanation_parse_mode

  • open_period

  • close_date

  • is_closed

  • disable_notification

  • allow_sending_without_reply

  • reply_markup

Returns

answer_poll(question: str, options: List[str], is_anonymous: Optional[bool] = None, type: Optional[str] = None, allows_multiple_answers: Optional[bool] = None, correct_option_id: Optional[int] = None, explanation: Optional[str] = None, explanation_parse_mode: Optional[str] = sentinel.UNSET, open_period: Optional[int] = None, close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None, is_closed: Optional[bool] = None, disable_notification: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendPoll[source]#

Answer with poll

Parameters
  • question

  • options

  • is_anonymous

  • type

  • allows_multiple_answers

  • correct_option_id

    param explanation

  • explanation_parse_mode

  • open_period

  • close_date

  • is_closed

  • disable_notification

  • reply_markup

Returns

reply_dice(emoji: Optional[str] = None, disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendDice[source]#

Reply with dice

Parameters
  • emoji

  • disable_notification

  • allow_sending_without_reply

  • reply_markup

Returns

answer_dice(emoji: Optional[str] = None, disable_notification: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendDice[source]#

Answer with dice

Parameters
  • emoji

  • disable_notification

  • reply_markup

Returns

reply_sticker(sticker: Union[InputFile, str], disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendSticker[source]#

Reply with sticker

Parameters
  • sticker

  • disable_notification

  • allow_sending_without_reply

  • reply_markup

Returns

answer_sticker(sticker: Union[InputFile, str], disable_notification: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendSticker[source]#

Answer with sticker

Parameters
  • sticker

  • disable_notification

  • reply_markup

Returns

reply_venue(latitude: float, longitude: float, title: str, address: str, foursquare_id: Optional[str] = None, foursquare_type: Optional[str] = None, disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendVenue[source]#

Reply with venue

Parameters
  • latitude

  • longitude

  • title

  • address

  • foursquare_id

  • foursquare_type

  • disable_notification

  • allow_sending_without_reply

  • reply_markup

Returns

answer_venue(latitude: float, longitude: float, title: str, address: str, foursquare_id: Optional[str] = None, foursquare_type: Optional[str] = None, disable_notification: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendVenue[source]#

Answer with venue

Parameters
  • latitude

  • longitude

  • title

  • address

  • foursquare_id

  • foursquare_type

  • disable_notification

  • reply_markup

Returns

reply_video(video: Union[InputFile, str], duration: Optional[int] = None, width: Optional[int] = None, height: Optional[int] = None, thumb: Optional[Union[InputFile, str]] = None, caption: Optional[str] = None, parse_mode: Optional[str] = sentinel.UNSET, supports_streaming: Optional[bool] = None, disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendVideo[source]#

Reply with video

Parameters
  • video

  • duration

  • width

  • height

  • thumb

  • caption

  • parse_mode

  • supports_streaming

  • disable_notification

  • allow_sending_without_reply

  • reply_markup

Returns

answer_video(video: Union[InputFile, str], duration: Optional[int] = None, width: Optional[int] = None, height: Optional[int] = None, thumb: Optional[Union[InputFile, str]] = None, caption: Optional[str] = None, parse_mode: Optional[str] = sentinel.UNSET, supports_streaming: Optional[bool] = None, disable_notification: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendVideo[source]#

Answer with video

Parameters
  • video

  • duration

  • width

  • height

  • thumb

  • caption

  • parse_mode

  • supports_streaming

  • disable_notification

  • reply_markup

Returns

reply_video_note(video_note: Union[InputFile, str], duration: Optional[int] = None, length: Optional[int] = None, thumb: Optional[Union[InputFile, str]] = None, disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendVideoNote[source]#

Reply wit video note

Parameters
  • video_note

  • duration

  • length

  • thumb

  • disable_notification

  • allow_sending_without_reply

  • reply_markup

Returns

answer_video_note(video_note: Union[InputFile, str], duration: Optional[int] = None, length: Optional[int] = None, thumb: Optional[Union[InputFile, str]] = None, disable_notification: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendVideoNote[source]#

Answer wit video note

Parameters
  • video_note

  • duration

  • length

  • thumb

  • disable_notification

  • reply_markup

Returns

reply_voice(voice: Union[InputFile, str], caption: Optional[str] = None, parse_mode: Optional[str] = sentinel.UNSET, duration: Optional[int] = None, disable_notification: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendVoice[source]#

Reply with voice

Parameters
  • voice

  • caption

  • parse_mode

  • duration

  • disable_notification

  • allow_sending_without_reply

  • reply_markup

Returns

answer_voice(voice: Union[InputFile, str], caption: Optional[str] = None, parse_mode: Optional[str] = sentinel.UNSET, duration: Optional[int] = None, disable_notification: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) SendVoice[source]#

Answer with voice

Parameters
  • voice

  • caption

  • parse_mode

  • duration

  • disable_notification

  • reply_markup

Returns

send_copy(chat_id: Union[str, int], disable_notification: Optional[bool] = None, reply_to_message_id: Optional[int] = None, reply_markup: Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, None] = None) Union[SendAnimation, SendAudio, SendContact, SendDocument, SendLocation, SendMessage, SendPhoto, SendPoll, SendDice, SendSticker, SendVenue, SendVideo, SendVideoNote, SendVoice][source]#

Send copy of message.

Is similar to aiogram.client.bot.Bot.copy_message() but returning the sent message instead of aiogram.types.message_id.MessageId

Note

This method don’t use the API method named copyMessage and historically implemented before the similar method is added to API

Parameters
  • chat_id

  • disable_notification

  • reply_to_message_id

  • reply_markup

Returns

copy_to(chat_id: Union[int, str], caption: Optional[str] = None, parse_mode: Optional[str] = sentinel.UNSET, caption_entities: Optional[List[MessageEntity]] = None, disable_notification: Optional[bool] = None, reply_to_message_id: Optional[int] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None) CopyMessage[source]#

Copy message

Parameters
  • chat_id

  • caption

  • parse_mode

  • caption_entities

  • disable_notification

  • reply_to_message_id

  • allow_sending_without_reply

  • reply_markup

Returns

edit_text(text: str, parse_mode: Optional[str] = sentinel.UNSET, entities: Optional[List[MessageEntity]] = None, disable_web_page_preview: Optional[bool] = None, reply_markup: Optional[InlineKeyboardMarkup] = None) EditMessageText[source]#
edit_reply_markup(reply_markup: Optional[InlineKeyboardMarkup] = None) EditMessageReplyMarkup[source]#
delete_reply_markup() EditMessageReplyMarkup[source]#
edit_caption(caption: str, parse_mode: Optional[str] = sentinel.UNSET, caption_entities: Optional[List[MessageEntity]] = None, reply_markup: Optional[InlineKeyboardMarkup] = None) EditMessageCaption[source]#
delete() DeleteMessage[source]#
get_url(force_private: bool = False) Optional[str][source]#

Returns message URL. Cannot be used in private (one-to-one) chats. If chat has a username, returns URL like https://t.me/username/message_id Otherwise (or if {force_private} flag is set), returns https://t.me/c/shifted_chat_id/message_id

Parameters

force_private – if set, a private URL is returned even for a public chat

Returns

string with full message URL

class aiogram.types.message.ContentType[source]#
mode = 'snake_case'#
TEXT = 'text'#
AUDIO = 'audio'#
DOCUMENT = 'document'#
ANIMATION = 'animation'#
GAME = 'game'#
PHOTO = 'photo'#
STICKER = 'sticker'#
VIDEO = 'video'#
VIDEO_NOTE = 'video_note'#
VOICE = 'voice'#
CONTACT = 'contact'#
LOCATION = 'location'#
VENUE = 'venue'#
NEW_CHAT_MEMBERS = 'new_chat_members'#
LEFT_CHAT_MEMBER = 'left_chat_member'#
INVOICE = 'invoice'#
SUCCESSFUL_PAYMENT = 'successful_payment'#
CONNECTED_WEBSITE = 'connected_website'#
MIGRATE_TO_CHAT_ID = 'migrate_to_chat_id'#
MIGRATE_FROM_CHAT_ID = 'migrate_from_chat_id'#
PINNED_MESSAGE = 'pinned_message'#
NEW_CHAT_TITLE = 'new_chat_title'#
NEW_CHAT_PHOTO = 'new_chat_photo'#
DELETE_CHAT_PHOTO = 'delete_chat_photo'#
GROUP_CHAT_CREATED = 'group_chat_created'#
SUPERGROUP_CHAT_CREATED = 'supergroup_chat_created'#
CHANNEL_CHAT_CREATED = 'channel_chat_created'#
PASSPORT_DATA = 'passport_data'#
PROXIMITY_ALERT_TRIGGERED = 'proximity_alert_triggered'#
POLL = 'poll'#
DICE = 'dice'#
MESSAGE_AUTO_DELETE_TIMER_CHANGED = 'message_auto_delete_timer_changed'#
VIDEO_CHAT_SCHEDULED = 'video_chat_scheduled'#
VIDEO_CHAT_STARTED = 'video_chat_started'#
VIDEO_CHAT_ENDED = 'video_chat_ended'#
VIDEO_CHAT_PARTICIPANTS_INVITED = 'video_chat_participants_invited'#
WEB_APP_DATA = 'web_app_data'#
UNKNOWN = 'unknown'#
ANY = 'any'#