Skip to content

Commit

Permalink
Remove MessageStory type
Browse files Browse the repository at this point in the history
  • Loading branch information
KurimuzonAkuma committed Dec 6, 2023
1 parent 7b199bd commit da3e2c6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 65 deletions.
1 change: 0 additions & 1 deletion compiler/docs/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,6 @@ def get_title_list(s: str) -> list:
WebAppData
MessageReactions
ChatReactions
MessageStory
Story
StoryViews
MyBoost
Expand Down
3 changes: 1 addition & 2 deletions pyrogram/types/messages_and_media/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
from .web_app_data import WebAppData
from .web_page import WebPage
from .message_reactions import MessageReactions
from .message_story import MessageStory
from .my_boost import MyBoost

__all__ = [
Expand All @@ -60,5 +59,5 @@
"GeneralTopicUnhidden", "Game", "GiftCode", "Giveaway", "Location", "Message", "MessageEntity",
"Photo", "Thumbnail", "StrippedThumbnail", "Story", "StoryViews", "Poll", "PollOption",
"Sticker", "Venue", "Video", "VideoNote", "Voice", "WebPage", "Dice", "Reaction",
"WebAppData", "MessageReactions", "MessageStory", "MyBoost"
"WebAppData", "MessageReactions", "MyBoost"
]
27 changes: 24 additions & 3 deletions pyrogram/types/messages_and_media/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class Message(Object, Update):
giveaway (:obj:`~pyrogram.types.Giveaway`, *optional*):
Message is a giveaway, information about the giveaway.
story (:obj:`~pyrogram.types.MessageStory`, *optional*):
story (:obj:`~pyrogram.types.Story`, *optional*):
Message is a story, information about the story.
video (:obj:`~pyrogram.types.Video`, *optional*):
Expand Down Expand Up @@ -415,7 +415,7 @@ def __init__(
animation: "types.Animation" = None,
game: "types.Game" = None,
giveaway: "types.Giveaway" = None,
story: "types.MessageStory" = None,
story: "types.Story" = None,
video: "types.Video" = None,
voice: "types.Voice" = None,
video_note: "types.VideoNote" = None,
Expand Down Expand Up @@ -867,7 +867,28 @@ async def _parse(
giveaway = types.Giveaway._parse(client, media, chats)
media_type = enums.MessageMediaType.GIVEAWAY
elif isinstance(media, raw.types.MessageMediaStory):
story = types.MessageStory._parse(client, media, users, chats)
if not media.story:
peer_id = utils.get_raw_peer_id(media.peer)

if isinstance(media.peer, raw.types.PeerUser):
forward_from_chat = types.Chat._parse_user_chat(client, users[peer_id])
else:
forward_from_chat = types.Chat._parse_channel_chat(client, chats[peer_id])

forward_from_user = types.User._parse(client, users[peer_id])
forward_sender_chat = types.Chat._parse_channel_chat(client, chats[peer_id]) if not forward_from_user else None
forward_from_chat = forward_sender_chat if not forward_from_user else types.Chat._parse_user_chat(client, users[peer_id])

story = types.Story(
client=client,
id=media.id,
from_user=forward_from_user,
sender_chat=forward_sender_chat,
chat=forward_from_chat
)
else:
await types.Story._parse(client, media.story, users, chats, media.peer)

media_type = enums.MessageMediaType.STORY
elif isinstance(media, raw.types.MessageMediaDocument):
doc = media.document
Expand Down
59 changes: 0 additions & 59 deletions pyrogram/types/messages_and_media/message_story.py

This file was deleted.

0 comments on commit da3e2c6

Please sign in to comment.