1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 21:44:21 +00:00
royalnet/royalnet_telethon/bullet/projectiles/message.py

51 lines
1.2 KiB
Python
Raw Normal View History

2021-04-03 15:48:07 +00:00
from __future__ import annotations
from ._imports import *
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",
)