From 2d915d59afceca9fe724553838e6f183dbbb4795 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 8 Jan 2021 16:15:34 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20support=20for=20sending/recei?= =?UTF-8?q?ving=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- royalnet/engineer/bullet.py | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/royalnet/engineer/bullet.py b/royalnet/engineer/bullet.py index c3e9aedf..2aa02156 100644 --- a/royalnet/engineer/bullet.py +++ b/royalnet/engineer/bullet.py @@ -78,11 +78,22 @@ class Message(Bullet, metaclass=abc.ABCMeta): """ raise exc.NotSupportedError() - async def send_reply(self, text: str) -> t.Optional[Message]: + async def files(self) -> t.Optional[t.List[t.BinaryIO]]: """ - Send a reply to this message in the same channel. + :return: A :class:`list` of files attached to the message. + """ + raise exc.NotSupportedError() + + async def send_reply(self, *, + text: str = None, + files: t.List[t.BinaryIO]) -> t.Optional[Message]: + """ + Reply to this message in the same channel it was sent in. :param text: The text to reply with. + :param files: A :class:`list` of files to attach to the message. The file type should be detected automatically + by the frontend, and sent in the best format possible (if all files are photos, they should be + sent as a photo album, etc.). :return: The sent reply message. """ raise exc.NotSupportedError() @@ -111,11 +122,16 @@ class Channel(Bullet, metaclass=abc.ABCMeta): """ raise exc.NotSupportedError() - async def send_message(self, text: str) -> t.Optional[Message]: + async def send_message(self, *, + text: str = None, + files: t.List[t.BinaryIO]) -> t.Optional[Message]: """ Send a message in the channel. :param text: The text to send in the message. + :param files: A :class:`list` of files to attach to the message. The file type should be detected automatically + by the frontend, and sent in the best format possible (if all files are photos, they should be + sent as a photo album, etc.). :return: The sent message. """ raise exc.NotSupportedError() @@ -139,11 +155,16 @@ class User(Bullet, metaclass=abc.ABCMeta): """ raise exc.NotSupportedError() - async def send_message(self, text: str) -> t.Optional[Message]: + async def send_message(self, *, + text: str = None, + files: t.List[t.BinaryIO]) -> t.Optional[Message]: """ Send a private message to the user. :param text: The text to send in the message. + :param files: A :class:`list` of files to attach to the message. The file type should be detected automatically + by the frontend, and sent in the best format possible (if all files are photos, they should be + sent as a photo album, etc.). :return: The sent message. """ raise exc.NotSupportedError()