edit_story_media()#

Client.edit_story_media()#

Edit story media.

Usable by Users Bots
Parameters:
  • 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”.

  • story_id (int) – Story identifier in the chat specified in chat_id.

  • media (str | BinaryIO, optional) – Video or photo to send. Pass a file_id as string to send a animation that exists on the Telegram servers, pass a file path as string to upload a new animation that exists on your local machine, or pass a binary file-like object with its attribute “.name” set for in-memory uploads.

  • duration (int, optional) – Duration of sent video in seconds.

  • width (int, optional) – Video width.

  • height (int, optional) – Video height.

  • thumb (str | BinaryIO, optional) – Thumbnail of the video sent. The thumbnail should be in JPEG format and less than 200 KB in size. A thumbnail’s width and height should not exceed 320 pixels. Thumbnails can’t be reused and can be only uploaded as a new file.

  • progress (Callable, optional) – Pass a callback function to view the file transmission progress. The function must take (current, total) as positional arguments (look at Other Parameters below for a detailed description) and will be called back each time a new file chunk has been successfully transmitted.

  • progress_args (tuple, optional) – Extra custom arguments for the progress callback function. You can pass anything you need to be available in the progress callback scope; for example, a Message object or a Client instance in order to edit the message with the updated progress status.

Returns:

Story – On success, the edited story is returned.

Example

# Replace the current media with a local photo
await app.edit_story_media(chat_id, story_id, "new_photo.jpg")

# Replace the current media with a local video
await app.edit_story_media(chat_id, story_id, "new_video.mp4")