Fixed /list command

This commit is contained in:
Hafitz Setya 2021-03-01 11:18:11 +07:00 committed by GitHub
parent a6e3482878
commit 11e9b2cad6
Signed by untrusted user: GitHub
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,20 +8,19 @@ from bot.helper.telegram_helper.bot_commands import BotCommands
@run_async
def list_drive(update,context):
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)
if update.message.text == f'/{BotCommands.ListCommand}':
sendMessage(f'Send a search key along with {BotCommands.ListCommand} command', context.bot, update)
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)
if msg:
editMessage(msg, reply)
else:
editMessage('No result found', reply)
except IndexError:
sendMessage('Send a search key along with command', context.bot, update)
threading.Thread(target=auto_delete_message, args=(context.bot, update.message, reply_message)).start()
list_handler = CommandHandler(BotCommands.ListCommand, list_drive,filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)