Added exit confirmation

This commit is contained in:
Adriene Hutchins 2020-02-19 19:11:39 -05:00
parent 893b66c8dc
commit c594fcdc7b
1 changed files with 2 additions and 1 deletions

View File

@ -71,6 +71,7 @@ async def search(ctx, *, query: str):
@bot.command(aliases=['exit', 'reboot'])
@commands.is_owner()
async def restart(ctx):
await ctx.send(':zzz: **Restarting.**')
exit()
@bot.command()
@ -110,7 +111,6 @@ async def search_logic(query: str, type: str = None):
with open('searxes.txt') as f:
bot.instances = f.read().split('\n')
instance = random.sample(bot.instances, k=1)[0]
bot.instances.remove(instance)
print(f"Attempting to use {instance}")
# Error Template
@ -143,6 +143,7 @@ async def search_logic(query: str, type: str = None):
except (KeyError, IndexError) as e:
# Reached if error with returned results
print(f"{e} with instance {instance}, trying again.")
bot.instances.remove(instance)
return await search_logic(query) # Recurse until good response
# Send message