mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
51 lines
1.2 KiB
Python
51 lines
1.2 KiB
Python
|
from __future__ import annotations
|
||
|
from ._imports import *
|
||
|
|
||
|
from ..contents.__init__ import TelegramMessage
|
||
|
|
||
|
|
||
|
class TelegramMessageReceived(p.MessageReceived):
|
||
|
def __init__(self, event: tlc.Message):
|
||
|
super().__init__()
|
||
|
self.event: tlc.Message = event
|
||
|
|
||
|
def __hash__(self) -> int:
|
||
|
return self.event.id
|
||
|
|
||
|
@ap.async_cached_property
|
||
|
async def message(self) -> TelegramMessage:
|
||
|
return TelegramMessage(msg=self.event)
|
||
|
|
||
|
|
||
|
class TelegramMessageEdited(p.MessageEdited):
|
||
|
def __init__(self, event: tlc.Message):
|
||
|
super().__init__()
|
||
|
self.event: tlc.Message = event
|
||
|
|
||
|
def __hash__(self) -> int:
|
||
|
return self.event.id
|
||
|
|
||
|
@ap.async_cached_property
|
||
|
async def message(self) -> TelegramMessage:
|
||
|
return TelegramMessage(msg=self.event)
|
||
|
|
||
|
|
||
|
class TelegramMessageDeleted(p.MessageDeleted):
|
||
|
def __init__(self, event: tlc.Message):
|
||
|
super().__init__()
|
||
|
self.event: tlc.Message = event
|
||
|
|
||
|
def __hash__(self) -> int:
|
||
|
return self.event.id
|
||
|
|
||
|
@ap.async_cached_property
|
||
|
async def message(self) -> TelegramMessage:
|
||
|
return TelegramMessage(msg=self.event)
|
||
|
|
||
|
|
||
|
__all__ = (
|
||
|
"TelegramMessageReceived",
|
||
|
"TelegramMessageEdited",
|
||
|
"TelegramMessageDeleted",
|
||
|
)
|