GNU/Weeb Mailing List <[email protected]>
 help / color / mirror / Atom feed
From: Muhammad Rizki <[email protected]>
To: Ammar Faizi <[email protected]>
Cc: Muhammad Rizki <[email protected]>,
	Alviro Iskandar Setiawan <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>
Subject: [RFC PATCH v2 07/17] Move scraper and utility file
Date: Tue, 13 Sep 2022 17:24:48 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

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 <[email protected]>
---
 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 <[email protected]>
+# Copyright (C) 2022  Ammar Faizi <[email protected]>
+#
+
+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 <[email protected]>
 #
 
-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


  parent reply	other threads:[~2022-09-13 10:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13 10:24 [RFC PATCH v2 00/17] Refactor Telegram & initial work Discord Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 01/17] telegram: Move the Telegram bot source code Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 02/17] telegram: Refactor Telegram bot database method Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 03/17] telegram: Renaming some functions in scraper/bot.py Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 04/17] Add ignore file for .env Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 05/17] telegram: Refactor the Telegram bot Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 06/17] telegram: Renames in telegram mailer directory Muhammad Rizki
2022-09-13 10:24 ` Muhammad Rizki [this message]
2022-09-17 17:14   ` [RFC PATCH v2 07/17] Move scraper and utility file Ammar Faizi
2022-09-17 17:16     ` Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 08/17] discord: Initial work Discord bot Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 09/17] discord: Add success run notice on_ready event Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 10/17] discord: Add error handler on events Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 11/17] Move db.sql to combine database with Discord and Telegram Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 12/17] discord: Add database tables for Discord bot Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 13/17] discord: Add initial Discord bot database instance Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 14/17] discord: Add save_atom() in database insertion Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 15/17] discord: Add save_broadcast() " Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 16/17] discord: Add save_discord_mail() " Muhammad Rizki
2022-09-13 10:24 ` [RFC PATCH v2 17/17] discord: Add save_email() " Muhammad Rizki
2022-09-17 17:08 ` [RFC PATCH v2 00/17] Refactor Telegram & initial work Discord Ammar Faizi
2022-09-17 17:16   ` Muhammad Rizki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox