1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-30 15:04:18 +00:00
royalnet/royalnet_discordpy/bullet/projectiles.py
2021-04-26 04:39:14 +02:00

53 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",
)