send_story()¶
- Client.send_story()¶
Send a new story.
Usable by Users Bots- Parameters:
chat_id (
int|str) – Unique identifier (int) or username (str) of the target chat. For your own stories you can use “me” or “self”.media (
str|BinaryIO) – Photo or video to send as story. Pass a file_id as string to send a file that exists on the Telegram servers, pass an HTTP URL as string for Telegram to get a file from the Internet, pass a file path as string to upload a new file from the local filesystem, or pass a binary file-like object to upload from memory.caption (
str, optional) – Story caption, 0-2048 characters.period (
int, optional) – Period after which the story will expire, in seconds. Default is 86400 (24 hours). Allowed values: 6*3600 (6 hours), 12*3600 (12 hours), 86400 (24 hours), 2*86400 (48 hours).pinned (
bool, optional) – Whether to pin the story to the profile.protect_content (
bool, optional) – Protects the story from forwarding and saving.parse_mode (
ParseMode, optional) – By default, texts are parsed using HTML style. Pass “markdown” or “md” to enable Markdown-style parsing.caption_entities (List of
MessageEntity, optional) – List of special entities that appear in the caption.privacy_rules (List of
InputPrivacyRule, optional) – Privacy rules for the story. If not provided, defaults to public.
- Returns:
StoryItem– On success, the sent story is returned.
Example
# Send a photo story await app.send_story("me", "photo.jpg", caption="My story!") # Send a video story await app.send_story("me", "video.mp4") # Send a story with limited visibility from pyrogram import raw await app.send_story( "me", "photo.jpg", privacy_rules=[raw.types.InputPrivacyValueAllowCloseFriends()] )