Add Messages.parse_delete method
This commit is contained in:
parent
6a0a271d24
commit
2a1a6301a6
@ -19,6 +19,7 @@
|
|||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .message import Message
|
from .message import Message
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..pyrogram_type import PyrogramType
|
||||||
|
from ..user_and_chats import Chat
|
||||||
|
|
||||||
|
|
||||||
class Messages(PyrogramType):
|
class Messages(PyrogramType):
|
||||||
@ -49,3 +50,32 @@ class Messages(PyrogramType):
|
|||||||
client=client,
|
client=client,
|
||||||
raw=messages
|
raw=messages
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def parse_deleted(client, update) -> "Messages":
|
||||||
|
messages = update.messages
|
||||||
|
channel_id = getattr(update, "channel_id", None)
|
||||||
|
|
||||||
|
parsed_messages = []
|
||||||
|
|
||||||
|
for message in messages:
|
||||||
|
parsed_messages.append(
|
||||||
|
Message(
|
||||||
|
message_id=message,
|
||||||
|
chat=Chat(
|
||||||
|
id=int("-100" + str(channel_id)),
|
||||||
|
type="channel",
|
||||||
|
client=client,
|
||||||
|
raw=None
|
||||||
|
) if channel_id is not None else None,
|
||||||
|
client=client,
|
||||||
|
raw=None
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
return Messages(
|
||||||
|
total_count=len(parsed_messages),
|
||||||
|
messages=parsed_messages,
|
||||||
|
client=client,
|
||||||
|
raw=update
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user