Skip to content

Commit a648c42

Browse files
authored
Merge branch 'dev' into md-docs
2 parents c1ca25b + 6883c89 commit a648c42

File tree

6 files changed

+51
-0
lines changed

6 files changed

+51
-0
lines changed

compiler/docs/compiler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,7 @@ def get_title_list(s: str) -> list:
808808
CanPostStoryResultBoostNeeded
809809
CanPostStoryResultActiveStoryLimitExceeded
810810
CanPostStoryResultWeeklyLimitExceeded
811+
CanPostStoryResultLiveStoryIsActive
811812
CanPostStoryResultMonthlyLimitExceeded
812813
InputStoryContent
813814
InputStoryContentPhoto

compiler/errors/source/400_BAD_REQUEST.tsv

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,10 +490,12 @@ SMS_CODE_CREATE_FAILED An error occurred while creating the SMS code.
490490
SRP_A_INVALID The specified inputCheckPasswordSRP.A value is invalid.
491491
SRP_ID_INVALID Invalid SRP ID provided.
492492
SRP_PASSWORD_CHANGED Password has changed.
493+
STARGIFT_ALREADY_BURNED The provided gift is already burned.
493494
STARGIFT_ALREADY_CONVERTED The specified star gift was already converted to Stars.
494495
STARGIFT_ALREADY_REFUNDED The specified star gift was already refunded.
495496
STARGIFT_ALREADY_TRANSFERRED The provided star gift was already transferred.
496497
STARGIFT_ALREADY_UPGRADED The specified gift was already upgraded to a collectible gift.
498+
STARGIFT_ATTRIBUTE_INVALID The provided gift attribute is invalid.
497499
STARGIFT_CONVERT_TOO_OLD This gift can no longer be converted into stars.
498500
STARGIFT_EXPORT_UNAVAILABLE This gift is not available for export yet.
499501
STARGIFT_INVALID The passed gift is invalid.
@@ -548,6 +550,7 @@ STORIES_NEVER_CREATED This peer hasn't ever posted any stories.
548550
STORIES_TOO_MUCH You have hit the maximum active stories limit as specified by the [`story_expiring_limit_*` client configuration parameters](https://core.telegram.org/api/config#story-expiring-limit-default): you should buy a [Premium](https://core.telegram.org/api/premium) subscription, delete an active story, or wait for the oldest story to expire.
549551
STORY_ID_EMPTY You specified no story IDs.
550552
STORY_ID_INVALID The specified story ID is invalid.
553+
STORY_LIVE_ALREADY_X The user or the chat has an active live story with identifier {value}.
551554
STORY_NOT_MODIFIED The new story information you passed is equal to the previous story information, thus it wasn't modified.
552555
STORY_PERIOD_INVALID The specified story period is invalid for this account.
553556
STORY_PUBLIC_MISSING The story you are trying to access or manipulate is not publicly available.
@@ -629,6 +632,7 @@ USER_BOT_REQUIRED This method can only be called by a bot.
629632
USER_CHANNELS_TOO_MUCH One of the users you tried to add is already in too many channels/supergroups.
630633
USER_CREATOR For channels.editAdmin: you've tried to edit the admin rights of the owner, but you're not the owner; for channels.leaveChannel: you can't leave this channel, because you're its creator.
631634
USER_GIFT_UNAVAILABLE Gifts are not available in the current region ([stars_gifts_enabled](https://core.telegram.org/api/config#stars-gifts-enabled) is equal to false).
635+
USER_HANDLE_MISMATCH The user handle mismatch.
632636
USER_ID_INVALID The provided user ID is invalid.
633637
USER_INVALID Invalid user provided.
634638
USER_IS_BLOCKED You were blocked by this user.

pyrogram/methods/stories/can_post_story.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,8 @@ async def can_post_story(
6767
return types.CanPostStoryResultMonthlyLimitExceeded(
6868
retry_after=ex.value
6969
)
70+
except errors.StoryLiveAlready as ex:
71+
return types.CanPostStoryResultLiveStoryIsActive(
72+
story_id=ex.value
73+
)
7074
return types.CanPostStoryResultOk(story_count=r.count_remains)

pyrogram/types/stories/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from .can_post_story_result_active_story_limit_exceeded import CanPostStoryResultActiveStoryLimitExceeded
2525
from .can_post_story_result_weekly_limit_exceeded import CanPostStoryResultWeeklyLimitExceeded
2626
from .can_post_story_result_monthly_limit_exceeded import CanPostStoryResultMonthlyLimitExceeded
27+
from .can_post_story_result_live_story_is_active import CanPostStoryResultLiveStoryIsActive
2728
from .input_story_content import InputStoryContent
2829
from .input_story_content_photo import InputStoryContentPhoto
2930
from .input_story_content_video import InputStoryContentVideo
@@ -58,6 +59,7 @@
5859
"CanPostStoryResultOk",
5960
"CanPostStoryResultPremiumNeeded",
6061
"CanPostStoryResultWeeklyLimitExceeded",
62+
"CanPostStoryResultLiveStoryIsActive",
6163
"CanPostStoryResult",
6264
"InputStoryContent",
6365
"InputStoryContentPhoto",
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Pyrogram - Telegram MTProto API Client Library for Python
2+
# Copyright (C) 2017-present <https://github.com/TelegramPlayGround>
3+
#
4+
# This file is part of Pyrogram.
5+
#
6+
# Pyrogram is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU Lesser General Public License as published
8+
# by the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# Pyrogram is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU Lesser General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU Lesser General Public License
17+
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
18+
19+
20+
from .can_post_story_result import CanPostStoryResult
21+
22+
23+
class CanPostStoryResultLiveStoryIsActive(CanPostStoryResult):
24+
"""The user or the chat has an active live story. The live story must be deleted first.
25+
26+
Parameters:
27+
story_id (``int``):
28+
Identifier of the active live story.
29+
30+
"""
31+
32+
def __init__(
33+
self,
34+
story_id: int,
35+
):
36+
super().__init__()
37+
38+
self.story_id = story_id

pyrogram/types/stories/story.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ def _parse_story_item(
220220
video_attributes = attributes.get(raw.types.DocumentAttributeVideo, None)
221221
video = types.Video._parse(client, story_item.media, video_attributes, None)
222222
media = enums.MessageMediaType.VIDEO
223+
else:
224+
media = enums.MessageMediaType.UNKNOWN
223225
has_protected_content = story_item.noforwards
224226
is_edited = story_item.edited
225227
is_posted_to_chat_page = story_item.pinned

0 commit comments

Comments
 (0)