1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00
royalnet/royalnet_discordpy/bullet/projectiles.py

54 lines
1.3 KiB
Python
Raw Normal View History

2021-04-26 02:39:14 +00:00
from __future__ import annotations
import async_property as ap
2021-04-26 02:39:14 +00:00
import discord as d
import royalnet.engineer as engi
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",
)