diff --git a/bot/modules/list.py b/bot/modules/list.py index 24a641c..151c53f 100644 --- a/bot/modules/list.py +++ b/bot/modules/list.py @@ -8,17 +8,20 @@ from bot.helper.telegram_helper.bot_commands import BotCommands @run_async def list_drive(update,context): - message = update.message.text - search = message.split(' ',maxsplit=1)[1] - LOGGER.info(f"Searching: {search}") - gdrive = GoogleDriveHelper(None) - msg = gdrive.drive_list(search) - if msg: - reply_message = sendMessage(msg, context.bot, update) - else: - reply_message = sendMessage('No result found', context.bot, update) + try: + search = update.message.text.split(' ',maxsplit=1)[1] + LOGGER.info(f"Searching: {search}") + reply = sendMessage('Searching..... Please wait!', context.bot, update) + gdrive = GoogleDriveHelper(None) + msg, button = gdrive.drive_list(search) - threading.Thread(target=auto_delete_message, args=(context.bot, update.message, reply_message)).start() + if msg: + editMessage(msg, reply) + else: + editMessage('No result found', reply) + + except IndexError: + sendMessage('Send a search key along with command', context.bot, update) list_handler = CommandHandler(BotCommands.ListCommand, list_drive,filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)