send_story()

Client.send_story()

Send new story.

Usable by Users Bots

Note: You must pass one of following paramater animation, photo, video

Parameters:
  • chat_id (int | str, optional) – Unique identifier (int) or username (str) of the target channel. You can also use channel public link in form of t.me/<username> (str).

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

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

  • file_name (str, optional) – File name of the video sent. Defaults to file’s path basename.

  • privacy (StoriesPrivacyRules, optional) – Story privacy. Defaults to PUBLIC

  • allowed_users (List of int, optional) – List of user_id whos allowed to view the story.

  • denied_users (List of int, optional) – List of user_id whos denied to view the story.

  • pinned (bool, optional) – if True, the story will be pinned. default to False.

  • protect_content (bool, optional) – Protects the contents of the sent story from forwarding and saving. default to False.

  • caption (str, optional) – Story caption, 0-1024 characters.

  • parse_mode (ParseMode, optional) – By default, texts are parsed using both Markdown and HTML styles. You can combine both syntaxes together.

  • caption_entities (List of MessageEntity) – List of special entities that appear in the caption, which can be specified instead of parse_mode.

  • period (int, optional) – How long the story will posted, in secs. only for premium users.

  • media_areas (List of InputMediaArea) – List of media area object to be included in story.

  • forward_from_chat_id (int | str, optional) – Unique identifier (int) or username (str) of the source chat where the original story was sent. For your personal story you can simply use “me” or “self”. For a contact that exists in your Telegram address book you can use his phone number (str).

  • forward_from_story_id (int, optional) – Single story id.

Returns:

Story a single story is returned.

Example

# Send new photo story
photo_id = "abcd12345"
await app.send_story(photo=photo_id, caption='Hello guys.')
Raises:

ValueError – In case of invalid arguments.