diff --git a/README.md b/README.md index 61ba8ec..cb8b734 100644 --- a/README.md +++ b/README.md @@ -154,13 +154,13 @@ Above are the supported url Shorteners. Except these only some url Shorteners ar **Note**: You can limit maximum concurrent downloads by changing the value of **MAX_CONCURRENT_DOWNLOADS** in aria.sh. By default, it's set to `7`. ### Add more buttons (Optional) -Two buttons are already added of Drive Link and Index Link, you can add extra buttons, these are optional, if you don't know what are below entries, simply leave them, don't fill anything in them. -- **BUTTON_THREE_NAME**: -- **BUTTON_THREE_URL**: +Three buttons are already added of Drive Link, Index Link, and View Link, you can add extra buttons, these are optional, if you don't know what are below entries, simply leave them, don't fill anything in them. - **BUTTON_FOUR_NAME**: - **BUTTON_FOUR_URL**: - **BUTTON_FIVE_NAME**: - **BUTTON_FIVE_URL**: +- **BUTTON_SIX_NAME**: +- **BUTTON_SIX_URL**: diff --git a/app.json b/app.json index ca1f3d2..72c8a61 100644 --- a/app.json +++ b/app.json @@ -125,14 +125,6 @@ "value": "https://telegra.ph/file/db03910496f06094f1f7a.jpg", "required": false }, - "BUTTON_THREE_NAME": { - "description": "Extra buttons (optional).", - "required": false - }, - "BUTTON_THREE_URL": { - "description": "Fill your URL if you are using extra buttons.", - "required": false - }, "BUTTON_FOUR_NAME": { "description": "Extra buttons (optional).", "required": false @@ -148,6 +140,14 @@ "BUTTON_FIVE_URL": { "description": "Fill your URL if you are using extra buttons.", "required": false + }, + "BUTTON_SIX_NAME": { + "description": "Extra buttons (optional).", + "required": false + }, + "BUTTON_SIX_URL": { + "description": "Fill your URL if you are using extra buttons.", + "required": false } }, "addons": [ diff --git a/bot/__init__.py b/bot/__init__.py index 297762b..2a1181a 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -182,14 +182,6 @@ try: INDEX_URL = None except KeyError: INDEX_URL = None -try: - BUTTON_THREE_NAME = getConfig('BUTTON_THREE_NAME') - BUTTON_THREE_URL = getConfig('BUTTON_THREE_URL') - if len(BUTTON_THREE_NAME) == 0 or len(BUTTON_THREE_URL) == 0: - raise KeyError -except KeyError: - BUTTON_THREE_NAME = None - BUTTON_THREE_URL = None try: BUTTON_FOUR_NAME = getConfig('BUTTON_FOUR_NAME') BUTTON_FOUR_URL = getConfig('BUTTON_FOUR_URL') @@ -206,6 +198,14 @@ try: except KeyError: BUTTON_FIVE_NAME = None BUTTON_FIVE_URL = None +try: + BUTTON_SIX_NAME = getConfig('BUTTON_SIX_NAME') + BUTTON_SIX_URL = getConfig('BUTTON_SIX_URL') + if len(BUTTON_SIX_NAME) == 0 or len(BUTTON_SIX_URL) == 0: + raise KeyError +except KeyError: + BUTTON_SIX_NAME = None + BUTTON_SIX_URL = None try: STOP_DUPLICATE_MIRROR = getConfig('STOP_DUPLICATE_MIRROR') if STOP_DUPLICATE_MIRROR.lower() == 'true': diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py index e4109d4..f63479d 100644 --- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py +++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py @@ -20,7 +20,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, download_dict, telegraph_token, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, SHORTENER, SHORTENER_API, IMAGE_URL + USE_SERVICE_ACCOUNTS, download_dict, 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 from bot.helper.ext_utils.bot_utils import * from bot.helper.ext_utils.fs_utils import get_mime_type, get_path_size @@ -350,12 +350,12 @@ class GoogleDriveHelper: buttons.buildbutton("⚡ Index Link", siurl) else: buttons.buildbutton("⚡ Index Link", url) - if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None: - buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}") if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None: buttons.buildbutton(f"{BUTTON_FOUR_NAME}", f"{BUTTON_FOUR_URL}") if BUTTON_FIVE_NAME is not None and BUTTON_FIVE_URL is not None: buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}") + if BUTTON_SIX_NAME is not None and BUTTON_SIX_URL is not None: + buttons.buildbutton(f"{BUTTON_SIX_NAME}", f"{BUTTON_SIX_URL}") else: file = self.copyFile(meta.get('id'), parent_id) msg += f'Filename: {file.get("name")}' @@ -387,12 +387,12 @@ class GoogleDriveHelper: else: buttons.buildbutton("⚡ Index Link", url) buttons.buildbutton("🌐 View Link", urls) - if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None: - buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}") if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None: buttons.buildbutton(f"{BUTTON_FOUR_NAME}", f"{BUTTON_FOUR_URL}") if BUTTON_FIVE_NAME is not None and BUTTON_FIVE_URL is not None: buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}") + if BUTTON_SIX_NAME is not None and BUTTON_SIX_URL is not None: + buttons.buildbutton(f"{BUTTON_SIX_NAME}", f"{BUTTON_SIX_URL}") except Exception as err: if isinstance(err, RetryError): LOGGER.info(f"Total Attempts: {err.last_attempt.attempt_number}") diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py index f66392a..5347af7 100644 --- a/bot/modules/mirror.py +++ b/bot/modules/mirror.py @@ -2,7 +2,7 @@ import requests from telegram.ext import CommandHandler, run_async from telegram import InlineKeyboardMarkup -from bot import Interval, INDEX_URL, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, BLOCK_MEGA_FOLDER, BLOCK_MEGA_LINKS +from bot import Interval, INDEX_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, BUTTON_SIX_NAME, BUTTON_SIX_URL, BLOCK_MEGA_FOLDER, BLOCK_MEGA_LINKS from bot import dispatcher, DOWNLOAD_DIR, DOWNLOAD_STATUS_UPDATE_INTERVAL, download_dict, download_dict_lock, SHORTENER, SHORTENER_API from bot.helper.ext_utils import fs_utils, bot_utils from bot.helper.ext_utils.bot_utils import setInterval, get_mega_link_type @@ -182,12 +182,12 @@ class MirrorListener(listeners.MirrorListeners): else: buttons.buildbutton("⚡ Index Link", share_url) buttons.buildbutton("🌐 View Link", share_urls) - if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None: - buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}") if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None: buttons.buildbutton(f"{BUTTON_FOUR_NAME}", f"{BUTTON_FOUR_URL}") if BUTTON_FIVE_NAME is not None and BUTTON_FIVE_URL is not None: buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}") + if BUTTON_SIX_NAME is not None and BUTTON_SIX_URL is not None: + buttons.buildbutton(f"{BUTTON_SIX_NAME}", f"{BUTTON_SIX_URL}") if self.message.from_user.username: uname = f"@{self.message.from_user.username}" else: diff --git a/config_sample.env b/config_sample.env index 9f7c77b..734e901 100644 --- a/config_sample.env +++ b/config_sample.env @@ -32,11 +32,11 @@ MAX_TORRENT_SIZE = 15 # Fill only if you deploying with heroku-cli and Goorm IDE HEROKU_API_KEY = "" HEROKU_APP_NAME = "" -# Add more buttons (two buttons are already added of file link and index link, you can add extra buttons too, these are optional) +# Add more buttons (Three buttons are already added of file link and index link, you can add extra buttons too, these are optional) # If you don't know what are below entries, simply leave them, Don't fill anything in them. -BUTTON_THREE_NAME = "" -BUTTON_THREE_URL = "" BUTTON_FOUR_NAME = "" BUTTON_FOUR_URL = "" BUTTON_FIVE_NAME = "" BUTTON_FIVE_URL = "" +BUTTON_SIX_NAME = "" +BUTTON_SIX_URL = ""