mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-03 14:04:51 +00:00
Pyrofork: fix some derps
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
8309f9420b
commit
e956bcaac0
4 changed files with 75 additions and 70 deletions
|
|
@ -129,7 +129,9 @@ class Dispatcher:
|
|||
ChatJoinRequestHandler
|
||||
)
|
||||
|
||||
async def story_parser(update, _, __):
|
||||
async def story_parser(update, users, chats):
|
||||
print(update)
|
||||
print(update.story)
|
||||
return (
|
||||
await pyrogram.types.Story._parse(self.client, update.story, update.peer),
|
||||
StoryHandler
|
||||
|
|
|
|||
|
|
@ -142,7 +142,10 @@ class Story(Object, Update):
|
|||
stories: raw.base.StoryItem,
|
||||
peer: Union["raw.types.PeerChannel", "raw.types.PeerUser"]
|
||||
) -> "Story":
|
||||
if isinstance(stories, raw.types.StoryItem):
|
||||
if isinstance(stories, raw.types.StoryItemSkipped):
|
||||
return await types.StorySkipped._parse(client, stories, peer)
|
||||
if isinstance(stories, raw.types.StoryItemDeleted):
|
||||
return await types.StoryDeleted._parse(client, stories, peer)
|
||||
entities = [types.MessageEntity._parse(client, entity, {}) for entity in stories.entities]
|
||||
entities = types.List(filter(lambda x: x is not None, entities))
|
||||
animation = None
|
||||
|
|
@ -198,12 +201,9 @@ class Story(Object, Update):
|
|||
selected_contacts=stories.selected_contacts,
|
||||
caption=stories.caption,
|
||||
caption_entities=entities or None,
|
||||
views=types.StoryViews._parse(stories.views)
|
||||
views=types.StoryViews._parse(stories.views),
|
||||
client=client
|
||||
)
|
||||
if isinstance(stories, raw.types.StoryItemSkipped):
|
||||
return await types.StorySkipped()._parse(client, stories, peer)
|
||||
if isinstance(stories, raw.types.StoryItemDeleted):
|
||||
return await types.StoryDeleted()._parse(client, stories, peer)
|
||||
|
||||
async def reply_text(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -18,9 +18,8 @@
|
|||
|
||||
import pyrogram
|
||||
|
||||
from datetime import datetime
|
||||
from pyrogram import enums, raw, types, utils
|
||||
from typing import BinaryIO, Callable, List, Optional, Union
|
||||
from pyrogram import raw, types
|
||||
from typing import Union
|
||||
from ..object import Object
|
||||
from ..update import Update
|
||||
|
||||
|
|
@ -49,6 +48,8 @@ class StoryDeleted(Object, Update):
|
|||
super().__init__(client)
|
||||
|
||||
self.id = id
|
||||
self.from_user = from_user
|
||||
self.sender_chat = sender_chat
|
||||
|
||||
async def _parse(
|
||||
client: "pyrogram.Client",
|
||||
|
|
@ -67,5 +68,6 @@ class StoryDeleted(Object, Update):
|
|||
return StoryDeleted(
|
||||
id=stories.id,
|
||||
from_user=from_user,
|
||||
sender_chat=sender_chat
|
||||
sender_chat=sender_chat,
|
||||
client=client
|
||||
)
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@
|
|||
import pyrogram
|
||||
|
||||
from datetime import datetime
|
||||
from pyrogram import enums, raw, types, utils
|
||||
from typing import BinaryIO, Callable, List, Optional, Union
|
||||
from pyrogram import raw, types, utils
|
||||
from typing import Union
|
||||
from ..object import Object
|
||||
from ..update import Update
|
||||
|
||||
|
|
@ -47,8 +47,6 @@ class StorySkipped(Object, Update):
|
|||
True, if the Story is shared with close_friends only.
|
||||
"""
|
||||
|
||||
# TODO: Add Privacy
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
|
|
@ -63,6 +61,8 @@ class StorySkipped(Object, Update):
|
|||
super().__init__(client)
|
||||
|
||||
self.id = id
|
||||
self.from_user = from_user
|
||||
self.sender_chat = sender_chat
|
||||
self.date = date
|
||||
self.expire_date = expire_date
|
||||
self.close_friends = close_friends
|
||||
|
|
@ -87,5 +87,6 @@ class StorySkipped(Object, Update):
|
|||
sender_chat=sender_chat,
|
||||
date=utils.timestamp_to_datetime(stories.date),
|
||||
expire_date=utils.timestamp_to_datetime(stories.expire_date),
|
||||
close_friends=stories.close_friends
|
||||
close_friends=stories.close_friends,
|
||||
client=client
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue