From 6f85fdc6ea1fa617e6fac95e6d91d20d43998dae Mon Sep 17 00:00:00 2001 From: anas Date: Fri, 16 Jul 2021 15:45:43 +0300 Subject: [PATCH] No need for buttons if only 1 page Signed-off-by: anas --- bot/helper/ext_utils/bot_utils.py | 18 +++++++++--------- .../download_utils/aria2_download.py | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py index 6f3fd57..20b316c 100644 --- a/bot/helper/ext_utils/bot_utils.py +++ b/bot/helper/ext_utils/bot_utils.py @@ -138,18 +138,18 @@ def get_readable_message(): msg += f"\nTo Stop: /{BotCommands.CancelMirror} {download.gid()}" msg += "\n\n" if STATUS_LIMIT is not None: - limit = COUNT + STATUS_LIMIT - if INDEX >= limit: + if INDEX >= COUNT + STATUS_LIMIT: break if STATUS_LIMIT is not None: - if INDEX > limit: + if INDEX > COUNT + STATUS_LIMIT: return None, None - msg += f"Page: {PAGE_NO}/{pages} | Tasks: {dick_no}\n" - buttons = button_build.ButtonMaker() - buttons.sbutton("Previous", "pre") - buttons.sbutton("Next", "nex") - button = InlineKeyboardMarkup(buttons.build_menu(2)) - return msg, button + if dick_no > STATUS_LIMIT: + msg += f"Page: {PAGE_NO}/{pages} | Tasks: {dick_no}\n" + buttons = button_build.ButtonMaker() + buttons.sbutton("Previous", "pre") + buttons.sbutton("Next", "nex") + button = InlineKeyboardMarkup(buttons.build_menu(2)) + return msg, button return msg, "" def flip(update, context): diff --git a/bot/helper/mirror_utils/download_utils/aria2_download.py b/bot/helper/mirror_utils/download_utils/aria2_download.py index b5fb256..6a0376c 100644 --- a/bot/helper/mirror_utils/download_utils/aria2_download.py +++ b/bot/helper/mirror_utils/download_utils/aria2_download.py @@ -61,7 +61,7 @@ class AriaDownloadHelper(DownloadHelper): dl.getListener().onDownloadError(f'{mssg}.\nYour File/Folder size is {get_readable_file_size(size)}') aria2.remove([download], force=True) return - update_all_messages() + update_all_messages() def __onDownloadComplete(self, api: API, gid): dl = getDownloadByGid(gid)