mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 01:16:35 +03:00
Add events.Raw
This commit is contained in:
parent
44aed4cadb
commit
b8d656efa5
|
@ -1,10 +1,11 @@
|
|||
from .event import Continue, Event
|
||||
from .event import Continue, Event, Raw
|
||||
from .messages import MessageDeleted, MessageEdited, MessageRead, NewMessage
|
||||
from .queries import ButtonCallback, InlineQuery
|
||||
|
||||
__all__ = [
|
||||
"Continue",
|
||||
"Event",
|
||||
"Raw",
|
||||
"MessageDeleted",
|
||||
"MessageEdited",
|
||||
"MessageRead",
|
||||
|
|
|
@ -30,6 +30,34 @@ class Event(metaclass=NoPublicConstructor):
|
|||
pass
|
||||
|
||||
|
||||
class Raw(Event):
|
||||
"""
|
||||
Raw update type received from Telegram.
|
||||
|
||||
This event occurs when *any* update is received.
|
||||
|
||||
Like every other event, the raw update type is under the private member ``event._raw``.
|
||||
|
||||
Additionally, all peers received along with this update are present under ``self._chat_map``.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
client: Client,
|
||||
update: abcs.Update,
|
||||
chat_map: dict[int, Peer],
|
||||
):
|
||||
self._client = client
|
||||
self._raw = update
|
||||
self._chat_map = chat_map
|
||||
|
||||
@classmethod
|
||||
def _try_from_update(
|
||||
cls, client: Client, update: abcs.Update, chat_map: dict[int, Peer]
|
||||
) -> Optional[Self]:
|
||||
return cls._create(client, update, chat_map)
|
||||
|
||||
|
||||
class Continue:
|
||||
"""
|
||||
This is **not** an event type you can listen to.
|
||||
|
|
|
@ -5,6 +5,7 @@ Classes related to the different event types that wrap incoming Telegram updates
|
|||
|
||||
The :doc:`/concepts/updates` concept to learn how to listen to these events.
|
||||
"""
|
||||
|
||||
from .._impl.client.events import (
|
||||
ButtonCallback,
|
||||
Continue,
|
||||
|
@ -14,6 +15,7 @@ from .._impl.client.events import (
|
|||
MessageEdited,
|
||||
MessageRead,
|
||||
NewMessage,
|
||||
Raw,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
|
@ -25,4 +27,5 @@ __all__ = [
|
|||
"MessageEdited",
|
||||
"MessageRead",
|
||||
"NewMessage",
|
||||
"Raw",
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue
Block a user