1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-26 21:14:19 +00:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
Steffo 2021-03-02 02:35:53 +01:00
commit 69d7c88e5c
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -94,6 +94,12 @@ class Message(Bullet, metaclass=abc.ABCMeta):
""" """
raise exc.NotSupportedError() raise exc.NotSupportedError()
@ap.async_cached_property
async def reactions(self) -> t.List[ReactionButton]:
"""
:return: A :class:`list` of reaction buttons attached to the message.
"""
async def reply(self, *, async def reply(self, *,
text: str = None, text: str = None,
files: t.List[t.BinaryIO] = None) -> t.Optional[Message]: files: t.List[t.BinaryIO] = None) -> t.Optional[Message]:
@ -179,9 +185,75 @@ class User(Bullet, metaclass=abc.ABCMeta):
raise exc.NotSupportedError() raise exc.NotSupportedError()
class Button(Bullet, metaclass=abc.ABCMeta):
"""
An abstract class representing a clickable button.
"""
@ap.async_cached_property
async def text(self) -> t.Optional[str]:
"""
:return: The text displayed on the button.
"""
raise exc.NotSupportedError()
class ReactionButton(Button, metaclass=abc.ABCMeta):
"""
An abstract class representing a clickable reaction to a message.
"""
@ap.async_property
async def reactions(self) -> t.List[Reaction]:
"""
:return: The list of reactions generated by this button. It may vary every time this property is accessed,
based on the users who have reacted to the button at the time of access.
"""
raise exc.NotSupportedError()
@ap.async_property
async def count(self) -> int:
"""
:return: The count of reactions that this button generated. It may vary every time this property is accessed,
based on how many users have reacted to the button at the time of access.
"""
raise exc.NotSupportedError()
@ap.async_cached_property
async def message(self) -> t.Optional[Message]:
"""
:return: The message this button is attached to. Can be :data:`None`, if the button hasn't been attached to a
message yet.
"""
raise exc.NotSupportedError()
class Reaction(Bullet, metaclass=abc.ABCMeta):
"""
An abstract class representing a reaction of a single user to a message, generated by clicking on a ReactionButton.
"""
@ap.async_cached_property
async def user(self) -> User:
"""
:return: The user who reacted to the message.
"""
raise exc.NotSupportedError()
@ap.async_cached_property
async def button(self) -> ReactionButton:
"""
:return: The ReactionButton that the user pressed to generate this reaction.
"""
raise exc.NotSupportedError()
__all__ = ( __all__ = (
"Bullet", "Bullet",
"Message", "Message",
"Channel", "Channel",
"User", "User",
"Button",
"ReactionButton",
"Reaction",
) )