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.125.209]) by gnuweeb.org (Postfix) with ESMTPSA id A31578194B; Wed, 21 Dec 2022 01:34:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1671586475; bh=syXM1KPgDx2LT06U3lpj1L9ccd0nWp8Tu1x82VQbq7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S80INWNnu7xVpkr97hD5AZeHueTe/Z0F/fLDLJE0jfRq/QKoT/K9Q7LFj8d8IDAfK qEbmuNFG3nAecJ0s+hP7oaJ6eJuOMy6r+sdanYwUsp9ZPVJFm/HBUQz05Mvr+XFKsv /RnVc8wbbzLjFsFwGiNeDC2PxJZIkFRDheNMPdPpujMYIq1sodWcG4RuRxUutnZv/A emiDF3+79DmV1s4OEJYKifLbkKbOveC37dkXuuN9ZKkqbvr1ndlPTbK2sqcb+p+X4p 3jld96yKftUHFaOtD0K73QDv9L2M+DNIc2rKcQkJtM5rpSbBUKthA/y1B2PonwbNj1 cLXfCAhuhGC5g== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v4 11/17] telegram: Add send_log_file() in the DaemonClient() Date: Wed, 21 Dec 2022 08:33:41 +0700 Message-Id: <20221221013347.1704-12-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221221013347.1704-1-kiizuha@gnuweeb.org> References: <20221221013347.1704-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