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.112.71]) by gnuweeb.org (Postfix) with ESMTPSA id 5081981946; Tue, 17 Jan 2023 22:13:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1673993591; bh=SWJukrGYeIYEeUXOkntDa0Ep3kLU/YGNV9umuZ6gZXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UK4ITd1QP5UlGR6ZLkCuB7AJhX79rIutepkxu4EQpl0mPdf9ejWoCp4WlkRFQjYTQ e/LaWbxBWu/NhQ93pXrUbPicpCMEDVcFSzn4/Bjrd2Sa6PW4tozXUiz7cbUHe9Pen/ LskFYDjcxZFc1iZSqs1XQFWhvb5yh+UDOHobX7jyK1/lm6AKh6UMqhTj44sWzRJv3G e+fZg/d+O7w70sSj0EUeJvGfQqN2+fuW6RXdLhlZnUDcLtRfOV65KTvOIbhrykEkWy 0/7M3e4CgdETW3H8wWn+JuYuOfMkGfxKB3yJgwZGkRhmwKwd+FPkWURBsFScLtwFks RYBfe/hSMi5FQ== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v1 14/15] discord: Implement DaemonException and report_err in get_lore_mail.py Date: Wed, 18 Jan 2023 05:12:15 +0700 Message-Id: <20230117221216.1783-15-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20230117221216.1783-1-kiizuha@gnuweeb.org> References: <20230117221216.1783-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: In the last series, I didn't care so much to look into the Discord's get_lore_mail.py slash command. I've implemented them same as in the listener.py. Signed-off-by: Muhammad Rizki --- .../gnuweeb/plugins/slash_commands/get_lore_mail.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/daemon/dscord/gnuweeb/plugins/slash_commands/get_lore_mail.py b/daemon/dscord/gnuweeb/plugins/slash_commands/get_lore_mail.py index 56330f3..84dca83 100644 --- a/daemon/dscord/gnuweeb/plugins/slash_commands/get_lore_mail.py +++ b/daemon/dscord/gnuweeb/plugins/slash_commands/get_lore_mail.py @@ -10,6 +10,7 @@ from discord import app_commands from atom import utils from atom import Scraper from enums import Platform +from exceptions import DaemonException class GetLoreSC(commands.Cog): @@ -29,9 +30,11 @@ class GetLoreSC(commands.Cog): mail = await s.get_email_from_url(url) text, _, is_patch = utils.create_template(mail, Platform.DISCORD) except: - exc_str = utils.catch_err() - self.bot.logger.warning(exc_str) - await self.bot.send_log_file(url) + e = DaemonException() + e.set_thread_url(url) + e.set_message(utils.catch_err()) + await self.bot.report_err(e) + return if is_patch: m = await self.bot.send_patch_mail_interaction( -- Muhammad Rizki