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