mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-24 03:54:20 +00:00
54 lines
1.3 KiB
Python
54 lines
1.3 KiB
Python
|
from __future__ import annotations
|
||
|
|
||
|
import discord as d
|
||
|
import royalnet.engineer as engi
|
||
|
import async_property as ap
|
||
|
|
||
|
from .contents import DiscordMessage
|
||
|
|
||
|
|
||
|
class DiscordMessageReceived(engi.MessageReceived):
|
||
|
def __init__(self, event: d.Message):
|
||
|
super().__init__()
|
||
|
self._event: d.Message = event
|
||
|
|
||
|
def __hash__(self) -> int:
|
||
|
return self._event.id
|
||
|
|
||
|
@ap.async_cached_property
|
||
|
async def message(self) -> DiscordMessage:
|
||
|
return DiscordMessage(msg=self._event)
|
||
|
|
||
|
|
||
|
class DiscordMessageEdited(engi.MessageEdited):
|
||
|
def __init__(self, event: d.Message):
|
||
|
super().__init__()
|
||
|
self._event: d.Message = event
|
||
|
|
||
|
def __hash__(self) -> int:
|
||
|
return self._event.id
|
||
|
|
||
|
@ap.async_cached_property
|
||
|
async def message(self) -> DiscordMessage:
|
||
|
return DiscordMessage(msg=self._event)
|
||
|
|
||
|
|
||
|
class DiscordMessageDeleted(engi.MessageDeleted):
|
||
|
def __init__(self, event: d.Message):
|
||
|
super().__init__()
|
||
|
self._event: d.Message = event
|
||
|
|
||
|
def __hash__(self) -> int:
|
||
|
return self._event.id
|
||
|
|
||
|
@ap.async_cached_property
|
||
|
async def message(self) -> DiscordMessage:
|
||
|
return DiscordMessage(msg=self._event)
|
||
|
|
||
|
|
||
|
__all__ = (
|
||
|
"DiscordMessageReceived",
|
||
|
"DiscordMessageEdited",
|
||
|
"DiscordMessageDeleted",
|
||
|
)
|