From 6bc5ab26506665670d0174bac940cbbb9440e7ac Mon Sep 17 00:00:00 2001 From: 5hojib Date: Fri, 12 Jul 2024 00:32:36 +0600 Subject: [PATCH] update --- .github/workflows/ruff.yml | 2 +- bot/__main__.py | 23 +---- bot/helper/ext_utils/bot_utils.py | 26 ++--- bot/helper/listeners/tasks_listener.py | 18 ++-- .../mirror_leech_utils/rclone_utils/list.py | 40 ++++---- .../upload_utils/telegramEngine.py | 6 +- bot/helper/telegram_helper/button_build.py | 6 +- bot/helper/telegram_helper/message_utils.py | 4 +- bot/modules/bot_settings.py | 36 +++---- bot/modules/cancel_mirror.py | 24 ++--- bot/modules/clone.py | 2 +- bot/modules/images.py | 36 +++---- bot/modules/list.py | 14 +-- bot/modules/mirror_leech.py | 2 +- bot/modules/torrent_search.py | 36 +++---- bot/modules/users_settings.py | 96 +++++++++---------- bot/modules/ytdlp.py | 66 ++++++------- 17 files changed, 212 insertions(+), 225 deletions(-) diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index db5f58949..5fd060e26 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -36,7 +36,7 @@ jobs: if git diff-index --quiet HEAD --; then echo "No changes to commit." else - git commit -m "Auto-format code using ruff [skip ci]" + git commit -m "Auto-format code using ruff [skip actions]" git push origin ${{ github.ref }} fi env: diff --git a/bot/__main__.py b/bot/__main__.py index b35b791e1..7fa5987af 100644 --- a/bot/__main__.py +++ b/bot/__main__.py @@ -99,7 +99,7 @@ async def stats(_, message): @new_thread async def start(client, message): buttons = ButtonMaker() - reply_markup = buttons.build_menu(2) + reply_markup = buttons.menu(2) if len(message.command) > 1 and message.command[1] == "private": await deleteMessage(message) elif len(message.command) > 1 and len(message.command[1]) == 36: @@ -185,25 +185,13 @@ def parseline(line): startLine = "
"
             endLine = "
" btn = ButtonMaker() - btn.ibutton('Close', f'aeon {user_id} close') - reply_message = await sendMessage(message, startLine + escape(Loglines) + endLine, btn.build_menu(1)) + btn.callback('Close', f'aeon {user_id} close') + reply_message = await sendMessage(message, startLine + escape(Loglines) + endLine, btn.menu(1)) await query.edit_message_reply_markup(None) await deleteMessage(message) await five_minute_del(reply_message) except Exception as err: LOGGER.error(f"TG Log Display : {str(err)}") - elif data[2] == "webpaste": - await query.answer() - async with aiopen('log.txt', 'r') as f: - logFile = await f.read() - cget = create_scraper().request - resp = cget('POST', 'https://spaceb.in/api/v1/documents', data={'content': logFile, 'extension': 'None'}).json() - if resp['status'] == 201: - btn = ButtonMaker() - btn.ubutton('Web paste', f"https://spaceb.in/{resp['payload']['id']}") - await query.edit_message_reply_markup(btn.build_menu(1)) - else: - LOGGER.error(f"Web paste failed : {str(err)}") elif data[2] == "private": await query.answer(url=f"https://t.me/{bot_name}?start=private") else: @@ -214,9 +202,8 @@ def parseline(line): @new_task async def log(_, message): buttons = ButtonMaker() - buttons.ibutton('Log display', f'aeon {message.from_user.id} logdisplay') - buttons.ibutton('Web paste', f'aeon {message.from_user.id} webpaste') - reply_message = await sendFile(message, 'log.txt', buttons=buttons.build_menu(1)) + buttons.callback('Log display', f'aeon {message.from_user.id} logdisplay') + reply_message = await sendFile(message, 'log.txt', buttons=buttons.menu(1)) await deleteMessage(message) await five_minute_del(reply_message) diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py index 717e4a53f..c576f02fb 100644 --- a/bot/helper/ext_utils/bot_utils.py +++ b/bot/helper/ext_utils/bot_utils.py @@ -143,11 +143,11 @@ def bt_selection_buttons(id_): pincode = ''.join([n for n in id_ if n.isdigit()][:4]) buttons = ButtonMaker() BASE_URL = config_dict['BASE_URL'] - buttons.ubutton("Select", f"{BASE_URL}/app/files/{id_}") - buttons.ibutton("Pincode", f"btsel pin {gid} {pincode}") - buttons.ibutton("Cancel", f"btsel rm {gid} {id_}") - buttons.ibutton("Done Selecting", f"btsel done {gid} {id_}") - return buttons.build_menu(2) + buttons.url("Select", f"{BASE_URL}/app/files/{id_}") + buttons.callback("Pincode", f"btsel pin {gid} {pincode}") + buttons.callback("Cancel", f"btsel rm {gid} {id_}") + buttons.callback("Done Selecting", f"btsel done {gid} {id_}") + return buttons.menu(2) async def get_telegraph_list(telegraph_content): @@ -155,9 +155,9 @@ async def get_telegraph_list(telegraph_content): if len(path) > 1: await telegraph.edit_telegraph(path, telegraph_content) buttons = ButtonMaker() - buttons.ubutton("View", f"https://telegra.ph/{path[0]}") + buttons.url("View", f"https://telegra.ph/{path[0]}") buttons = extra_btns(buttons) - return buttons.build_menu(1) + return buttons.menu(1) def handleIndex(index, dic): @@ -230,10 +230,10 @@ def get_readable_message(): return None, None if tasks > STATUS_LIMIT: buttons = ButtonMaker() - buttons.ibutton("Prev", "status pre") - buttons.ibutton(f"{PAGE_NO}/{PAGES}", "status ref") - buttons.ibutton("Next", "status nex") - button = buttons.build_menu(3) + buttons.callback("Prev", "status pre") + buttons.callback(f"{PAGE_NO}/{PAGES}", "status ref") + buttons.callback("Next", "status nex") + button = buttons.menu(3) msg += f"• Tasks: {tasks}{bmax_task}" msg += f"\n• Bot uptime: {currentTime}" msg += f"\n• Free disk space: {get_readable_file_size(disk_usage('/usr/src/app/downloads/').free)}" @@ -449,7 +449,7 @@ async def checking_access(user_id, button=None): time_str = get_readable_time(token_timeout, True) if button is None: button = ButtonMaker() - button.ubutton('Collect token', tinyfy(short_url(f'https://telegram.me/{bot_name}?start={token}'))) + button.url('Collect token', tinyfy(short_url(f'https://telegram.me/{bot_name}?start={token}'))) return f'Your token has expired, please collect a new token.\nIt will expire after {time_str}!', button return None, button @@ -457,7 +457,7 @@ async def checking_access(user_id, button=None): def extra_btns(buttons): if extra_buttons: for btn_name, btn_url in extra_buttons.items(): - buttons.ubutton(btn_name, btn_url) + buttons.url(btn_name, btn_url) return buttons diff --git a/bot/helper/listeners/tasks_listener.py b/bot/helper/listeners/tasks_listener.py index a5492b5af..985cf816e 100644 --- a/bot/helper/listeners/tasks_listener.py +++ b/bot/helper/listeners/tasks_listener.py @@ -341,9 +341,9 @@ async def onUploadComplete(self, link, size, files, folders, mime_type, name, rc msg += f'• Elapsed: {get_readable_time(time() - self.message.date.timestamp())}\n' LOGGER.info(f'Task Done: {name}') buttons = ButtonMaker() - iButton = ButtonMaker() - iButton.ibutton('View in inbox', f"aeon {user_id} private", 'header') - iButton = extra_btns(iButton) + callback = ButtonMaker() + callback.callback('View in inbox', f"aeon {user_id} private", 'header') + callback = extra_btns(callback) if self.isLeech: if folders > 1: msg += f'• Total files: {folders}\n' @@ -377,7 +377,7 @@ async def onUploadComplete(self, link, size, files, folders, mime_type, name, rc await sendMessage(self.botpmmsg, msg + lmsg + fmsg) await deleteMessage(self.botpmmsg) if self.isSuperGroup: - await sendMessage(self.message, f'{msg}Files has been sent to your inbox', iButton.build_menu(1)) + await sendMessage(self.message, f'{msg}Files has been sent to your inbox', callback.menu(1)) else: await deleteMessage(self.botpmmsg) if self.seed: @@ -392,7 +392,7 @@ async def onUploadComplete(self, link, size, files, folders, mime_type, name, rc if mime_type == "Folder": msg += f'• Total files: {files}\n' if link: - buttons.ubutton('Cloud link', link) + buttons.url('Cloud link', link) INDEX_URL = self.index_link if self.drive_id else config_dict['INDEX_URL'] if not rclonePath: if INDEX_URL: @@ -400,14 +400,14 @@ async def onUploadComplete(self, link, size, files, folders, mime_type, name, rc share_url = f'{INDEX_URL}/{url_path}' if mime_type == "Folder": share_url += '/' - buttons.ubutton('Index link', share_url) + buttons.url('Index link', share_url) buttons = extra_btns(buttons) - button = buttons.build_menu(2) + button = buttons.menu(2) elif rclonePath: msg += f'• Path: {rclonePath}\n' button = None buttons = extra_btns(buttons) - button = buttons.build_menu(2) + button = buttons.menu(2) msg += f'• User ID: {self.message.from_user.id}\n' msg += f'• By: {self.tag}\n\n' @@ -418,7 +418,7 @@ async def onUploadComplete(self, link, size, files, folders, mime_type, name, rc await sendMessage(self.botpmmsg, msg, button, 'Random') await deleteMessage(self.botpmmsg) if self.isSuperGroup: - await sendMessage(self.message, f'{msg} Links has been sent to your inbox', iButton.build_menu(1)) + await sendMessage(self.message, f'{msg} Links has been sent to your inbox', callback.menu(1)) else: await deleteMessage(self.botpmmsg) if self.seed: diff --git a/bot/helper/mirror_leech_utils/rclone_utils/list.py b/bot/helper/mirror_leech_utils/rclone_utils/list.py index f017c7478..18a64ead1 100644 --- a/bot/helper/mirror_leech_utils/rclone_utils/list.py +++ b/bot/helper/mirror_leech_utils/rclone_utils/list.py @@ -152,31 +152,31 @@ async def get_path_buttons(self): else: ptype = 'fi' name = f"[{get_readable_file_size(idict['Size'])}] {idict['Path']}" - buttons.ibutton(name, f'rcq pa {ptype} {orig_index}') + buttons.callback(name, f'rcq pa {ptype} {orig_index}') if items_no > LIST_LIMIT: for i in [1, 2, 4, 6, 10, 30, 50, 100]: - buttons.ibutton(i, f'rcq ps {i}', position='header') - buttons.ibutton('Previous', 'rcq pre', position='footer') - buttons.ibutton('Next', 'rcq nex', position='footer') + buttons.callback(i, f'rcq ps {i}', position='header') + buttons.callback('Previous', 'rcq pre', position='footer') + buttons.callback('Next', 'rcq nex', position='footer') if self.list_status == 'rcd': if self.item_type == '--dirs-only': - buttons.ibutton( + buttons.callback( 'Files', 'rcq itype --files-only', position='footer') else: - buttons.ibutton( + buttons.callback( 'Folders', 'rcq itype --dirs-only', position='footer') if self.list_status == 'rcu' or len(self.path_list) > 0: - buttons.ibutton('Choose Current Path', + buttons.callback('Choose Current Path', 'rcq cur', position='footer') if self.list_status == 'rcu': - buttons.ibutton('Set as Default Path', + buttons.callback('Set as Default Path', 'rcq def', position='footer') if self.path or len(self.__sections) > 1 or self.__rc_user and self.__rc_owner: - buttons.ibutton('Back', 'rcq back pa', position='footer') + buttons.callback('Back', 'rcq back pa', position='footer') if self.path: - buttons.ibutton('Back To Root', 'rcq root', position='footer') - buttons.ibutton('Cancel', 'rcq cancel', position='footer') - button = buttons.build_menu(f_cols=2) + buttons.callback('Back To Root', 'rcq root', position='footer') + buttons.callback('Cancel', 'rcq cancel', position='footer') + button = buttons.menu(f_cols=2) msg = 'Choose Path:' + ('\nTransfer Type: Download' if self.list_status == 'rcd' else '\nTransfer Type: Upload') if self.list_status == 'rcu': @@ -235,11 +235,11 @@ async def list_remotes(self): msg += f'\nTimeout: {get_readable_time(self.__timeout-(time()-self.__time))}' buttons = ButtonMaker() for remote in self.__sections: - buttons.ibutton(remote, f'rcq re {remote}:') + buttons.callback(remote, f'rcq re {remote}:') if self.__rc_user and self.__rc_owner: - buttons.ibutton('Back', 'rcq back re', position='footer') - buttons.ibutton('Cancel', 'rcq cancel', position='footer') - button = buttons.build_menu(2) + buttons.callback('Back', 'rcq back re', position='footer') + buttons.callback('Cancel', 'rcq cancel', position='footer') + button = buttons.menu(2) await self.__send_list_message(msg, button) async def list_config(self): @@ -249,10 +249,10 @@ async def list_config(self): 'rcd' else '\nTransfer Type: Upload') msg += f'\nTimeout: {get_readable_time(self.__timeout-(time()-self.__time))}' buttons = ButtonMaker() - buttons.ibutton('Owner Config', 'rcq owner') - buttons.ibutton('My Config', 'rcq user') - buttons.ibutton('Cancel', 'rcq cancel') - button = buttons.build_menu(2) + buttons.callback('Owner Config', 'rcq owner') + buttons.callback('My Config', 'rcq user') + buttons.callback('Cancel', 'rcq cancel') + button = buttons.menu(2) await self.__send_list_message(msg, button) else: self.config_path = 'rcl.conf' if self.__rc_owner else self.user_rcc_path diff --git a/bot/helper/mirror_leech_utils/upload_utils/telegramEngine.py b/bot/helper/mirror_leech_utils/upload_utils/telegramEngine.py index d7fc6e03f..55cf76148 100644 --- a/bot/helper/mirror_leech_utils/upload_utils/telegramEngine.py +++ b/bot/helper/mirror_leech_utils/upload_utils/telegramEngine.py @@ -85,17 +85,17 @@ async def __buttons(self, up_path, is_video=False): buttons = ButtonMaker() try: if is_video and bool(self.__files_utils['screenshots']): - buttons.ubutton('SCREENSHOTS', await get_ss(up_path, self.__files_utils['screenshots'])) + buttons.url('SCREENSHOTS', await get_ss(up_path, self.__files_utils['screenshots'])) except Exception as e: LOGGER.error(f"ScreenShots Error: {e}") try: if self.__mediainfo: m = await get_mediainfo_link(up_path) - buttons.ubutton('MediaInfo', m) + buttons.url('MediaInfo', m) LOGGER.info(m) except Exception as e: LOGGER.error(f"MediaInfo Error: {str(e)}") - return buttons.build_menu(1) if self.__has_buttons else None + return buttons.menu(1) if self.__has_buttons else None async def __copy_file(self): try: diff --git a/bot/helper/telegram_helper/button_build.py b/bot/helper/telegram_helper/button_build.py index 8f81c6f44..1708430ff 100644 --- a/bot/helper/telegram_helper/button_build.py +++ b/bot/helper/telegram_helper/button_build.py @@ -6,7 +6,7 @@ def __init__(self): self.__header_button = [] self.__footer_button = [] - def ubutton(self, key, link, position=None): + def url(self, key, link, position=None): if not position: self.__button.append(InlineKeyboardButton(text=key, url=link)) elif position == 'header': @@ -16,7 +16,7 @@ def ubutton(self, key, link, position=None): self.__footer_button.append( InlineKeyboardButton(text=key, url=link)) - def ibutton(self, key, data, position=None): + def callback(self, key, data, position=None): if not position: self.__button.append(InlineKeyboardButton( text=key, callback_data=data)) @@ -27,7 +27,7 @@ def ibutton(self, key, data, position=None): self.__footer_button.append( InlineKeyboardButton(text=key, callback_data=data)) - def build_menu(self, b_cols=1, h_cols=8, f_cols=8): + def menu(self, b_cols=1, h_cols=8, f_cols=8): menu = [self.__button[i:i+b_cols] for i in range(0, len(self.__button), b_cols)] if self.__header_button: diff --git a/bot/helper/telegram_helper/message_utils.py b/bot/helper/telegram_helper/message_utils.py index 6e6523720..adb1908b2 100644 --- a/bot/helper/telegram_helper/message_utils.py +++ b/bot/helper/telegram_helper/message_utils.py @@ -288,7 +288,7 @@ async def forcesub(message, ids, button=None): button = ButtonMaker() _msg = "You haven't joined our channel/group yet!" for key, value in join_button.items(): - button.ubutton(f'Join {key}', value, 'footer') + button.url(f'Join {key}', value, 'footer') return _msg, button @@ -306,5 +306,5 @@ async def BotPm_check(message, button=None): if button is None: button = ButtonMaker() _msg = "You haven't initiated the bot in a private message!" - button.ibutton("Start", f"aeon {user_id} private", 'header') + button.callback("Start", f"aeon {user_id} private", 'header') return _msg, button diff --git a/bot/modules/bot_settings.py b/bot/modules/bot_settings.py index ce77ad206..5405adfe4 100644 --- a/bot/modules/bot_settings.py +++ b/bot/modules/bot_settings.py @@ -367,21 +367,21 @@ async def load_config(): async def get_buttons(key=None, edit_type=None, edit_mode=None, mess=None): buttons = ButtonMaker() if key is None: - buttons.ibutton('Config Variables', "botset var") - buttons.ibutton('Private Files', "botset private") - buttons.ibutton('Close', "botset close") + buttons.callback('Config Variables', "botset var") + buttons.callback('Private Files', "botset private") + buttons.callback('Close', "botset close") msg = 'Bot Settings:' elif key == 'var': for k in list(OrderedDict(sorted(config_dict.items())).keys())[START:10+START]: - buttons.ibutton(k, f"botset editvar {k}") - buttons.ibutton('Back', "botset back") - buttons.ibutton('Close', "botset close") + buttons.callback(k, f"botset editvar {k}") + buttons.callback('Back', "botset back") + buttons.callback('Close', "botset close") for x in range(0, len(config_dict)-1, 10): - buttons.ibutton(f'{int(x/10)+1}', f"botset start var {x}", position='footer') + buttons.callback(f'{int(x/10)+1}', f"botset start var {x}", position='footer') msg = f'Config Variables | Page: {int(START/10)+1}' elif key == 'private': - buttons.ibutton('Back', "botset back") - buttons.ibutton('Close', "botset close") + buttons.callback('Back', "botset back") + buttons.callback('Close', "botset close") msg = "Send private files: config.env, token.pickle, cookies.txt, accounts.zip, terabox.txt, .netrc, or any other files!\n\nTo delete a private file, send only the file name as a text message.\n\nPlease note: Changes to .netrc will not take effect for aria2c until it's restarted.\n\nTimeout: 60 seconds" elif edit_type == 'editvar': msg = f'Variable: {key}\n\n' @@ -389,16 +389,16 @@ async def get_buttons(key=None, edit_type=None, edit_mode=None, mess=None): if mess.chat.type == ChatType.PRIVATE: msg += f'Value: {config_dict.get(key, "None")}\n\n' elif key not in bool_vars: - buttons.ibutton('View value', f"botset showvar {key}", position="header") - buttons.ibutton('Back', "botset back var", position="footer") + buttons.callback('View value', f"botset showvar {key}", position="header") + buttons.callback('Back', "botset back var", position="footer") if key not in bool_vars: if not edit_mode: - buttons.ibutton('Edit Value', f"botset editvar {key} edit") + buttons.callback('Edit Value', f"botset editvar {key} edit") else: - buttons.ibutton('Stop Edit', f"botset editvar {key}") + buttons.callback('Stop Edit', f"botset editvar {key}") if key not in ['TELEGRAM_HASH', 'TELEGRAM_API', 'OWNER_ID', 'BOT_TOKEN'] and key not in bool_vars: - buttons.ibutton('Reset', f"botset resetvar {key}") - buttons.ibutton('Close', "botset close", position="footer") + buttons.callback('Reset', f"botset resetvar {key}") + buttons.callback('Close', "botset close", position="footer") if edit_mode and key in ['CMD_SUFFIX', 'OWNER_ID', 'USER_SESSION_STRING', 'TELEGRAM_HASH', @@ -410,10 +410,10 @@ async def get_buttons(key=None, edit_type=None, edit_mode=None, mess=None): msg += 'Send a valid value for the above Var. Timeout: 60 sec' if key in bool_vars: if not (value := config_dict.get(key)): - buttons.ibutton('Make it True', f"botset boolvar {key} on") + buttons.callback('Make it True', f"botset boolvar {key} on") else: - buttons.ibutton('Make it False', f"botset boolvar {key} off") - button = buttons.build_menu(1) if key is None else buttons.build_menu(2) + buttons.callback('Make it False', f"botset boolvar {key} off") + button = buttons.menu(1) if key is None else buttons.menu(2) return msg, button diff --git a/bot/modules/cancel_mirror.py b/bot/modules/cancel_mirror.py index 0409f0e01..b1addecd9 100644 --- a/bot/modules/cancel_mirror.py +++ b/bot/modules/cancel_mirror.py @@ -59,18 +59,18 @@ async def cancell_all_buttons(_, message): return buttons = ButtonMaker() - buttons.ibutton("Downloading", f"stopall {MirrorStatus.STATUS_DOWNLOADING}") - buttons.ibutton("Uploading", f"stopall {MirrorStatus.STATUS_UPLOADING}") - buttons.ibutton("Seeding", f"stopall {MirrorStatus.STATUS_SEEDING}") - buttons.ibutton("Cloning", f"stopall {MirrorStatus.STATUS_CLONING}") - buttons.ibutton("Extracting", f"stopall {MirrorStatus.STATUS_EXTRACTING}") - buttons.ibutton("Archiving", f"stopall {MirrorStatus.STATUS_ARCHIVING}") - buttons.ibutton("QueuedDl", f"stopall {MirrorStatus.STATUS_QUEUEDL}") - buttons.ibutton("QueuedUp", f"stopall {MirrorStatus.STATUS_QUEUEUP}") - buttons.ibutton("Paused", f"stopall {MirrorStatus.STATUS_PAUSED}") - buttons.ibutton("All", "stopall all") - buttons.ibutton("Close", "stopall close") - button = buttons.build_menu(2) + buttons.callback("Downloading", f"stopall {MirrorStatus.STATUS_DOWNLOADING}") + buttons.callback("Uploading", f"stopall {MirrorStatus.STATUS_UPLOADING}") + buttons.callback("Seeding", f"stopall {MirrorStatus.STATUS_SEEDING}") + buttons.callback("Cloning", f"stopall {MirrorStatus.STATUS_CLONING}") + buttons.callback("Extracting", f"stopall {MirrorStatus.STATUS_EXTRACTING}") + buttons.callback("Archiving", f"stopall {MirrorStatus.STATUS_ARCHIVING}") + buttons.callback("QueuedDl", f"stopall {MirrorStatus.STATUS_QUEUEDL}") + buttons.callback("QueuedUp", f"stopall {MirrorStatus.STATUS_QUEUEUP}") + buttons.callback("Paused", f"stopall {MirrorStatus.STATUS_PAUSED}") + buttons.callback("All", "stopall all") + buttons.callback("Close", "stopall close") + button = buttons.menu(2) can_msg = await sendMessage(message, 'Choose tasks to cancel.', button) await deleteMessage(message) await one_minute_del(can_msg) diff --git a/bot/modules/clone.py b/bot/modules/clone.py index f435426f6..34352e267 100644 --- a/bot/modules/clone.py +++ b/bot/modules/clone.py @@ -233,7 +233,7 @@ async def __run_multi(): for __i, __msg in enumerate(error_msg, 1): final_msg += f'\n
{__i}: {__msg}
' if error_button is not None: - error_button = error_button.build_menu(2) + error_button = error_button.menu(2) await delete_links(message) force_m = await sendMessage(message, final_msg, error_button) await five_minute_del(force_m) diff --git a/bot/modules/images.py b/bot/modules/images.py index 61832d20a..7b05e6a87 100644 --- a/bot/modules/images.py +++ b/bot/modules/images.py @@ -61,13 +61,13 @@ async def pictures(_, message): to_edit = await sendMessage(message, "Generating a grid of your images...") buttons = ButtonMaker() user_id = message.from_user.id - buttons.ibutton("<<", f"images {user_id} turn -1") - buttons.ibutton(">>", f"images {user_id} turn 1") - buttons.ibutton("Remove image", f"images {user_id} remove 0") - buttons.ibutton("Close", f"images {user_id} close") - buttons.ibutton("Remove all", f"images {user_id} removeall", 'footer') + buttons.callback("<<", f"images {user_id} turn -1") + buttons.callback(">>", f"images {user_id} turn 1") + buttons.callback("Remove image", f"images {user_id} remove 0") + buttons.callback("Close", f"images {user_id} close") + buttons.callback("Remove all", f"images {user_id} removeall", 'footer') await deleteMessage(to_edit) - await sendMessage(message, f'Image No. : 1 / {len(IMAGES)}', buttons.build_menu(2), IMAGES[0]) + await sendMessage(message, f'Image No. : 1 / {len(IMAGES)}', buttons.menu(2), IMAGES[0]) @new_task async def pics_callback(_, query): @@ -85,12 +85,12 @@ async def pics_callback(_, query): no = len(IMAGES) - abs(ind+1) if ind < 0 else ind + 1 pic_info = f'Image No. : {no} / {len(IMAGES)}' buttons = ButtonMaker() - buttons.ibutton("<<", f"images {data[1]} turn {ind-1}") - buttons.ibutton(">>", f"images {data[1]} turn {ind+1}") - buttons.ibutton("Remove Image", f"images {data[1]} remove {ind}") - buttons.ibutton("Close", f"images {data[1]} close") - buttons.ibutton("Remove all", f"images {data[1]} removeall", 'footer') - await editMessage(message, pic_info, buttons.build_menu(2), IMAGES[ind]) + buttons.callback("<<", f"images {data[1]} turn {ind-1}") + buttons.callback(">>", f"images {data[1]} turn {ind+1}") + buttons.callback("Remove Image", f"images {data[1]} remove {ind}") + buttons.callback("Close", f"images {data[1]} close") + buttons.callback("Remove all", f"images {data[1]} removeall", 'footer') + await editMessage(message, pic_info, buttons.menu(2), IMAGES[ind]) elif data[2] == "remove": IMAGES.pop(int(data[3])) @@ -107,12 +107,12 @@ async def pics_callback(_, query): ind = len(IMAGES) - abs(ind) if ind < 0 else ind pic_info = f'Image No. : {ind+1} / {len(IMAGES)}' buttons = ButtonMaker() - buttons.ibutton("<<", f"images {data[1]} turn {ind-1}") - buttons.ibutton(">>", f"images {data[1]} turn {ind+1}") - buttons.ibutton("Remove image", f"images {data[1]} remove {ind}") - buttons.ibutton("Close", f"images {data[1]} close") - buttons.ibutton("Remove all", f"images {data[1]} removeall", 'footer') - await editMessage(message, pic_info, buttons.build_menu(2), IMAGES[ind]) + buttons.callback("<<", f"images {data[1]} turn {ind-1}") + buttons.callback(">>", f"images {data[1]} turn {ind+1}") + buttons.callback("Remove image", f"images {data[1]} remove {ind}") + buttons.callback("Close", f"images {data[1]} close") + buttons.callback("Remove all", f"images {data[1]} removeall", 'footer') + await editMessage(message, pic_info, buttons.menu(2), IMAGES[ind]) elif data[2] == 'removeall': IMAGES.clear() diff --git a/bot/modules/list.py b/bot/modules/list.py index 203e144b7..6f8b56afd 100644 --- a/bot/modules/list.py +++ b/bot/modules/list.py @@ -11,12 +11,12 @@ async def list_buttons(user_id, isRecursive=True): buttons = ButtonMaker() - buttons.ibutton("Folders", f"list_types {user_id} folders {isRecursive}") - buttons.ibutton("Files", f"list_types {user_id} files {isRecursive}") - buttons.ibutton("Both", f"list_types {user_id} both {isRecursive}") - buttons.ibutton(f"Recursive: {isRecursive}", f"list_types {user_id} rec {isRecursive}") - buttons.ibutton("Cancel", f"list_types {user_id} cancel") - return buttons.build_menu(2) + buttons.callback("Folders", f"list_types {user_id} folders {isRecursive}") + buttons.callback("Files", f"list_types {user_id} files {isRecursive}") + buttons.callback("Both", f"list_types {user_id} both {isRecursive}") + buttons.callback(f"Recursive: {isRecursive}", f"list_types {user_id} rec {isRecursive}") + buttons.callback("Cancel", f"list_types {user_id} cancel") + return buttons.menu(2) async def _list_drive(key, message, item_type, isRecursive): LOGGER.info(f"listing: {key}") @@ -67,7 +67,7 @@ async def drive_list(_, message): if message.chat.type != message.chat.type.PRIVATE: msg, btn = await checking_access(user_id) if msg is not None: - reply_message = await sendMessage(message, msg, btn.build_menu(1)) + reply_message = await sendMessage(message, msg, btn.menu(1)) await delete_links(message) await five_minute_del(reply_message) return diff --git a/bot/modules/mirror_leech.py b/bot/modules/mirror_leech.py index bdc0b9b25..7aff02cb9 100644 --- a/bot/modules/mirror_leech.py +++ b/bot/modules/mirror_leech.py @@ -230,7 +230,7 @@ async def __run_multi(): for __i, __msg in enumerate(error_msg, 1): final_msg += f'\n
{__i}: {__msg}
' if error_button is not None: - error_button = error_button.build_menu(2) + error_button = error_button.menu(2) await delete_links(message) force_m = await sendMessage(message, final_msg, error_button) await five_minute_del(force_m) diff --git a/bot/modules/torrent_search.py b/bot/modules/torrent_search.py index de03112f2..216161a1c 100644 --- a/bot/modules/torrent_search.py +++ b/bot/modules/torrent_search.py @@ -97,8 +97,8 @@ async def __search(key, site, message, method): await sync_to_async(xnox_client.search_delete, search_id=search_id) link = await __getResult(search_results, key, message, method) buttons = ButtonMaker() - buttons.ubutton("View", link) - button = buttons.build_menu(1) + buttons.url("View", link) + button = buttons.menu(1) await editMessage(message, msg, button) @@ -173,18 +173,18 @@ async def __getResult(search_results, key, message, method): def __api_buttons(user_id, method): buttons = ButtonMaker() for data, name in SITES.items(): - buttons.ibutton(name, f"torser {user_id} {data} {method}") - buttons.ibutton("Cancel", f"torser {user_id} cancel") - return buttons.build_menu(2) + buttons.callback(name, f"torser {user_id} {data} {method}") + buttons.callback("Cancel", f"torser {user_id} cancel") + return buttons.menu(2) async def __plugin_buttons(user_id): buttons = ButtonMaker() for siteName in PLUGINS: - buttons.ibutton(siteName.capitalize(), f"torser {user_id} {siteName} plugin") - buttons.ibutton('All', f"torser {user_id} all plugin") - buttons.ibutton("Cancel", f"torser {user_id} cancel") - return buttons.build_menu(2) + buttons.callback(siteName.capitalize(), f"torser {user_id} {siteName} plugin") + buttons.callback('All', f"torser {user_id} all plugin") + buttons.callback("Cancel", f"torser {user_id} cancel") + return buttons.menu(2) @new_thread async def torrentSearch(_, message): @@ -195,7 +195,7 @@ async def torrentSearch(_, message): if message.chat.type != message.chat.type.PRIVATE: msg, buttons = await checking_access(user_id, buttons) if msg is not None: - reply_message = await sendMessage(message, msg, buttons.build_menu(1)) + reply_message = await sendMessage(message, msg, buttons.menu(1)) await delete_links(message) await five_minute_del(reply_message) return @@ -205,16 +205,16 @@ async def torrentSearch(_, message): await delete_links(message) return elif len(key) == 1: - buttons.ibutton('Trending', f"torser {user_id} apitrend") - buttons.ibutton('Recent', f"torser {user_id} apirecent") - buttons.ibutton("Cancel", f"torser {user_id} cancel") - button = buttons.build_menu(2) + buttons.callback('Trending', f"torser {user_id} apitrend") + buttons.callback('Recent', f"torser {user_id} apirecent") + buttons.callback("Cancel", f"torser {user_id} cancel") + button = buttons.menu(2) reply_message = await sendMessage(message, "Send a search key along with command", button) elif SITES is not None: - buttons.ibutton('Api', f"torser {user_id} apisearch") - buttons.ibutton('Plugins', f"torser {user_id} plugin") - buttons.ibutton("Cancel", f"torser {user_id} cancel") - button = buttons.build_menu(2) + buttons.callback('Api', f"torser {user_id} apisearch") + buttons.callback('Plugins', f"torser {user_id} plugin") + buttons.callback("Cancel", f"torser {user_id} cancel") + button = buttons.menu(2) reply_message = await sendMessage(message, 'Choose tool to search:', button) else: button = await __plugin_buttons(user_id) diff --git a/bot/modules/users_settings.py b/bot/modules/users_settings.py index b9737b1b8..e80c9de9d 100644 --- a/bot/modules/users_settings.py +++ b/bot/modules/users_settings.py @@ -42,30 +42,30 @@ async def get_user_settings(from_user, key=None, edit_type=None, edit_mode=None) rclone_path = f'tanha/{user_id}.conf' user_dict = user_data.get(user_id, {}) if key is None: - buttons.ibutton("Universal", f"userset {user_id} universal") - buttons.ibutton("Mirror", f"userset {user_id} mirror") - buttons.ibutton("Leech", f"userset {user_id} leech") + buttons.callback("Universal", f"userset {user_id} universal") + buttons.callback("Mirror", f"userset {user_id} mirror") + buttons.callback("Leech", f"userset {user_id} leech") if user_dict and any(key in user_dict for key in ['prefix', 'suffix', 'remname', 'ldump', 'yt_opt', 'media_group', 'rclone', 'thumb', 'as_doc', 'metadata', 'attachment']): - buttons.ibutton("Reset", f"userset {user_id} reset_all") - buttons.ibutton("Close", f"userset {user_id} close") + buttons.callback("Reset", f"userset {user_id} reset_all") + buttons.callback("Close", f"userset {user_id} close") text = f'User Settings for {name}' - button = buttons.build_menu(2) + button = buttons.menu(2) elif key == 'universal': - buttons.ibutton("YT-DLP Options", f"userset {user_id} yt_opt") + buttons.callback("YT-DLP Options", f"userset {user_id} yt_opt") ytopt = 'Not Exists' if (val:=user_dict.get('yt_opt', config_dict.get('YT_DLP_OPTIONS', ''))) == '' else val - buttons.ibutton("Prefix", f"userset {user_id} prefix") + buttons.callback("Prefix", f"userset {user_id} prefix") prefix = user_dict.get('prefix', 'Not Exists') - buttons.ibutton("Suffix", f"userset {user_id} suffix") + buttons.callback("Suffix", f"userset {user_id} suffix") suffix = user_dict.get('suffix', 'Not Exists') - buttons.ibutton("Remname", f"userset {user_id} remname") + buttons.callback("Remname", f"userset {user_id} remname") remname = user_dict.get('remname', 'Not Exists') - buttons.ibutton("Metadata", f"userset {user_id} metadata") + buttons.callback("Metadata", f"userset {user_id} metadata") metadata = user_dict.get('metadata', 'Not Exists') - buttons.ibutton("Attachment", f"userset {user_id} attachment") + buttons.callback("Attachment", f"userset {user_id} attachment") attachment = user_dict.get('attachment', 'Not Exists') @@ -76,48 +76,48 @@ async def get_user_settings(from_user, key=None, edit_type=None, edit_mode=None) text += f'• Metadata: {metadata}\n' text += f'• Attachment: {attachment}\n' text += f'• Remname: {remname}' - buttons.ibutton("Back", f"userset {user_id} back", "footer") - buttons.ibutton("Close", f"userset {user_id} close", "footer") - button = buttons.build_menu(2) + buttons.callback("Back", f"userset {user_id} back", "footer") + buttons.callback("Close", f"userset {user_id} close", "footer") + button = buttons.menu(2) elif key == 'mirror': - buttons.ibutton("RClone", f"userset {user_id} rcc") + buttons.callback("RClone", f"userset {user_id} rcc") rccmsg = "Exists" if await aiopath.exists(rclone_path) else "Not Exists" tds_mode = "Enabled" if user_dict.get('td_mode') else "Disabled" user_tds = len(val) if (val := user_dict.get('user_tds', False)) else 0 - buttons.ibutton("User TDs", f"userset {user_id} user_tds") + buttons.callback("User TDs", f"userset {user_id} user_tds") text = f'Mirror Settings for {name}\n\n' text += f'• Rclone Config: {rccmsg}\n' text += f'• User TD Mode: {tds_mode}' - buttons.ibutton("Back", f"userset {user_id} back", "footer") - buttons.ibutton("Close", f"userset {user_id} close", "footer") - button = buttons.build_menu(2) + buttons.callback("Back", f"userset {user_id} back", "footer") + buttons.callback("Close", f"userset {user_id} close", "footer") + button = buttons.menu(2) elif key == 'leech': if user_dict.get('as_doc', False) or 'as_doc' not in user_dict and config_dict['AS_DOCUMENT']: ltype = "DOCUMENT" - buttons.ibutton("Send As Media", f"userset {user_id} doc") + buttons.callback("Send As Media", f"userset {user_id} doc") else: ltype = "MEDIA" - buttons.ibutton("Send As Document", f"userset {user_id} doc") + buttons.callback("Send As Document", f"userset {user_id} doc") mediainfo = "Enabled" if user_dict.get('mediainfo', config_dict['SHOW_MEDIAINFO']) else "Disabled" - buttons.ibutton('Disable MediaInfo' if mediainfo == 'Enabled' else 'Enable MediaInfo', f"userset {user_id} mediainfo") + buttons.callback('Disable MediaInfo' if mediainfo == 'Enabled' else 'Enable MediaInfo', f"userset {user_id} mediainfo") if config_dict['SHOW_MEDIAINFO']: mediainfo = "Force Enabled" - buttons.ibutton("Thumbnail", f"userset {user_id} thumb") + buttons.callback("Thumbnail", f"userset {user_id} thumb") thumbmsg = "Exists" if await aiopath.exists(thumbpath) else "Not Exists" if user_dict.get('media_group', False) or ('media_group' not in user_dict and config_dict['MEDIA_GROUP']): - buttons.ibutton("Disable Media Group", f"userset {user_id} mgroup") + buttons.callback("Disable Media Group", f"userset {user_id} mgroup") else: - buttons.ibutton("Enable Media Group", f"userset {user_id} mgroup") + buttons.callback("Enable Media Group", f"userset {user_id} mgroup") media_group = 'Enabled' if user_dict.get('media_group', config_dict.get('MEDIA_GROUP')) else 'Disabled' - buttons.ibutton("Leech Caption", f"userset {user_id} lcaption") + buttons.callback("Leech Caption", f"userset {user_id} lcaption") lcaption = user_dict.get('lcaption', 'Not Exists') - buttons.ibutton("Leech Dump", f"userset {user_id} ldump") + buttons.callback("Leech Dump", f"userset {user_id} ldump") ldump = 'Not Exists' if (val:=user_dict.get('ldump', '')) == '' else val SPLIT_SIZE = '4GB' if IS_PREMIUM_USER else '2GB' @@ -130,9 +130,9 @@ async def get_user_settings(from_user, key=None, edit_type=None, edit_mode=None) text += f'• Leech Dump: {ldump}\n' text += f'• MediaInfo Mode: {mediainfo}' - buttons.ibutton("Back", f"userset {user_id} back", "footer") - buttons.ibutton("Close", f"userset {user_id} close", "footer") - button = buttons.build_menu(2) + buttons.callback("Back", f"userset {user_id} back", "footer") + buttons.callback("Close", f"userset {user_id} close", "footer") + button = buttons.menu(2) elif edit_type: text = f"{fname_dict[key]} Settings :\n\n" if key == 'rcc': @@ -150,23 +150,23 @@ async def get_user_settings(from_user, key=None, edit_type=None, edit_mode=None) elif key == 'user_tds': set_exist = len(val) if (val:=user_dict.get(key, False)) else 'Not Exists' tds_mode = "Enabled" if user_dict.get('td_mode') else "Disabled" - buttons.ibutton('Disable UserTDs' if tds_mode == 'Enabled' else 'Enable UserTDs', f"userset {user_id} td_mode", "header") + buttons.callback('Disable UserTDs' if tds_mode == 'Enabled' else 'Enable UserTDs', f"userset {user_id} td_mode", "header") text += f"User TD Mode: {tds_mode}\n" else: return text += f"Description : {uset_display_dict[key][0]}" if edit_mode: text += '\n\n' + uset_display_dict[key][1] - buttons.ibutton("Stop", f"userset {user_id} {key}") + buttons.callback("Stop", f"userset {user_id} {key}") elif key != 'user_tds' or set_exist == 'Not Exists': - buttons.ibutton("Change" if set_exist and set_exist != 'Not Exists' else "Set", f"userset {user_id} {key} edit") + buttons.callback("Change" if set_exist and set_exist != 'Not Exists' else "Set", f"userset {user_id} {key} edit") if set_exist and set_exist != 'Not Exists': if key == 'user_tds': - buttons.ibutton('Show', f"userset {user_id} show_tds", "header") - buttons.ibutton("Delete", f"userset {user_id} d{key}") - buttons.ibutton("Back", f"userset {user_id} back {edit_type}", "footer") - buttons.ibutton("Close", f"userset {user_id} close", "footer") - button = buttons.build_menu(2) + buttons.callback('Show', f"userset {user_id} show_tds", "header") + buttons.callback("Delete", f"userset {user_id} d{key}") + buttons.callback("Back", f"userset {user_id} back {edit_type}", "footer") + buttons.callback("Close", f"userset {user_id} close", "footer") + button = buttons.menu(2) return text, button @@ -463,10 +463,10 @@ async def edit_user_settings(client, query): handler_dict[user_id] = False await query.answer() buttons = ButtonMaker() - buttons.ibutton('Yes', f"userset {user_id} reset_now y") - buttons.ibutton('No', f"userset {user_id} reset_now n") - buttons.ibutton("Close", f"userset {user_id} close", "footer") - await editMessage(message, 'Do you want to Reset Settings ?', buttons.build_menu(2)) + buttons.callback('Yes', f"userset {user_id} reset_now y") + buttons.callback('No', f"userset {user_id} reset_now n") + buttons.callback("Close", f"userset {user_id} close", "footer") + await editMessage(message, 'Do you want to Reset Settings ?', buttons.menu(2)) elif data[2] == 'reset_now': handler_dict[user_id] = False if data[3] == 'n': @@ -519,8 +519,8 @@ async def send_users_settings(client, message): if not userid: msg = f'Total Users / Chats Data Saved : {len(user_data)}' buttons = ButtonMaker() - buttons.ibutton("Close", f"userset {message.from_user.id} close") - button = buttons.build_menu(1) + buttons.callback("Close", f"userset {message.from_user.id} close") + button = buttons.menu(1) for user, data in user_data.items(): msg += f'\n\n{user}:' if data: @@ -540,9 +540,9 @@ async def send_users_settings(client, message): msg = f'{await getUserInfo(client, userid)} ( {userid} ):' if data := user_data[int(userid)]: buttons = ButtonMaker() - buttons.ibutton("Delete", f"userset {message.from_user.id} user_del {userid}") - buttons.ibutton("Close", f"userset {message.from_user.id} close") - button = buttons.build_menu(1) + buttons.callback("Delete", f"userset {message.from_user.id} user_del {userid}") + buttons.callback("Close", f"userset {message.from_user.id} close") + button = buttons.menu(1) for key, value in data.items(): if key in ['token', 'time']: continue diff --git a/bot/modules/ytdlp.py b/bot/modules/ytdlp.py index dbe1c953b..18c859310 100644 --- a/bot/modules/ytdlp.py +++ b/bot/modules/ytdlp.py @@ -99,17 +99,17 @@ async def get_quality(self, result): video_format = f'bv*[height<=?{i}][ext=mp4]+ba[ext=m4a]/b[height<=?{i}]' b_data = f'{i}|mp4' self.formats[b_data] = video_format - buttons.ibutton(f'{i}-mp4', f'ytq {b_data}') + buttons.callback(f'{i}-mp4', f'ytq {b_data}') video_format = f'bv*[height<=?{i}][ext=webm]+ba/b[height<=?{i}]' b_data = f'{i}|webm' self.formats[b_data] = video_format - buttons.ibutton(f'{i}-webm', f'ytq {b_data}') - buttons.ibutton('MP3', 'ytq mp3') - buttons.ibutton('Audio Formats', 'ytq audio') - buttons.ibutton('Best Videos', 'ytq bv*+ba/b') - buttons.ibutton('Best Audios', 'ytq ba/b') - buttons.ibutton('Cancel', 'ytq cancel', 'footer') - self.__main_buttons = buttons.build_menu(3) + buttons.callback(f'{i}-webm', f'ytq {b_data}') + buttons.callback('MP3', 'ytq mp3') + buttons.callback('Audio Formats', 'ytq audio') + buttons.callback('Best Videos', 'ytq bv*+ba/b') + buttons.callback('Best Audios', 'ytq ba/b') + buttons.callback('Cancel', 'ytq cancel', 'footer') + self.__main_buttons = buttons.menu(3) msg = f'Choose Playlist Videos Quality:\nTimeout: {get_readable_time(self.__timeout-(time()-self.__time), True)}' else: format_dict = result.get('formats') @@ -147,15 +147,15 @@ async def get_quality(self, result): if len(tbr_dict) == 1: tbr, v_list = next(iter(tbr_dict.items())) buttonName = f'{b_name} ({get_readable_file_size(v_list[0])})' - buttons.ibutton(buttonName, f'ytq sub {b_name} {tbr}') + buttons.callback(buttonName, f'ytq sub {b_name} {tbr}') else: - buttons.ibutton(b_name, f'ytq dict {b_name}') - buttons.ibutton('MP3', 'ytq mp3') - buttons.ibutton('Audio Formats', 'ytq audio') - buttons.ibutton('Best Video', 'ytq bv*+ba/b') - buttons.ibutton('Best Audio', 'ytq ba/b') - buttons.ibutton('Cancel', 'ytq cancel', 'footer') - self.__main_buttons = buttons.build_menu(2) + buttons.callback(b_name, f'ytq dict {b_name}') + buttons.callback('MP3', 'ytq mp3') + buttons.callback('Audio Formats', 'ytq audio') + buttons.callback('Best Video', 'ytq bv*+ba/b') + buttons.callback('Best Audio', 'ytq ba/b') + buttons.callback('Cancel', 'ytq cancel', 'footer') + self.__main_buttons = buttons.menu(2) msg = f'Choose Video Quality:\nTimeout: {get_readable_time(self.__timeout-(time()-self.__time), True)}' self.__reply_to = await sendMessage(self.__message, msg, self.__main_buttons) await wrap_future(future) @@ -175,10 +175,10 @@ async def qual_subbuttons(self, b_name): tbr_dict = self.formats[b_name] for tbr, d_data in tbr_dict.items(): button_name = f'{tbr}K ({get_readable_file_size(d_data[0])})' - buttons.ibutton(button_name, f'ytq sub {b_name} {tbr}') - buttons.ibutton('Back', 'ytq back', 'footer') - buttons.ibutton('Cancel', 'ytq cancel', 'footer') - subbuttons = buttons.build_menu(2) + buttons.callback(button_name, f'ytq sub {b_name} {tbr}') + buttons.callback('Back', 'ytq back', 'footer') + buttons.callback('Cancel', 'ytq cancel', 'footer') + subbuttons = buttons.menu(2) msg = f'Choose Bit rate for {b_name}:\nTimeout: {get_readable_time(self.__timeout-(time()-self.__time), True)}' await editMessage(self.__reply_to, msg, subbuttons) @@ -188,10 +188,10 @@ async def mp3_subbuttons(self): audio_qualities = [64, 128, 320] for q in audio_qualities: audio_format = f'ba/b-mp3-{q}' - buttons.ibutton(f'{q}K-mp3', f'ytq {audio_format}') - buttons.ibutton('Back', 'ytq back') - buttons.ibutton('Cancel', 'ytq cancel') - subbuttons = buttons.build_menu(3) + buttons.callback(f'{q}K-mp3', f'ytq {audio_format}') + buttons.callback('Back', 'ytq back') + buttons.callback('Cancel', 'ytq cancel') + subbuttons = buttons.menu(3) msg = f'Choose mp3 Audio{i} Bitrate:\nTimeout: {get_readable_time(self.__timeout-(time()-self.__time), True)}' await editMessage(self.__reply_to, msg, subbuttons) @@ -200,10 +200,10 @@ async def audio_format(self): buttons = ButtonMaker() for frmt in ['aac', 'alac', 'flac', 'm4a', 'opus', 'vorbis', 'wav']: audio_format = f'ba/b-{frmt}-' - buttons.ibutton(frmt, f'ytq aq {audio_format}') - buttons.ibutton('Back', 'ytq back', 'footer') - buttons.ibutton('Cancel', 'ytq cancel', 'footer') - subbuttons = buttons.build_menu(3) + buttons.callback(frmt, f'ytq aq {audio_format}') + buttons.callback('Back', 'ytq back', 'footer') + buttons.callback('Cancel', 'ytq cancel', 'footer') + subbuttons = buttons.menu(3) msg = f'Choose Audio{i} Format:\nTimeout: {get_readable_time(self.__timeout-(time()-self.__time), True)}' await editMessage(self.__reply_to, msg, subbuttons) @@ -212,10 +212,10 @@ async def audio_quality(self, format): buttons = ButtonMaker() for qual in range(11): audio_format = f'{format}{qual}' - buttons.ibutton(qual, f'ytq {audio_format}') - buttons.ibutton('Back', 'ytq aq back') - buttons.ibutton('Cancel', 'ytq aq cancel') - subbuttons = buttons.build_menu(5) + buttons.callback(qual, f'ytq {audio_format}') + buttons.callback('Back', 'ytq aq back') + buttons.callback('Cancel', 'ytq aq cancel') + subbuttons = buttons.menu(5) msg = f'Choose Audio{i} Qaulity:\n0 is best and 10 is worst\nTimeout: {get_readable_time(self.__timeout-(time()-self.__time), True)}' await editMessage(self.__reply_to, msg, subbuttons) @@ -377,7 +377,7 @@ async def __run_multi(): for __i, __msg in enumerate(error_msg, 1): final_msg += f'\n
{__i}: {__msg}
' if error_button is not None: - error_button = error_button.build_menu(2) + error_button = error_button.menu(2) await delete_links(message) force_m = await sendMessage(message, final_msg, error_button) await five_minute_del(force_m)