From 7cb4e783f760f4165709800310bea9cf8f2aee76 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 19 May 2020 18:02:21 +0200 Subject: [PATCH] Implement reply_image for Discord serfs --- royalnet/serf/discord/discordserf.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/royalnet/serf/discord/discordserf.py b/royalnet/serf/discord/discordserf.py index b87e5290..c33a338e 100644 --- a/royalnet/serf/discord/discordserf.py +++ b/royalnet/serf/discord/discordserf.py @@ -1,6 +1,7 @@ import asyncio as aio import logging import warnings +import io from typing import * import royalnet.backpack.tables as rbt import royalnet.commands as rc @@ -77,6 +78,9 @@ class DiscordSerf(Serf): async def reply(data, text: str): await data.message.channel.send(escape(text)) + async def reply_image(data, image: io.IOBase, caption: str) -> None: + await data.message.channel.send(file=discord.File(image, 'image')) + async def get_author(data, error_if_none=False): user: "discord.Member" = data.message.author query = data.session.query(self.master_table)