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 621958194D; Mon, 19 Dec 2022 23:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1671494289; bh=syXM1KPgDx2LT06U3lpj1L9ccd0nWp8Tu1x82VQbq7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bkNXw/uMEoato2vkD4CJ0qQcpwoOoQI580ZMNnzVC9PRmSzceLtRLPOJu3AoWrYA0 rjmcFdpHaiCDtU1jROWPRAxB+wgitcj+B4RI+6bXfOYvij+Ed/H6NLsS8KoLznpaWV W86rd6qlHrPqpIqKfXzxn24BvuZPhKz8YDruVSPslxHfJzSQ+0Fr0JUY2MxQpjJYzt 3ZFBuS0psjxjFX+Dgn++N/MfTniJarGLpkl9qSVGILT1IOxmjfNgtj0oyVVv/ql7xj 1m2lO5UPdh640s7psQPDGzzuq8A2AQaibEbb634X7H5CSKMlqZK92T9wyA8zj8RhuF KvX8ZkOrw4GKg== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v3 11/17] telegram: Add send_log_file() in the DaemonClient() Date: Tue, 20 Dec 2022 06:57:15 +0700 Message-Id: <20221219235721.126-12-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221219235721.126-1-kiizuha@gnuweeb.org> References: <20221219235721.126-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Add send_log_file() to the DaemonClient() class. Signed-off-by: Muhammad Rizki --- daemon/telegram/packages/client.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/daemon/telegram/packages/client.py b/daemon/telegram/packages/client.py index eb282eb..6c83a5a 100644 --- a/daemon/telegram/packages/client.py +++ b/daemon/telegram/packages/client.py @@ -11,6 +11,7 @@ from email.message import Message from atom import utils from enums import Platform from logger import BotLogger +from telegram import config from telegram.database import DB from .decorator import handle_flood @@ -26,6 +27,16 @@ class DaemonClient(Client): self.logger = logger + @handle_flood + async def send_log_file(self, caption: str): + filename = self.logger.handlers[0].baseFilename + await self.send_document( + config.LOG_CHANNEL_ID, + filename, + caption=caption + ) + + @handle_flood async def send_text_email( self, -- Muhammad Rizki