Skip to content

Commit

Permalink
Fix story parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
KurimuzonAkuma committed Dec 11, 2023
1 parent f7d0ec4 commit c991036
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pyrogram/types/messages_and_media/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from pyrogram import raw, enums
from pyrogram import types
from pyrogram import utils
from pyrogram.errors import MessageIdsEmpty, PeerIdInvalid, ChannelPrivate
from pyrogram.errors import MessageIdsEmpty, PeerIdInvalid, ChannelPrivate, BotMethodInvalid
from pyrogram.parser import utils as parser_utils, Parser
from ..object import Object
from ..update import Update
Expand Down Expand Up @@ -868,7 +868,11 @@ async def _parse(
media_type = enums.MessageMediaType.GIVEAWAY
elif isinstance(media, raw.types.MessageMediaStory):
if not media.story:
story = await client.get_stories(utils.get_peer_id(media.peer), media.id)
try:
story = await client.get_stories(utils.get_peer_id(media.peer), media.id)
except BotMethodInvalid:
pass

if not story:
story = await types.Story._parse(client, media, users, chats, media.peer)
else:
Expand Down Expand Up @@ -1098,7 +1102,7 @@ async def _parse(
parsed_message.reply_to_story_user_id,
parsed_message.reply_to_story_id
)
except Exception:
except BotMethodInvalid:
pass
else:
parsed_message.reply_to_story = reply_to_story
Expand Down

0 comments on commit c991036

Please sign in to comment.