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.87]) by gnuweeb.org (Postfix) with ESMTPSA id 4CFB78104C; Tue, 18 Oct 2022 08:17:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1666081056; bh=ADnsF+F/GbI9qd7rjBeB6lUgxfJbN3FHfDWDR9IjAso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VqB9dieLFexFMDXEar8ItzBK6sNaaUg3byWI6DUAq5Fz4tJDKIgbxeXhgC0iVNeDq 5Nocu7K+JP8TIYGRo5+6Ek+3HUPQAKJnnlKuLFmB3Lb19J1bA/7KBo/24vaexOMiXp HJBlDTXsnDxtb66iPbfOf8ebo4zroBLpcUxVd4tW/RwUTZq6L0hEOGdXeDZlz7mkSO 70mPoj/4DV0aQzqqDao29IHqDvPTk77SpsSx1pMMWhRr2M+IffbLV2gXppvdXICrv7 Oa76kiCkHCCwGQVAxTKQWonlniFNy/t9bnx4uE7NVvFu2074uop0DTPrBsqX1yB+B7 Uw/DGYMq/wMJA== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v1 2/7] discord: Add send_patch_mail_interaction() Date: Tue, 18 Oct 2022 15:16:30 +0700 Message-Id: <20221018081635.1617-3-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221018081635.1617-1-kiizuha@gnuweeb.org> References: <20221018081635.1617-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