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.126.135]) by gnuweeb.org (Postfix) with ESMTPSA id 1BD967E3B8; Tue, 3 Jan 2023 06:37:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1672727836; bh=sW9GlGLQdcphandhjAlh42Pe8NgWPL3JDjtaT0hjTyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vo5IPQos7V51gA7RTNz07L8yeQjleL6Iv80CnEQXWGgMKlYzytlR3V45wktVLNf2L YwhhvcvzhsKGUtoaWqgj+vfZh1jslu8oYgw0RFlWdDjkMcFEnKps2apa3Txpt6UU58 KeKeuWSe5xD9BndV8JuImw2NptJbSW8D+OPBN4zk8R/uz3z5aXCqFdWo4OzEAdxUPo AoCBSHLBDyIcyycRdhkeaj31LuSZFerqtwbNNHJGF5Wjef4ifRrfbR/gyRLQQZ1oBz 1MHiFXoxKg/VNN0zijygvosjetg0SQUIWaJbfFuBD9SxQVZTFYpb70w8SQiWU5UhxZ yeurVoM7NaEVg== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v1 07/13] feat(discord): add report_err() for the Discord bot Date: Tue, 3 Jan 2023 13:36:35 +0700 Message-Id: <20230103063641.1680-8-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20230103063641.1680-1-kiizuha@gnuweeb.org> References: <20230103063641.1680-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Added report_err() in the Discord bot GWClient() class for reporting error to the Discord channel. Signed-off-by: Muhammad Rizki --- daemon/dscord/gnuweeb/client.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/daemon/dscord/gnuweeb/client.py b/daemon/dscord/gnuweeb/client.py index 406c606..563d073 100644 --- a/daemon/dscord/gnuweeb/client.py +++ b/daemon/dscord/gnuweeb/client.py @@ -40,6 +40,14 @@ class GWClient(commands.Bot): ) + async def report_err(self, caption): + if not caption: + caption = "No lore URL" + exc_str = utils.catch_err() + self.logger.warning(exc_str) + await self.send_log_file(caption) + + @filters.wait_on_limit async def send_log_file(self, caption: str): filename = self.logger.handlers[0].baseFilename -- Muhammad Rizki