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 autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [101.128.125.209]) by gnuweeb.org (Postfix) with ESMTPSA id 4436B8194D; Mon, 19 Dec 2022 23:52:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1671493970; bh=WnV+XcX0W3Ra0H5MKEDMLeWwZAtGaogaJYjgC6C4QPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TXv+N/xRwQ/3iMUll6tH8zULbTMLYQROLP6W3K7jbkaUfy5W1MBABFzx17BuSeTmz 5gqSv6azE/ym/5H0gvhijMehKLDHv3VLKBPAsqxOkaqisoz13IZ9DY4eSf1UiBzebF mXYwxDBxlvbRakEQxXSCSS7m3RdkOWJuJO/A4tE1w9KFsDv9+27omlrVQb7IUF1vXR o2pEI7Wm1ppF/BFgWe2GwdQnfHNNDApqs8/HouoMdBdK3HlAXmCzLJ8waCVFw/mvy3 BfQRl2Iu+GKTQ2EVHL6YMMCIRQJwZVDP9Pe2Y0mwRiOZJHAj0v3wkvsDQRcaSOr7k8 EPn0ub9naTIqQ== From: Muhammad Rizki To: Cc: Muhammad Rizki , Alviro Iskandar Setiawan , Ammar Faizi , GNU/Weeb Mailing List Subject: [PATCH 02/28] discord: Add send_patch_mail_interaction() Date: Tue, 20 Dec 2022 06:52:00 +0700 Message-Id: <20221219235226.1567-2-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221219235226.1567-1-kiizuha@gnuweeb.org> References: <20221219235226.1567-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 Link: https://lore.gnuweeb.org/gwml/20221022065149.865-3-kiizuha@gnuweeb.org Cc: Alviro Iskandar Setiawan Cc: Ammar Faizi Cc: GNU/Weeb Mailing List Signed-off-by: Ammar Faizi --- 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 -- 2.34.1.windows.1