Story¶
- class pyrogram.types.Story
Bases:
Object,UpdateA story.
- Parameters:
id (
int) – Unique story identifier.from_user (
User, optional) – Sender of the story.sender_chat (
Chat, optional) – Sender of the story, sent on behalf of a chat.date (
datetime, optional) – Date the story was sent.chat (
Chat, optional) – Conversation the story belongs to.forward_from (
User, optional) – For forwarded stories, sender of the original story.forward_sender_name (
str, optional) – For stories forwarded from users who have hidden their accounts, name of the user.forward_from_chat (
Chat, optional) – For stories forwarded from channels, information about the original channel.forward_from_story_id (
int, optional) – For stories forwarded from channels, identifier of the original story in the channel.expire_date (
datetime, optional) – Date the story will be expired.media (
MessageMediaType, optional) – The media type of the Story. This field will contain the enumeration type of the media message. You can usemedia = getattr(story, story.media.value)to access the media message.has_protected_content (
bool, optional) – True, if the story can’t be forwarded.photo (
Photo, optional) – Story is a photo, information about the photo.video (
Video, optional) – Story is a video, information about the video.edited (
bool, optional) – True, if the Story has been edited.pinned (
bool, optional) – True, if the Story is pinned.public (
bool, optional) – True, if the Story is shared with public.close_friends (
bool, optional) – True, if the Story is shared with close_friends only.contacts (
bool, optional) – True, if the Story is shared with contacts only.selected_contacts (
bool, optional) – True, if the Story is shared with selected contacts only.caption (
str, optional) – Caption for the Story, 0-1024 characters.caption_entities (List of
MessageEntity, optional) – For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the caption.views (
int, optional) – Stories views.forwards (
int, optional) – Stories forwards.outgoing (
bool, optional) – Whether the story is incoming or outgoing. Story received from others are incoming (outgoing is False). Story sent from yourself are outgoing (outgoing is True).privacy (
StoriesPrivacyRules, optional) – Story privacy.allowed_users (List of
int|str, optional) – List of user_ids or chat_ids whos allowed to view the story.disallowed_users (List of
int|str, optional) – List of user_ids whos denied to view the story.reactions (List of
Reaction) – List of the reactions to this story.reactions_count (
int, optional) – Reactions count.skipped (
bool, optional) – The story is skipped. A story can be skipped in case it was skipped.deleted (
bool, optional) – The story is deleted. A story can be deleted in case it was deleted or you tried to retrieve a story that doesn’t exist yet.media_areas (List of
MediaArea, optional) – List of media areas.raw (
StoryItem, optional) – The raw story object, as received from the Telegram API.
- edit_privacy(privacy=pyrogram.enums.StoriesPrivacyRules.PUBLIC, allowed_users=None, disallowed_users=None)
Bound method edit_privacy of
Story.Use as a shortcut for:
await client.edit_story_privacy( story_id=story.id, privacy=enums.StoriesPrivacyRules.PUBLIC )
Example
await story.edit_privacy(enums.StoriesPrivacyRules.PUBLIC)
- Parameters:
privacy (
StoriesPrivacyRules, optional) – Story privacy. Defaults toPUBLIC.allowed_users (List of
int|str, optional) – List of user_id or chat_id of chat users who are allowed to view stories. Note: chat_id available only withSELECTED_USERS. Works withCLOSE_FRIENDSandSELECTED_USERSonlydisallowed_users (List of
int|str, optional) – List of user_id whos disallow to view the stories. Note: Works withPUBLICandCONTACTSonly
- Returns:
On success, the edited
Storyis returned.- Raises:
RPCError – In case of a Telegram RPC error.
- view()
Bound method view of
Story.Use as a shortcut for:
await client.view_stories( chat_id=chat_id, story_id=story_id )
Example
await story.view()
- Returns:
True on success, False otherwise.