diff --git a/bot/__main__.py b/bot/__main__.py index 92b03fe..3bdd7c6 100644 --- a/bot/__main__.py +++ b/bot/__main__.py @@ -1,12 +1,13 @@ from telegram.ext import CommandHandler, run_async -from bot import dispatcher, LOGGER, updater, aria2 -import bot.mirror, bot.list, bot.mirror_status, bot.cancel_mirror, bot.authorize -from bot.helper import fs_utils +from bot import dispatcher, LOGGER, updater +from bot.helper.ext_utils import fs_utils import signal import time -from bot.helper.message_utils import * +from bot.helper.telegram_helper.message_utils import * import shutil from .helper.telegram_helper.filters import CustomFilters +from .modules import * + @run_async def disk_usage(update, context): diff --git a/bot/config.py b/bot/config.py deleted file mode 100644 index 80f7ed5..0000000 --- a/bot/config.py +++ /dev/null @@ -1,3 +0,0 @@ -class Config(object): - """docstring for Config""" - \ No newline at end of file diff --git a/bot/helper/ext_utils/__init__.py b/bot/helper/ext_utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bot/helper/bot_utils.py b/bot/helper/ext_utils/bot_utils.py similarity index 100% rename from bot/helper/bot_utils.py rename to bot/helper/ext_utils/bot_utils.py diff --git a/bot/helper/exceptions.py b/bot/helper/ext_utils/exceptions.py similarity index 100% rename from bot/helper/exceptions.py rename to bot/helper/ext_utils/exceptions.py diff --git a/bot/helper/fs_utils.py b/bot/helper/ext_utils/fs_utils.py similarity index 100% rename from bot/helper/fs_utils.py rename to bot/helper/ext_utils/fs_utils.py diff --git a/bot/helper/mirror_utils/__init__.py b/bot/helper/mirror_utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bot/helper/download_status.py b/bot/helper/mirror_utils/download_status.py similarity index 97% rename from bot/helper/download_status.py rename to bot/helper/mirror_utils/download_status.py index 3a23c56..8c6e489 100644 --- a/bot/helper/download_status.py +++ b/bot/helper/mirror_utils/download_status.py @@ -1,5 +1,5 @@ from bot import aria2, DOWNLOAD_DIR -from .bot_utils import get_readable_file_size, MirrorStatus +from bot.helper.ext_utils.bot_utils import get_readable_file_size, MirrorStatus def get_download(gid): diff --git a/bot/helper/download_tools.py b/bot/helper/mirror_utils/download_tools.py similarity index 97% rename from bot/helper/download_tools.py rename to bot/helper/mirror_utils/download_tools.py index b03afd8..4636c2e 100644 --- a/bot/helper/download_tools.py +++ b/bot/helper/mirror_utils/download_tools.py @@ -1,8 +1,8 @@ from time import sleep from bot import DOWNLOAD_DIR, DOWNLOAD_STATUS_UPDATE_INTERVAL, aria2 from .download_status import DownloadStatus -from .bot_utils import * -from .exceptions import KillThreadException +from bot.helper.ext_utils.bot_utils import * +from bot.helper.ext_utils.exceptions import KillThreadException class DownloadHelper: diff --git a/bot/helper/gdriveTools.py b/bot/helper/mirror_utils/gdriveTools.py similarity index 98% rename from bot/helper/gdriveTools.py rename to bot/helper/mirror_utils/gdriveTools.py index 5d97f2a..4becd43 100644 --- a/bot/helper/gdriveTools.py +++ b/bot/helper/mirror_utils/gdriveTools.py @@ -5,11 +5,10 @@ from googleapiclient.http import MediaFileUpload import pickle import os import time -import logging from bot import LOGGER, parent_id, DOWNLOAD_DIR -from .fs_utils import get_mime_type -from .bot_utils import * -from .exceptions import KillThreadException +from bot.helper.ext_utils.fs_utils import get_mime_type +from bot.helper.ext_utils.bot_utils import * +from bot.helper.ext_utils.exceptions import KillThreadException logging.getLogger('googleapiclient.discovery').setLevel(logging.ERROR) diff --git a/bot/helper/listeners.py b/bot/helper/mirror_utils/listeners.py similarity index 100% rename from bot/helper/listeners.py rename to bot/helper/mirror_utils/listeners.py diff --git a/bot/helper/message_utils.py b/bot/helper/telegram_helper/message_utils.py similarity index 100% rename from bot/helper/message_utils.py rename to bot/helper/telegram_helper/message_utils.py diff --git a/bot/modules/__init__.py b/bot/modules/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bot/authorize.py b/bot/modules/authorize.py similarity index 89% rename from bot/authorize.py rename to bot/modules/authorize.py index f3d85b9..005ac55 100644 --- a/bot/authorize.py +++ b/bot/modules/authorize.py @@ -1,8 +1,8 @@ -from .helper.message_utils import sendMessage +from bot.helper.telegram_helper.message_utils import sendMessage from telegram.ext import run_async from bot import AUTHORIZED_CHATS, dispatcher from telegram.ext import CommandHandler -from .helper.telegram_helper.filters import CustomFilters +from bot.helper.telegram_helper.filters import CustomFilters from telegram.ext import Filters from telegram import Update diff --git a/bot/cancel_mirror.py b/bot/modules/cancel_mirror.py similarity index 89% rename from bot/cancel_mirror.py rename to bot/modules/cancel_mirror.py index f4575a8..365a9ae 100644 --- a/bot/cancel_mirror.py +++ b/bot/modules/cancel_mirror.py @@ -1,7 +1,7 @@ from telegram.ext import CommandHandler, run_async -from bot.helper.message_utils import * +from bot.helper.telegram_helper.message_utils import * from bot import download_dict, aria2, dispatcher, download_dict_lock -from .helper.telegram_helper.filters import CustomFilters +from bot.helper.telegram_helper.filters import CustomFilters @run_async def cancel_mirror(update: Update, context): diff --git a/bot/list.py b/bot/modules/list.py similarity index 89% rename from bot/list.py rename to bot/modules/list.py index b3a5191..5a8091e 100644 --- a/bot/list.py +++ b/bot/modules/list.py @@ -1,6 +1,5 @@ from telegram.ext import CommandHandler, run_async -from telegram.error import BadRequest -from bot.helper.gdriveTools import GoogleDriveHelper +from bot.helper.mirror_utils.gdriveTools import GoogleDriveHelper from bot import LOGGER, dispatcher diff --git a/bot/mirror.py b/bot/modules/mirror.py similarity index 92% rename from bot/mirror.py rename to bot/modules/mirror.py index 4c83a32..dc621ec 100644 --- a/bot/mirror.py +++ b/bot/modules/mirror.py @@ -1,13 +1,13 @@ from telegram.ext import CommandHandler, run_async from telegram.error import BadRequest -from bot.helper import download_tools, gdriveTools, listeners +from bot.helper.mirror_utils import download_tools, gdriveTools, listeners from bot import LOGGER, dispatcher -from bot.helper import fs_utils +from bot.helper.ext_utils import fs_utils from bot import download_dict, status_reply_dict, status_reply_dict_lock, download_dict_lock -from bot.helper.message_utils import * -from bot.helper.bot_utils import get_readable_message, MirrorStatus -from bot.helper.exceptions import KillThreadException -from .helper.telegram_helper.filters import CustomFilters +from bot.helper.telegram_helper.message_utils import * +from bot.helper.ext_utils.bot_utils import get_readable_message, MirrorStatus +from bot.helper.ext_utils.exceptions import KillThreadException +from bot.helper.telegram_helper.filters import CustomFilters class MirrorListener(listeners.MirrorListeners): def __init__(self, context, update, reply_message): diff --git a/bot/mirror_status.py b/bot/modules/mirror_status.py similarity index 91% rename from bot/mirror_status.py rename to bot/modules/mirror_status.py index 903d55b..e812c1e 100644 --- a/bot/mirror_status.py +++ b/bot/modules/mirror_status.py @@ -1,10 +1,10 @@ from telegram.ext import CommandHandler, run_async from bot import dispatcher, status_reply_dict, DOWNLOAD_STATUS_UPDATE_INTERVAL, status_reply_dict_lock -from bot.helper.message_utils import * +from bot.helper.telegram_helper.message_utils import * from time import sleep -from bot.helper.bot_utils import get_readable_message +from bot.helper.ext_utils.bot_utils import get_readable_message from telegram.error import BadRequest -from .helper.telegram_helper.filters import CustomFilters +from bot.helper.telegram_helper.filters import CustomFilters @run_async def mirror_status(update: Update, context):