Skip to content

Commit 6c35611

Browse files
authored
Stories-9.0
Added the classes InputStoryContentPhoto and InputStoryContentVideo representing the content of a story to post. Added the classes StoryArea, StoryAreaPosition, LocationAddress, StoryAreaTypeLocation, StoryAreaTypeSuggestedReaction, StoryAreaTypeLink, StoryAreaTypeWeather,StoryAreaTypeUniqueGift, StoryAreaTypeFoundVenue and StoryAreaTypeMessage describing clickable active areas on stories. Added the method post_story allowing bots to post a story on behalf of a managed business account. Added the methods edit_story and edit_business_story allowing bots to edit stories they had previously posted on behalf of a managed business account. Added the methods delete_stories and delete_business_story allowing bots to delete stories they had previously posted on behalf of a managed business account. Added the classes StoryPrivacySettings StoryPrivacySettingsEveryone StoryPrivacySettingsContacts StoryPrivacySettingsCloseFriends StoryPrivacySettingsSelectedUsers to describe the privacy settings of a story. Renamed attributes in story. Added the method can_post_story and the classes CanPostStoryResult CanPostStoryResultOk CanPostStoryResultPremiumNeeded CanPostStoryResultBoostNeeded CanPostStoryResultActiveStoryLimitExceeded CanPostStoryResultWeeklyLimitExceeded CanPostStoryResultMonthlyLimitExceeded to check whether the current user can post a story on behalf of a chat. Added the method hide_my_story_view for Telegram Premium users and the type StoryStealthMode. Add TEMPORARY support for parsing story link in get_messages Add forward_story Add toggle_story_is_posted_to_chat_page Add get_chat_active_stories and get_chat_archived_stories. Added the classes StoryRepostInfo, StoryOrigin, StoryOriginHiddenUser, StoryOriginPublicStory
1 parent 663678e commit 6c35611

File tree

70 files changed

+3205
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+3205
-141
lines changed

compiler/docs/compiler.py

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,18 @@ def get_title_list(s: str) -> list:
390390
""",
391391
stories="""
392392
Stories
393+
can_post_story
393394
get_stories
395+
get_chat_active_stories
396+
get_chat_archived_stories
397+
post_story
398+
edit_story
399+
edit_business_story
400+
delete_stories
401+
delete_business_story
402+
hide_my_story_view
403+
forward_story
404+
toggle_story_is_posted_to_chat_page
394405
""",
395406
payments="""
396407
Payments
@@ -691,7 +702,41 @@ def get_title_list(s: str) -> list:
691702
PaidReactionTypeAnonymous
692703
PaidReactionTypeChat
693704
PaidReactionTypeRegular
694-
"""
705+
""",
706+
stories="""
707+
Stories
708+
CanPostStoryResult
709+
CanPostStoryResultOk
710+
CanPostStoryResultPremiumNeeded
711+
CanPostStoryResultBoostNeeded
712+
CanPostStoryResultActiveStoryLimitExceeded
713+
CanPostStoryResultWeeklyLimitExceeded
714+
CanPostStoryResultMonthlyLimitExceeded
715+
InputStoryContent
716+
InputStoryContentPhoto
717+
InputStoryContentVideo
718+
StoryAreaPosition
719+
LocationAddress
720+
StoryAreaType
721+
StoryAreaTypeFoundVenue
722+
StoryAreaTypeLocation
723+
StoryAreaTypeSuggestedReaction
724+
StoryAreaTypeLink
725+
StoryAreaTypeMessage
726+
StoryAreaTypeWeather
727+
StoryAreaTypeUniqueGift
728+
StoryArea
729+
StoryRepostInfo
730+
StoryOrigin
731+
StoryOriginHiddenUser
732+
StoryOriginPublicStory
733+
StoryPrivacySettings
734+
StoryPrivacySettingsEveryone
735+
StoryPrivacySettingsContacts
736+
StoryPrivacySettingsCloseFriends
737+
StoryPrivacySettingsSelectedUsers
738+
StoryStealthMode
739+
""",
695740
)
696741

697742
root = PYROGRAM_API_DEST + "/types"

compiler/docs/template/types.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,16 @@ Payments
163163
:hidden:
164164

165165
{payments}
166+
167+
Stories
168+
--------
169+
170+
.. autosummary::
171+
:nosignatures:
172+
173+
{stories}
174+
175+
.. toctree::
176+
:hidden:
177+
178+
{stories}

docs/source/releases/changes-in-this-fork.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ Changes in this Fork
4141
| Scheme layer used: 202 |
4242
+------------------------+
4343

44+
- Added the method :meth:`~pyrogram.Client.post_story` allowing bots to post a story on behalf of a managed business account.
45+
- Added the method :meth:`~pyrogram.Client.edit_story` and :meth:`~pyrogram.Client.edit_business_story`, allowing bots to edit stories they had previously posted on behalf of a managed business account.
46+
- Added the methods :meth:`~pyrogram.Client.delete_stories` and :meth:`~pyrogram.Client.delete_business_story`, allowing bots to delete stories they had previously posted on behalf of a managed business account.
47+
- Added the classes :obj:`~pyrogram.types.InputStoryContentPhoto` and :obj:`~pyrogram.types.InputStoryContentVideo` representing the content of a story to post.
48+
- Added the classes :obj:`~pyrogram.types.StoryArea`, :obj:`~pyrogram.types.StoryAreaPosition`, :obj:`~pyrogram.types.LocationAddress`, :obj:`~pyrogram.types.StoryAreaTypeLocation`, :obj:`~pyrogram.types.StoryAreaTypeSuggestedReaction`, :obj:`~pyrogram.types.StoryAreaTypeLink`, :obj:`~pyrogram.types.StoryAreaTypeWeather`, :obj:`~pyrogram.types.StoryAreaTypeUniqueGift`, :obj:`~pyrogram.types.StoryAreaTypeFoundVenue` and :obj:`~pyrogram.types.StoryAreaTypeMessage` describing clickable active areas on stories.
49+
- Added the classes :obj:`~pyrogram.types.StoryPrivacySettings`, :obj:`~pyrogram.types.StoryPrivacySettingsEveryone`, :obj:`~pyrogram.types.StoryPrivacySettingsContacts`, :obj:`~pyrogram.types.StoryPrivacySettingsCloseFriends`, :obj:`~pyrogram.types.StoryPrivacySettingsSelectedUsers` to describe the privacy settings of a story.
50+
- Added the methods :meth:`~pyrogram.Client.can_post_story`, :meth:`~pyrogram.Client.hide_my_story_view`, :meth:`~pyrogram.Client.forward_story`, :meth:`~pyrogram.Client.toggle_story_is_posted_to_chat_page`, :meth:`~pyrogram.Client.get_chat_active_stories`, :meth:`~pyrogram.Client.get_chat_archived_stories`.
51+
- Add support for parsing story links in :meth:`~pyrogram.Client.get_messages`.
4452
- View `new and changed <https://telegramplayground.github.io/TG-APIs/TL/diff/tdlib.html?from=201&to=202>`__ `raw API methods <https://telegramplayground.github.io/TG-APIs/TL/diff/tdesktop.html?from=200&to=202>`__.
4553

4654
+------------------------+

pyrogram/methods/business/get_owned_star_count.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ async def get_business_account_star_balance(
8383
if not business_connection_id:
8484
raise ValueError("business_connection_id is required")
8585

86-
business_connection = self.business_user_connection_cache[business_connection_id]
87-
if not business_connection:
86+
business_connection = self.business_user_connection_cache.get(business_connection_id)
87+
if business_connection is None:
8888
business_connection = await self.get_business_connection(business_connection_id)
8989
r = await self.invoke(
9090
raw.functions.InvokeWithBusinessConnection(

pyrogram/methods/chats/pin_chat_message.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ async def pin_chat_message(
7979
session = None
8080
business_connection = None
8181
if business_connection_id:
82-
business_connection = self.business_user_connection_cache[business_connection_id]
83-
if not business_connection:
82+
business_connection = self.business_user_connection_cache.get(business_connection_id)
83+
if business_connection is None:
8484
business_connection = await self.get_business_connection(business_connection_id)
8585
session = await get_session(
8686
self,

pyrogram/methods/chats/unpin_chat_message.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ async def unpin_chat_message(
6666
session = None
6767
business_connection = None
6868
if business_connection_id:
69-
business_connection = self.business_user_connection_cache[business_connection_id]
70-
if not business_connection:
69+
business_connection = self.business_user_connection_cache.get(business_connection_id)
70+
if business_connection is None:
7171
business_connection = await self.get_business_connection(business_connection_id)
7272
session = await get_session(
7373
self,

pyrogram/methods/messages/edit_cached_media.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ async def edit_cached_media(
110110
session = None
111111
business_connection = None
112112
if business_connection_id:
113-
business_connection = self.business_user_connection_cache[business_connection_id]
114-
if not business_connection:
113+
business_connection = self.business_user_connection_cache.get(business_connection_id)
114+
if business_connection is None:
115115
business_connection = await self.get_business_connection(business_connection_id)
116116
session = await get_session(
117117
self,

pyrogram/methods/messages/edit_message_media.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ async def edit_message_media(
309309
session = None
310310
business_connection = None
311311
if business_connection_id:
312-
business_connection = self.business_user_connection_cache[business_connection_id]
313-
if not business_connection:
312+
business_connection = self.business_user_connection_cache.get(business_connection_id)
313+
if business_connection is None:
314314
business_connection = await self.get_business_connection(business_connection_id)
315315
session = await get_session(
316316
self,

pyrogram/methods/messages/edit_message_reply_markup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ async def edit_message_reply_markup(
7373
session = None
7474
business_connection = None
7575
if business_connection_id:
76-
business_connection = self.business_user_connection_cache[business_connection_id]
77-
if not business_connection:
76+
business_connection = self.business_user_connection_cache.get(business_connection_id)
77+
if business_connection is None:
7878
business_connection = await self.get_business_connection(business_connection_id)
7979
session = await get_session(
8080
self,

pyrogram/methods/messages/edit_message_text.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ async def edit_message_text(
134134
session = None
135135
business_connection = None
136136
if business_connection_id:
137-
business_connection = self.business_user_connection_cache[business_connection_id]
138-
if not business_connection:
137+
business_connection = self.business_user_connection_cache.get(business_connection_id)
138+
if business_connection is None:
139139
business_connection = await self.get_business_connection(business_connection_id)
140140
session = await get_session(
141141
self,

0 commit comments

Comments
 (0)