post_story()#
- Client.post_story()#
Posts a new story on behalf of a chat.
Usable by Users BotsRequires can_post_stories right for supergroup and channel chats.
Usable by Users BotsRequires the can_manage_stories business bot right.
- 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”.content (
InputStoryContent
) – Content of the story.active_period (
int
, optional) – Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400.caption (
str
, optional) – Caption of the story, 0-2048 characters after entities parsing.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.areas (List of
StoryArea
, optional) – List of of clickable areas to be shown on the story.post_to_chat_page (
bool
, optional) – Pass True to keep the story accessible after it expires.protect_content (
bool
, optional) – Pass True if the content of the story must be protected from forwarding and screenshotting.business_connection_id (
str
) – Unique identifier of the business connection.privacy_settings (
StoryPrivacySettings
, optional) – The privacy settings for the story; ignored for stories sent to supergroup and channel chats. Defaults toStoryPrivacySettingsEveryone
.from_story_chat_id (
int
|str
, optional) – Full identifier of the original story, which content was used to create the story; pass None if the story isn’t repost of another story. Identifier of the chat that posted the story.from_story_id (
int
, optional) – Full identifier of the original story, which content was used to create the story; pass None if the story isn’t repost of another story. Unique story identifier among stories of the given sender.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
a single story is returned.
Example
# Post story to your profile await app.post_story("me", InputStoryContentPhoto("story.png"), caption='My new story!')
- Raises:
ValueError – In case of invalid arguments.
RPCError – In case of Telegram RPCError.