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.100]) by gnuweeb.org (Postfix) with ESMTPSA id D108E80908; Sun, 11 Sep 2022 10:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1662892438; bh=rtH8UCsQvJTkREVa3gkTlx958qs/EfsoGx9UoJPfHYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BL3t9YJvR0klZ8qFtEqgSxEzHCN1ahFkcGvS/v6bOWsFbL71ZdRD299qGoxLf2l8r 3cmm8yMIIc6tyZWETAVgX+Rv4zLB3mrDwe09DK0fRaP+FJqt5u0wwWSBNcwW+Cow1T 1jmqYu2QQawWj25jg5wjUzgzGCf8rFPRDFCiEws9xbvPkbF8PWFF4pSAehjAJXxGMu IyRrkny+njOv2gNqjt14GAo2gPtsyLKhqjUzlkpTPVWkKTSgzPLSjU98wMkKmZN1k2 wNwTaU7bMmNbWVV5AQ6bKSU91NYvibWsDpX6Sk1RR+fLOTNFxDi/1LCxeWjJ3nnFiO mIp0pqeFea6Hw== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [RFC PATCH v1 07/17] Move scraper and utility file Date: Sun, 11 Sep 2022 17:33:13 +0700 Message-Id: <20220911103323.1949-8-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20220911103323.1949-1-kiizuha@gnuweeb.org> References: <20220911103323.1949-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: I want to move these files to the daemon/atom to make it reusable in future use, because there will be a Discord bot. Affected codes are changed too for imports Signed-off-by: Muhammad Rizki --- daemon/atom/__init__.py | 8 ++++++++ daemon/{telegram/mailer => atom}/scraper.py | 0 daemon/{telegram/mailer => atom}/utils.py | 0 daemon/telegram/mailer/__init__.py | 1 - daemon/telegram/mailer/listener.py | 4 ++-- daemon/telegram/packages/client.py | 2 +- daemon/telegram/packages/plugins/callbacks/del_atom.py | 2 +- daemon/telegram/packages/plugins/callbacks/del_chat.py | 2 +- daemon/telegram/packages/plugins/commands/manage_atom.py | 2 +- .../packages/plugins/commands/manage_broadcast.py | 2 +- daemon/telegram/packages/plugins/commands/scrape.py | 4 ++-- daemon/tg.py | 6 +++--- 12 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 daemon/atom/__init__.py rename daemon/{telegram/mailer => atom}/scraper.py (100%) rename daemon/{telegram/mailer => atom}/utils.py (100%) diff --git a/daemon/atom/__init__.py b/daemon/atom/__init__.py new file mode 100644 index 0000000..423d775 --- /dev/null +++ b/daemon/atom/__init__.py @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 Muhammad Rizki +# Copyright (C) 2022 Ammar Faizi +# + +from .scraper import Scraper +from . import utils diff --git a/daemon/telegram/mailer/scraper.py b/daemon/atom/scraper.py similarity index 100% rename from daemon/telegram/mailer/scraper.py rename to daemon/atom/scraper.py diff --git a/daemon/telegram/mailer/utils.py b/daemon/atom/utils.py similarity index 100% rename from daemon/telegram/mailer/utils.py rename to daemon/atom/utils.py diff --git a/daemon/telegram/mailer/__init__.py b/daemon/telegram/mailer/__init__.py index 75f27df..95cbe96 100644 --- a/daemon/telegram/mailer/__init__.py +++ b/daemon/telegram/mailer/__init__.py @@ -4,6 +4,5 @@ # Copyright (C) 2022 Ammar Faizi # -from .scraper import Scraper from .listener import BotMutexes from .listener import Bot diff --git a/daemon/telegram/mailer/listener.py b/daemon/telegram/mailer/listener.py index f92ae1d..decf85f 100644 --- a/daemon/telegram/mailer/listener.py +++ b/daemon/telegram/mailer/listener.py @@ -7,8 +7,8 @@ from pyrogram.types import Message from apscheduler.schedulers.asyncio import AsyncIOScheduler from telegram.packages import DaemonClient -from . import Scraper -from . import utils +from atom import Scraper +from atom import utils import asyncio import shutil import re diff --git a/daemon/telegram/packages/client.py b/daemon/telegram/packages/client.py index 950665b..4f9c596 100644 --- a/daemon/telegram/packages/client.py +++ b/daemon/telegram/packages/client.py @@ -8,7 +8,7 @@ from pyrogram.enums import ParseMode from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton from typing import Union from email.message import Message -from telegram.mailer import utils +from atom import utils from telegram.database import DB from .decorator import handle_flood diff --git a/daemon/telegram/packages/plugins/callbacks/del_atom.py b/daemon/telegram/packages/plugins/callbacks/del_atom.py index 57be8c6..b750e1c 100644 --- a/daemon/telegram/packages/plugins/callbacks/del_atom.py +++ b/daemon/telegram/packages/plugins/callbacks/del_atom.py @@ -4,7 +4,7 @@ # from telegram.packages import DaemonClient -from telegram.mailer import utils +from atom import utils from pyrogram.types import CallbackQuery from telegram import config diff --git a/daemon/telegram/packages/plugins/callbacks/del_chat.py b/daemon/telegram/packages/plugins/callbacks/del_chat.py index 854b172..90b557e 100644 --- a/daemon/telegram/packages/plugins/callbacks/del_chat.py +++ b/daemon/telegram/packages/plugins/callbacks/del_chat.py @@ -4,7 +4,7 @@ # from telegram.packages import DaemonClient -from telegram.mailer import utils +from atom import utils from pyrogram.types import CallbackQuery from telegram import config diff --git a/daemon/telegram/packages/plugins/commands/manage_atom.py b/daemon/telegram/packages/plugins/commands/manage_atom.py index 37b06cb..99df7f7 100644 --- a/daemon/telegram/packages/plugins/commands/manage_atom.py +++ b/daemon/telegram/packages/plugins/commands/manage_atom.py @@ -6,7 +6,7 @@ from pyrogram.types import Message from pyrogram import filters from telegram.packages import DaemonClient -from telegram.mailer import utils +from atom import utils from telegram import config diff --git a/daemon/telegram/packages/plugins/commands/manage_broadcast.py b/daemon/telegram/packages/plugins/commands/manage_broadcast.py index b99b712..0aa70de 100644 --- a/daemon/telegram/packages/plugins/commands/manage_broadcast.py +++ b/daemon/telegram/packages/plugins/commands/manage_broadcast.py @@ -6,7 +6,7 @@ from pyrogram.types import Message from pyrogram import filters, enums from telegram.packages import DaemonClient -from telegram.mailer import utils +from atom import utils from telegram import config diff --git a/daemon/telegram/packages/plugins/commands/scrape.py b/daemon/telegram/packages/plugins/commands/scrape.py index 253993f..d4d10a9 100644 --- a/daemon/telegram/packages/plugins/commands/scrape.py +++ b/daemon/telegram/packages/plugins/commands/scrape.py @@ -7,8 +7,8 @@ from pyrogram.types import Message from pyrogram import filters from telegram.packages import DaemonClient -from telegram.mailer import Scraper -from telegram.mailer import utils +from atom import Scraper +from atom import utils from telegram import config import shutil import re diff --git a/daemon/tg.py b/daemon/tg.py index 86b0226..5f8c21e 100644 --- a/daemon/tg.py +++ b/daemon/tg.py @@ -5,12 +5,12 @@ # from apscheduler.schedulers.asyncio import AsyncIOScheduler -from telegram.scraper import BotMutexes from dotenv import load_dotenv from mysql import connector +from atom import Scraper from telegram.packages import DaemonClient -from telegram.scraper import Scraper -from telegram.scraper import Bot +from telegram.mailer import BotMutexes +from telegram.mailer import Bot import os -- Muhammad Rizki