mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-07 15:34:52 +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
|
ChatJoinRequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
async def story_parser(update, _, __):
|
async def story_parser(update, users, chats):
|
||||||
|
print(update)
|
||||||
|
print(update.story)
|
||||||
return (
|
return (
|
||||||
await pyrogram.types.Story._parse(self.client, update.story, update.peer),
|
await pyrogram.types.Story._parse(self.client, update.story, update.peer),
|
||||||
StoryHandler
|
StoryHandler
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,10 @@ class Story(Object, Update):
|
||||||
stories: raw.base.StoryItem,
|
stories: raw.base.StoryItem,
|
||||||
peer: Union["raw.types.PeerChannel", "raw.types.PeerUser"]
|
peer: Union["raw.types.PeerChannel", "raw.types.PeerUser"]
|
||||||
) -> "Story":
|
) -> "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.MessageEntity._parse(client, entity, {}) for entity in stories.entities]
|
||||||
entities = types.List(filter(lambda x: x is not None, entities))
|
entities = types.List(filter(lambda x: x is not None, entities))
|
||||||
animation = None
|
animation = None
|
||||||
|
|
@ -198,12 +201,9 @@ class Story(Object, Update):
|
||||||
selected_contacts=stories.selected_contacts,
|
selected_contacts=stories.selected_contacts,
|
||||||
caption=stories.caption,
|
caption=stories.caption,
|
||||||
caption_entities=entities or None,
|
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(
|
async def reply_text(
|
||||||
self,
|
self,
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,8 @@
|
||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
|
|
||||||
from datetime import datetime
|
from pyrogram import raw, types
|
||||||
from pyrogram import enums, raw, types, utils
|
from typing import Union
|
||||||
from typing import BinaryIO, Callable, List, Optional, Union
|
|
||||||
from ..object import Object
|
from ..object import Object
|
||||||
from ..update import Update
|
from ..update import Update
|
||||||
|
|
||||||
|
|
@ -49,6 +48,8 @@ class StoryDeleted(Object, Update):
|
||||||
super().__init__(client)
|
super().__init__(client)
|
||||||
|
|
||||||
self.id = id
|
self.id = id
|
||||||
|
self.from_user = from_user
|
||||||
|
self.sender_chat = sender_chat
|
||||||
|
|
||||||
async def _parse(
|
async def _parse(
|
||||||
client: "pyrogram.Client",
|
client: "pyrogram.Client",
|
||||||
|
|
@ -67,5 +68,6 @@ class StoryDeleted(Object, Update):
|
||||||
return StoryDeleted(
|
return StoryDeleted(
|
||||||
id=stories.id,
|
id=stories.id,
|
||||||
from_user=from_user,
|
from_user=from_user,
|
||||||
sender_chat=sender_chat
|
sender_chat=sender_chat,
|
||||||
|
client=client
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
import pyrogram
|
import pyrogram
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pyrogram import enums, raw, types, utils
|
from pyrogram import raw, types, utils
|
||||||
from typing import BinaryIO, Callable, List, Optional, Union
|
from typing import Union
|
||||||
from ..object import Object
|
from ..object import Object
|
||||||
from ..update import Update
|
from ..update import Update
|
||||||
|
|
||||||
|
|
@ -47,8 +47,6 @@ class StorySkipped(Object, Update):
|
||||||
True, if the Story is shared with close_friends only.
|
True, if the Story is shared with close_friends only.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# TODO: Add Privacy
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
|
|
@ -63,6 +61,8 @@ class StorySkipped(Object, Update):
|
||||||
super().__init__(client)
|
super().__init__(client)
|
||||||
|
|
||||||
self.id = id
|
self.id = id
|
||||||
|
self.from_user = from_user
|
||||||
|
self.sender_chat = sender_chat
|
||||||
self.date = date
|
self.date = date
|
||||||
self.expire_date = expire_date
|
self.expire_date = expire_date
|
||||||
self.close_friends = close_friends
|
self.close_friends = close_friends
|
||||||
|
|
@ -87,5 +87,6 @@ class StorySkipped(Object, Update):
|
||||||
sender_chat=sender_chat,
|
sender_chat=sender_chat,
|
||||||
date=utils.timestamp_to_datetime(stories.date),
|
date=utils.timestamp_to_datetime(stories.date),
|
||||||
expire_date=utils.timestamp_to_datetime(stories.expire_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