diff --git a/.gitignore b/.gitignore index f81b9ac07..979bf5745 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ Thumbnails/* rclone/* tokens/* list_drives.txt +shorteners.txt cookies.txt downloads bot.session* diff --git a/bot/__init__.py b/bot/__init__.py index 76c8f8bdb..91c63fb50 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -37,7 +37,7 @@ install() setdefaulttimeout(600) -botStartTime = time() +bot_start_time = time() bot_loop = get_event_loop() getLogger("pyrogram").setLevel(ERROR) @@ -84,6 +84,7 @@ def format(self, record): "aspx", ] user_data = {} +shorteners_list = [] aria2_options, qbit_options = {}, {} queued_dl, queued_up = {}, {} non_queued_dl, non_queued_up = set(), set() @@ -148,6 +149,14 @@ def initialize_database(): with open(".netrc", "w"): pass +if ospath.exists("shorteners.txt"): + with open("shorteners.txt", "r+") as f: + lines = f.readlines() + for line in lines: + temp = line.strip().split() + if len(temp) == 2: + shorteners_list.append({"domain": temp[0], "api_key": temp[1]}) + def init_user_client(): user_session = environ.get("USER_SESSION_STRING", "") diff --git a/bot/__main__.py b/bot/__main__.py index 19dc0413d..11d9f12a1 100644 --- a/bot/__main__.py +++ b/bot/__main__.py @@ -29,7 +29,7 @@ user_data, config_dict, bot_username, - botStartTime, + bot_start_time, ) from .modules import ( # noqa: F401 @@ -88,7 +88,7 @@ async def stats(_, message): memory = virtual_memory() stats = ( f"Commit Date: {last_commit}\n\n" - f"Bot Uptime: {get_readable_time(time() - botStartTime)}\n" + f"Bot Uptime: {get_readable_time(time() - bot_start_time)}\n" f"OS Uptime: {get_readable_time(time() - boot_time())}\n\n" f"Total Disk Space: {get_readable_file_size(total)}\n" f"Used: {get_readable_file_size(used)} | Free: {get_readable_file_size(free)}\n\n" diff --git a/bot/helper/aeon_utils/shorteners.py b/bot/helper/aeon_utils/shorteners.py index 93b3e96fe..550bee251 100644 --- a/bot/helper/aeon_utils/shorteners.py +++ b/bot/helper/aeon_utils/shorteners.py @@ -1,17 +1,10 @@ from random import choice from asyncio import sleep from urllib.parse import quote - +from bot import shorteners_list from aiohttp import ClientSession from pyshorteners import Shortener -shorteners_list = [ - { - "domain": "modijiurl.com", - "api_key": "cd5b3b10ed0e7c30e795e7ab3c8778f799cafb5b", - } -] - async def short(long_url): async with ClientSession() as session: diff --git a/bot/helper/ext_utils/status_utils.py b/bot/helper/ext_utils/status_utils.py index baa15d41d..84457d4d4 100644 --- a/bot/helper/ext_utils/status_utils.py +++ b/bot/helper/ext_utils/status_utils.py @@ -9,7 +9,7 @@ DOWNLOAD_DIR, task_dict, status_dict, - botStartTime, + bot_start_time, task_dict_lock, ) from bot.helper.ext_utils.bot_utils import sync_to_async @@ -225,5 +225,5 @@ async def get_readable_message(sid, is_user, page_no=1, status="All", page_step= buttons.callback("Next", f"status {sid} nex", position="header") button = buttons.menu(8) msg += f"\nFree disk: {get_readable_file_size(disk_usage(DOWNLOAD_DIR).free)}" - msg += f"\nBot uptime: {get_readable_time(time() - botStartTime)}" + msg += f"\nBot uptime: {get_readable_time(time() - bot_start_time)}" return msg, button diff --git a/bot/modules/status.py b/bot/modules/status.py index 284899c9c..29be04336 100644 --- a/bot/modules/status.py +++ b/bot/modules/status.py @@ -10,7 +10,7 @@ bot, task_dict, status_dict, - botStartTime, + bot_start_time, task_dict_lock, ) from bot.helper.ext_utils.bot_utils import new_task @@ -34,7 +34,7 @@ async def mirror_status(_, message): async with task_dict_lock: count = len(task_dict) if count == 0: - currentTime = get_readable_time(time() - botStartTime) + currentTime = get_readable_time(time() - bot_start_time) free = get_readable_file_size(disk_usage(DOWNLOAD_DIR).free) msg = "No downloads are currently in progress.\n" msg += f"\nBot uptime: {currentTime}"