2021-04-03 15:48:07 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2022-03-06 16:48:16 +00:00
|
|
|
from ._imports import *
|
2021-04-03 15:48:07 +00:00
|
|
|
from ..contents.__init__ import TelegramMessage
|
|
|
|
|
|
|
|
|
|
|
|
class TelegramMessageReceived(p.MessageReceived):
|
|
|
|
def __init__(self, event: tlc.Message):
|
|
|
|
super().__init__()
|
2021-04-03 17:10:38 +00:00
|
|
|
self._event: tlc.Message = event
|
2021-04-03 15:48:07 +00:00
|
|
|
|
|
|
|
def __hash__(self) -> int:
|
2021-04-03 17:10:38 +00:00
|
|
|
return self._event.id
|
2021-04-03 15:48:07 +00:00
|
|
|
|
|
|
|
@ap.async_cached_property
|
|
|
|
async def message(self) -> TelegramMessage:
|
2021-04-03 17:10:38 +00:00
|
|
|
return TelegramMessage(msg=self._event)
|
2021-04-03 15:48:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TelegramMessageEdited(p.MessageEdited):
|
|
|
|
def __init__(self, event: tlc.Message):
|
|
|
|
super().__init__()
|
2021-04-03 17:10:38 +00:00
|
|
|
self._event: tlc.Message = event
|
2021-04-03 15:48:07 +00:00
|
|
|
|
|
|
|
def __hash__(self) -> int:
|
2021-04-03 17:10:38 +00:00
|
|
|
return self._event.id
|
2021-04-03 15:48:07 +00:00
|
|
|
|
|
|
|
@ap.async_cached_property
|
|
|
|
async def message(self) -> TelegramMessage:
|
2021-04-03 17:10:38 +00:00
|
|
|
return TelegramMessage(msg=self._event)
|
2021-04-03 15:48:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TelegramMessageDeleted(p.MessageDeleted):
|
|
|
|
def __init__(self, event: tlc.Message):
|
|
|
|
super().__init__()
|
2021-04-03 17:10:38 +00:00
|
|
|
self._event: tlc.Message = event
|
2021-04-03 15:48:07 +00:00
|
|
|
|
|
|
|
def __hash__(self) -> int:
|
2021-04-03 17:10:38 +00:00
|
|
|
return self._event.id
|
2021-04-03 15:48:07 +00:00
|
|
|
|
|
|
|
@ap.async_cached_property
|
|
|
|
async def message(self) -> TelegramMessage:
|
2021-04-03 17:10:38 +00:00
|
|
|
return TelegramMessage(msg=self._event)
|
2021-04-03 15:48:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
__all__ = (
|
|
|
|
"TelegramMessageReceived",
|
|
|
|
"TelegramMessageEdited",
|
|
|
|
"TelegramMessageDeleted",
|
|
|
|
)
|