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 kanazawa.. (unknown [101.128.126.198]) by gnuweeb.org (Postfix) with ESMTPSA id 0AD098149A; Fri, 4 Nov 2022 18:10:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1667585405; bh=syXM1KPgDx2LT06U3lpj1L9ccd0nWp8Tu1x82VQbq7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iqcmlHz+tOaw4XLZw4A7IlgbgPMXDl35RaFkQS70CzjPQcLS5XRmq2zb7oLGVnA/3 dvgOwXszrBlyMHxTUArZRjMRmJcWAUmDvm+85tbfHKADu6KOtx+SmGuEk9APHrm38E xS28vvg5Ukfn536RZ+yVM/FGI2ySlx5XHkjU4T9+MtVevpSyLSBJOW0FlxWcMMUwrA EtFF69r6e60Gc2qTk+euaLsRMjJdKrW3ekXMNO/f6y4+QheIZZBuArgnn9x1PGNzPn soLtlfHc+mzG2SvJkz6Qznr/fxPfimKCc2EYczYj5NSk9qb9wSdqc90zpXYnVBgwb8 F645oRRLqmVJg== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v1 10/16] telegram: Add send_log_file() in the DaemonClient() Date: Sat, 5 Nov 2022 01:09:18 +0700 Message-Id: <20221104180931.3852-12-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221104180931.3852-1-kiizuha@gnuweeb.org> References: <20221104180931.3852-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