diff --git a/README.md b/README.md index 8ba518f..4d6b3d6 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,6 @@ - Check Heroku dynos stats - Extracting **tar.xz** support - Heroku config support -- Custom Image support -- Custom Progress bar - Counting file/folder - View Link button - Shell and Executor @@ -167,15 +165,11 @@ Fill up rest of the fields. Meaning of each fields are discussed below: - **MEGA_LIMIT**: To limit downloading Mega (leave space between number and unit, Available units is (gb or GB, tb or TB), Examples: ```100 gb, 100 GB, 10 tb, 10 TB``` - **TORRENT_DIRECT_LIMIT**: To limit the Torrent/Direct mirror size, Leave space between number and unit. Available units is (gb or GB, tb or TB), Examples: ```100 gb, 100 GB, 10 tb, 10 TB``` - **TAR_UNZIP_LIMIT**: To limit mirroring as Tar or unzipmirror. Available units is (gb or GB, tb or TB), Examples: ```100 gb, 100 GB, 10 tb, 10 TB``` -- **TIMEZONE**: To change time zone in ```/stats``` command (**NOTE**: Default time zone using ```Asia/Jakarta```) -- **IMAGE_URL**: Show Image/Logo in /start message. Fill value of image your link image, use telegra.ph or any direct link image. - **VIEW_LINK**: View Link button to open file Index Link in browser instead of direct download link, you can figure out if it's compatible with your Index code or not, open any video from you Index and check if the END of link from browser link bar is `?a=view`, if yes make it `True` it will work (Compatible with [Bhadoo Index](https://gitlab.com/ParveenBhadooOfficial/Google-Drive-Index) Code) - **UPTOBOX_TOKEN**: Uptobox token to mirror uptobox links. Get it from [Uptobox Premium Account](https://uptobox.com/my_account). - **HEROKU_API_KEY**: (Only if you deploying on Heroku) Your Heroku API key, get it from https://dashboard.heroku.com/account. - **HEROKU_APP_NAME**: (Only if you deploying on Heroku) Your Heroku app name. - **IGNORE_PENDING_REQUESTS**: If you want the bot to ignore pending requests after it restarts, set this to `True`. -- **FINISHED_PROGRESS_STR**: Single character for finished progress. Example: ```Uploading ●●●●○○○○ %50```. This value sets: `●`. You can Select any character from these listed sites: https://coolsymbol.com, https://changaco.oy.lc/unicode-progress-bars/, https://text-symbols.com/ -- **UNFINISHED_PROGRESS_STR**: Single character for finished progress. Example: ```Uploading ●●●●○○○○ %50```. This value sets: `○`. You can Select any character from these listed sites: https://coolsymbol.com, https://changaco.oy.lc/unicode-progress-bars/, https://text-symbols.com/ - **STATUS_LIMIT**: Status limit with buttons (**NOTE**: Recommend limit status to ```4``` tasks max). - **SHORTENER_API**: Fill your Shortener api key if you are using Shortener. - **SHORTENER**: if you want to use Shortener in Gdrive and index link, fill Shortener url here. Examples: diff --git a/app.json b/app.json index 30a6916..87c8004 100644 --- a/app.json +++ b/app.json @@ -151,16 +151,6 @@ "SHORTENER_API": { "description": "Fill your shortener api key if you are using shortener.", "required": false - }, - "TIMEZONE": { - "description": "To change time zone in /stats command.", - "value": "Asia/Jakarta", - "required": false - }, - "IMAGE_URL": { - "description": "Show Image/Logo in /start message, Use telegra.ph or any direct link image.", - "value": "https://telegra.ph/file/db03910496f06094f1f7a.jpg", - "required": false }, "TOKEN_PICKLE_URL": { "description": "(Optional) Only if you want to load your token.pickle externally from an index link. Fill this with the direct link of that file.", @@ -199,16 +189,6 @@ "description": "Fill your URL if you are using extra buttons.", "required": false }, - "FINISHED_PROGRESS_STR": { - "description": "Single character for finished progress", - "value": "●", - "required": false - }, - "UNFINISHED_PROGRESS_STR": { - "description": "Single character for unfinished progress", - "value": "○", - "required": false - }, "STATUS_LIMIT": { "description": "Status limit with buttons, Recommend limit status to 4 tasks max.", "value": "", diff --git a/bot/__init__.py b/bot/__init__.py index f219413..cac3cff 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -323,12 +323,6 @@ try: except KeyError: SHORTENER = None SHORTENER_API = None -try: - IMAGE_URL = getConfig('IMAGE_URL') - if len(IMAGE_URL) == 0: - IMAGE_URL = 'https://telegra.ph/file/db03910496f06094f1f7a.jpg' -except KeyError: - IMAGE_URL = 'https://telegra.ph/file/db03910496f06094f1f7a.jpg' IGNORE_PENDING_REQUESTS = False try: @@ -336,24 +330,6 @@ try: IGNORE_PENDING_REQUESTS = True except KeyError: pass -try: - FINISHED_PROGRESS_STR = getConfig('FINISHED_PROGRESS_STR') - if len(FINISHED_PROGRESS_STR) == 0: - FINISHED_PROGRESS_STR = '●' -except KeyError: - FINISHED_PROGRESS_STR = '●' -try: - UNFINISHED_PROGRESS_STR = getConfig('UNFINISHED_PROGRESS_STR') - if len(UNFINISHED_PROGRESS_STR) == 0: - UNFINISHED_PROGRESS_STR = '○' -except KeyError: - UNFINISHED_PROGRESS_STR = '○' -try: - TIMEZONE = getConfig('TIMEZONE') - if len(TIMEZONE) == 0: - TIMEZONE = 'Asia/Jakarta' -except KeyError: - TIMEZONE = 'Asia/Jakarta' updater = tg.Updater(token=BOT_TOKEN) bot = updater.bot diff --git a/bot/__main__.py b/bot/__main__.py index bfe0fa7..cf17b70 100644 --- a/bot/__main__.py +++ b/bot/__main__.py @@ -5,9 +5,6 @@ import os from pyrogram import idle from bot import app from sys import executable -from datetime import datetime -import pytz -import time from telegram import ParseMode from telegram.ext import CommandHandler @@ -19,12 +16,10 @@ from .helper.ext_utils.bot_utils import get_readable_file_size, get_readable_tim from .helper.telegram_helper.filters import CustomFilters from bot.helper.telegram_helper import button_build from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch, shell, eval, torrent_search, delete, speedtest, usage, mediainfo, count, config, updates -now=datetime.now(pytz.timezone(f'{TIMEZONE}')) def stats(update, context): currentTime = get_readable_time(time.time() - botStartTime) - current = now.strftime('%Y/%m/%d %I:%M:%S %p') total, used, free = shutil.disk_usage('.') total = get_readable_file_size(total) used = get_readable_file_size(used) @@ -35,7 +30,6 @@ def stats(update, context): memory = psutil.virtual_memory().percent disk = psutil.disk_usage('/').percent stats = f'Bot Uptime: {currentTime}\n' \ - f'Start Time: {current}\n' \ f'Total Disk Space: {total}\n' \ f'Used: {used} ' \ f'Free: {free}\n\n' \ @@ -44,7 +38,7 @@ def stats(update, context): f'CPU: {cpuUsage}%\n' \ f'RAM: {memory}%\n' \ f'DISK: {disk}%' - update.effective_message.reply_photo(IMAGE_URL, stats, parse_mode=ParseMode.HTML) + sendMessage(stats, context.bot, update) def start(update, context): @@ -62,7 +56,7 @@ Type /{BotCommands.HelpCommand} to get a list of available commands if update.message.chat.type == "private" : sendMessage(f"Hey I'm Alive 🙂\nSince: {uptime}", context.bot, update) else : - update.effective_message.reply_photo(IMAGE_URL, start_string, parse_mode=ParseMode.MARKDOWN, reply_markup=reply_markup) + update.effective_message.reply_text(start_string, reply_markup=reply_markup) else : sendMessage(f"Oops! not a Authorized user.", context.bot, update) diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py index 193472f..46a3b1c 100644 --- a/bot/helper/ext_utils/bot_utils.py +++ b/bot/helper/ext_utils/bot_utils.py @@ -5,7 +5,7 @@ import time import math from bot.helper.telegram_helper.bot_commands import BotCommands -from bot import dispatcher, download_dict, download_dict_lock, FINISHED_PROGRESS_STR, UNFINISHED_PROGRESS_STR, STATUS_LIMIT +from bot import dispatcher, download_dict, download_dict_lock, STATUS_LIMIT from telegram import InlineKeyboardMarkup from telegram.ext import CallbackQueryHandler from bot.helper.telegram_helper import button_build, message_utils @@ -31,7 +31,7 @@ class MirrorStatus: PROGRESS_MAX_SIZE = 100 // 8 -# PROGRESS_INCOMPLETE = ['▏', '▎', '▍', '▌', '▋', '▊', '▉'] +PROGRESS_INCOMPLETE = ['▏', '▎', '▍', '▌', '▋', '▊', '▉'] SIZE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'] @@ -94,11 +94,10 @@ def get_progress_bar_string(status): p = min(max(p, 0), 100) cFull = p // 8 cPart = p % 8 - 1 - p_str = FINISHED_PROGRESS_STR * cFull + p_str = '█' * cFull if cPart >= 0: - # p_str += PROGRESS_INCOMPLETE[cPart] - p_str += FINISHED_PROGRESS_STR - p_str += UNFINISHED_PROGRESS_STR * (PROGRESS_MAX_SIZE - cFull) + p_str += PROGRESS_INCOMPLETE[cPart] + p_str += ' ' * (PROGRESS_MAX_SIZE - cFull) p_str = f"[{p_str}]" return p_str @@ -135,7 +134,7 @@ def get_readable_message(): f" | Peers: {download.aria_download().connections}" except: pass - msg += f'\nUser: {download.message.from_user.first_name} ({download.message.from_user.id})' + msg += f'\nUser: {download.message.from_user.first_name}' msg += f"\nTo Stop: /{BotCommands.CancelMirror} {download.gid()}" msg += "\n\n" if STATUS_LIMIT is not None: diff --git a/bot/helper/mirror_utils/download_utils/direct_link_generator.py b/bot/helper/mirror_utils/download_utils/direct_link_generator.py index d0f2780..ce6c376 100644 --- a/bot/helper/mirror_utils/download_utils/direct_link_generator.py +++ b/bot/helper/mirror_utils/download_utils/direct_link_generator.py @@ -321,6 +321,7 @@ def streamtape(url: str) -> str: dl_url=bypasser.bypass_streamtape(url) return dl_url + def racaty(url: str) -> str: """ Racaty direct links generator based on https://github.com/breakdowns/slam-mirrorbot """ diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py index 0a78bac..bfd338d 100644 --- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py +++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py @@ -22,7 +22,7 @@ from telegram import InlineKeyboardMarkup from bot.helper.telegram_helper import button_build from telegraph import Telegraph from bot import parent_id, DOWNLOAD_DIR, IS_TEAM_DRIVE, INDEX_URL, \ - USE_SERVICE_ACCOUNTS, telegraph_token, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, BUTTON_SIX_NAME, BUTTON_SIX_URL, SHORTENER, SHORTENER_API, IMAGE_URL, VIEW_LINK + USE_SERVICE_ACCOUNTS, telegraph_token, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, BUTTON_SIX_NAME, BUTTON_SIX_URL, SHORTENER, SHORTENER_API, VIEW_LINK from bot.helper.ext_utils.bot_utils import * from bot.helper.ext_utils.fs_utils import get_mime_type, get_path_size @@ -583,7 +583,7 @@ class GoogleDriveHelper: orderBy='name asc').execute() content_count = 0 if response["files"]: - msg += f'

{len(response["files"])} Results: {fileName}



' + msg += f'

{len(response["files"])} Results: {fileName}



' for file in response.get('files', []): if file.get('mimeType') == "application/vnd.google-apps.folder": # Detect Whether Current Entity is a Folder or File. furl = f"https://drive.google.com/drive/folders/{file.get('id')}" diff --git a/bot/modules/config.py b/bot/modules/config.py index c6fbaeb..df273e0 100644 --- a/bot/modules/config.py +++ b/bot/modules/config.py @@ -206,7 +206,7 @@ async def config_button(_, query): elif data == '10': return await query.message.edit( __header__.format(data) - + f"**[ Updater Config ]**\n\n**UPSTREAM_REPO:** `{UPSTREAM_REPO}`\n\n**UPSTREAM_BRANCH:** `{UPSTREAM_BRANCH}`\n\n**[ Visual Config ]**\n\n**FINISHED_PROGRESS_STR:** `{FINISHED_PROGRESS_STR}`\n\n**UNFINISHED_PROGRESS_STR:** `{UNFINISHED_PROGRESS_STR}`", + + f"**[ Updater Config ]**\n\n**UPSTREAM_REPO:** `{UPSTREAM_REPO}`\n\n**UPSTREAM_BRANCH:** `{UPSTREAM_BRANCH}`", reply_markup=types.InlineKeyboardMarkup( [ [ diff --git a/bot/modules/eval.py b/bot/modules/eval.py index a3ade9f..6890639 100644 --- a/bot/modules/eval.py +++ b/bot/modules/eval.py @@ -6,7 +6,7 @@ import traceback from contextlib import redirect_stdout from bot.helper.telegram_helper.filters import CustomFilters from bot.helper.telegram_helper.bot_commands import BotCommands -from bot import LOGGER, dispatcher, IMAGE_URL +from bot import LOGGER, dispatcher from telegram import ParseMode from telegram.ext import CommandHandler @@ -126,8 +126,8 @@ def exechelp(update, context): • /exec Run Commands In Exec • /clearlocals Cleared locals ''' - update.effective_message.reply_photo(IMAGE_URL, help_string, parse_mode=ParseMode.HTML) - + update.effective_message.reply_text(help_string, parse_mode=ParseMode.HTML) + EVAL_HANDLER = CommandHandler(('eval'), evaluate, filters=CustomFilters.owner_filter, run_async=True) EXEC_HANDLER = CommandHandler(('exec'), execute, filters=CustomFilters.owner_filter, run_async=True) diff --git a/bot/modules/torrent_search.py b/bot/modules/torrent_search.py index 5a11e76..d8abf8c 100644 --- a/bot/modules/torrent_search.py +++ b/bot/modules/torrent_search.py @@ -18,7 +18,7 @@ from pyrogram.parser import html as pyrogram_html from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton from pyrogram.handlers import MessageHandler, CallbackQueryHandler -from bot import app, dispatcher, IMAGE_URL +from bot import app, dispatcher from bot.helper import custom_filters from bot.helper.telegram_helper.bot_commands import BotCommands from bot.helper.telegram_helper.filters import CustomFilters @@ -330,7 +330,7 @@ def searchhelp(update, context): • /rarbg [search query] • /ts [search query] ''' - update.effective_message.reply_photo(IMAGE_URL, help_string, parse_mode=ParseMode.HTML) + update.effective_message.reply_text(help_string, parse_mode=ParseMode.HTML) SEARCHHELP_HANDLER = CommandHandler(BotCommands.TsHelpCommand, searchhelp, filters=(CustomFilters.authorized_chat | CustomFilters.authorized_user) & CustomFilters.mirror_owner_filter, run_async=True) diff --git a/config_sample.env b/config_sample.env index 35d9b5d..e834d8b 100644 --- a/config_sample.env +++ b/config_sample.env @@ -32,8 +32,6 @@ STOP_DUPLICATE_CLONE = "" STOP_DUPLICATE_MEGA = "" SHORTENER = "" SHORTENER_API = "" -TIMEZONE = "Asia/Jakarta" -IMAGE_URL = "https://telegra.ph/file/db03910496f06094f1f7a.jpg" # If you want to use Credentials externally from Index Links, fill these vars with the direct links # These are optional, if you don't know, simply leave them, don't fill anything in them. ACCOUNTS_ZIP_URL = "" @@ -56,6 +54,3 @@ BUTTON_FIVE_NAME = "" BUTTON_FIVE_URL = "" BUTTON_SIX_NAME = "" BUTTON_SIX_URL = "" -# Single character for finished & unfinished progress -FINISHED_PROGRESS_STR = "●" -UNFINISHED_PROGRESS_STR = "○" diff --git a/requirements.txt b/requirements.txt index 016006b..ab92cd9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,7 +21,6 @@ pyrogram python-dotenv python-magic python-telegram-bot -pytz requests speedtest-cli telegraph