async Client.edit_message_media()

Edit animation, audio, document, photo or video messages.

If a message is a part of a message album, then it can be edited only to a photo or a video. Otherwise, the message type can be changed arbitrarily.

Usable by Users Bots
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use “me” or “self”. For a contact that exists in your Telegram address book you can use his phone number (str).

  • message_id (int) – Message identifier in the chat specified in chat_id.

  • media (InputMedia) – One of the InputMedia objects describing an animation, audio, document, photo or video.

  • reply_markup (InlineKeyboardMarkup, optional) – An InlineKeyboardMarkup object.

  • file_name (str, optional) – File name of the media to be sent. Not applicable to photos. Defaults to file’s path basename.


Message – On success, the edited message is returned.


from hydrogram.types import InputMediaPhoto, InputMediaVideo, InputMediaAudio

# Replace the current media with a local photo
await app.edit_message_media(chat_id, message_id, InputMediaPhoto("new_photo.jpg"))

# Replace the current media with a local video
await app.edit_message_media(chat_id, message_id, InputMediaVideo("new_video.mp4"))

# Replace the current media with a local audio
await app.edit_message_media(chat_id, message_id, InputMediaAudio("new_audio.mp3"))