edit_inline_media()

Client.edit_inline_media()

Edit inline animation, audio, document, photo or video messages, or replace inline text with inline animation, audio, document, photo or video messages.

When the inline message is edited, a new file can’t be uploaded. Use a previously uploaded file via its file_id or specify a URL.

Usable by Users Bots
Parameters:
  • inline_message_id (str) – Required if chat_id and message_id are not specified. Identifier of the inline message.

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

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

Returns:

bool – On success, True is returned.

Example

from pyrogram.types import InputMediaPhoto, InputMediaVideo, InputMediaAudio

# Bots only

# Replace the current media with a local photo
await app.edit_inline_media(inline_message_id, InputMediaPhoto("new_photo.jpg"))

# Replace the current media with a local video
await app.edit_inline_media(inline_message_id, InputMediaVideo("new_video.mp4"))

# Replace the current media with a local audio
await app.edit_inline_media(inline_message_id, InputMediaAudio("new_audio.mp3"))