From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [101.128.125.123]) by gnuweeb.org (Postfix) with ESMTPSA id CE1D481101; Thu, 20 Oct 2022 08:39:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1666255145; bh=ADnsF+F/GbI9qd7rjBeB6lUgxfJbN3FHfDWDR9IjAso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AXmmT3wKN5BwLsEaEsKM7ZCWoqvn04BKQMLCrvylvXcZtZP8ohJ0k/1UiT56iYyXG xub/Z/qARiJt2ZelpC1zr385e7pXMW2ot6l2d4TXY+6r96V89guN/4WMNBD+/0/zSN VaCR9wAUu/uemSD1SI7VHDqNDBhGw7FOIw7a96WPeqQIY2alzOWhhVmzXJTsGYu4ya 0qKzLq5Qi/dxflBedLe2V3Pp3t6yslW63CqzMrGMFaPrZ2cKjPHDMdPa1FMk3Uq8fs Dw8CEIvo+gq3oCr/rGK23fuikKTMA3b3dHZG0AK6Kpf0z22Wul/l6Bc4MdhXAWxnQa syuorXGhijytg== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v2 2/8] discord: Add send_patch_mail_interaction() Date: Thu, 20 Oct 2022 15:38:39 +0700 Message-Id: <20221020083845.907-3-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221020083845.907-1-kiizuha@gnuweeb.org> References: <20221020083845.907-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This function is just the same as send_text_mail_interaction(), the different between them is send_patch_mail_interaction() for sending a lore email message with patch file attachment. Signed-off-by: Muhammad Rizki --- daemon/dscord/gnuweeb/client.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/daemon/dscord/gnuweeb/client.py b/daemon/dscord/gnuweeb/client.py index 15a6eee..b921f7d 100644 --- a/daemon/dscord/gnuweeb/client.py +++ b/daemon/dscord/gnuweeb/client.py @@ -85,3 +85,17 @@ class GWClient(commands.Bot): content=text, view=models.FullMessageBtn(url) ) + + + async def send_patch_mail_interaction(self, mail, i: "Interaction", + text: str, url: str = None): + tmp, doc, caption, url = utils.prepare_patch( + mail, text, url, "discord" + ) + m = await i.response.send_message( + content=caption, + file=discord.File(doc), + view=models.FullMessageBtn(url) + ) + utils.remove_patch(tmp) + return m -- Muhammad Rizki