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 [175.158.50.43]) by gnuweeb.org (Postfix) with ESMTPSA id B26B381A24; Wed, 18 Jan 2023 17:54:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1674064485; bh=SWJukrGYeIYEeUXOkntDa0Ep3kLU/YGNV9umuZ6gZXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q+ALMS1VEMqA2szwkXgZzJRM+rMSe5wN3Nma9zr/z/Z7s2Ur7V+HVeyUF40JbLX4U fw8T7i87OD8dUWI+zzkmt9P6burES8GHNB+XqpSTYTt6ZeU7vDnjbzqKVxIhIuwfl7 64YpRfN9x6Ym9mQYffTIQAJ3iZyj5R1SWx/NgMUwEsdQVwtCft3+IJa61g+weswENF 6Vq0TB+lqC35CSdWz6nv0kG2lklxUGJv+gwm/Oy6rpwa/BFCttv/qWkeqzO4vZJT/p SenGPwki9odKG5rz8uSJgB9KEAWoYXM6XP1f55sy4inyHaoWYVM4w3pgTtEm5Wp+cj NY9oaI2n9YpQw== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v2 14/17] discord: Implement DaemonException and report_err in get_lore_mail.py Date: Thu, 19 Jan 2023 00:53:53 +0700 Message-Id: <20230118175356.1853-15-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20230118175356.1853-1-kiizuha@gnuweeb.org> References: <20230118175356.1853-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