Skip to content

Commit b491401

Browse files
committed
Add album_ids to Story
1 parent ce150d9 commit b491401

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

pyrogram/methods/stories/post_story.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ async def post_story(
3838
protect_content: bool = None,
3939
business_connection_id: str = None,
4040
privacy_settings: "types.StoryPrivacySettings" = None,
41+
album_ids: list[int] = None,
4142
from_story_chat_id: Union[int, str] = None,
4243
from_story_id: int = None,
4344
progress: Callable = None,
@@ -90,6 +91,9 @@ async def post_story(
9091
The privacy settings for the story; ignored for stories sent to supergroup and channel chats.
9192
Defaults to :obj:`~pyrogram.types.StoryPrivacySettingsEveryone`.
9293
94+
album_ids (List of ``int``, *optional*):
95+
Identifiers of story albums to which the story will be added upon posting. An album can have up to ``stories_album_stories_limit``.
96+
9397
from_story_chat_id (``int`` | ``str``, *optional*):
9498
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.
9599
Identifier of the chat that posted the story.
@@ -230,6 +234,7 @@ async def post_story(
230234
caption=message,
231235
entities=entities,
232236
period=active_period,
237+
albums=album_ids,
233238
# fwd_modified=True if from_story_id else None,
234239
fwd_from_id=await self.resolve_peer(from_story_chat_id) if from_story_chat_id else None,
235240
fwd_from_story=from_story_id,

pyrogram/types/stories/story.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ class Story(Object, Update):
102102
The story is deleted.
103103
A story can be deleted in case it was deleted or you tried to retrieve a story that doesn't exist yet.
104104
105+
album_ids (List of ``int``):
106+
Identifiers of story albums to which the story is added; only for manageable stories.
107+
105108
link (``str``, *property*):
106109
Generate a link to this story, only for Telegram Premium chats having usernames. Can be None if the story cannot have a link.
107110
@@ -132,6 +135,7 @@ def __init__(
132135
forwards: int = None,
133136
skipped: bool = None,
134137
deleted: bool = None,
138+
album_ids: list[int] = None,
135139
_raw = None
136140
):
137141
super().__init__(client)
@@ -157,6 +161,7 @@ def __init__(
157161
self.forwards = forwards
158162
self.skipped = skipped
159163
self.deleted = deleted
164+
self.album_ids = album_ids
160165
self._raw = _raw
161166

162167
@staticmethod
@@ -182,6 +187,7 @@ def _parse_story_item(
182187
is_visible_only_for_self = None
183188
areas = None
184189
privacy_settings = None
190+
album_ids = None
185191

186192
if isinstance(story_item, raw.types.StoryItemDeleted):
187193
deleted = True
@@ -235,6 +241,8 @@ def _parse_story_item(
235241
area,
236242
) for area in story_item.media_areas
237243
]
244+
245+
album_ids = story_item.albums
238246

239247
return (
240248
date,
@@ -255,6 +263,7 @@ def _parse_story_item(
255263
is_visible_only_for_self,
256264
areas,
257265
privacy_settings,
266+
album_ids,
258267
)
259268

260269
@staticmethod
@@ -292,6 +301,7 @@ async def _parse(
292301
areas = None
293302
privacy_settings = None
294303
repost_info = None
304+
album_ids = None
295305

296306
if story_media:
297307
rawupdate = story_media
@@ -375,6 +385,7 @@ async def _parse(
375385
is_visible_only_for_self,
376386
areas,
377387
privacy_settings,
388+
album_ids,
378389
) = Story._parse_story_item(client, story_item)
379390

380391
if not chat and story_item.from_id:
@@ -416,6 +427,7 @@ async def _parse(
416427
areas=areas,
417428
privacy_settings=privacy_settings,
418429
repost_info=repost_info,
430+
album_ids=album_ids,
419431
)
420432

421433
async def react(

0 commit comments

Comments
 (0)