Fix keyerror

This commit is contained in:
nex 2023-01-09 14:45:57 +00:00
parent 630c9391ee
commit 5a1c75f8e4

View file

@ -400,10 +400,8 @@ class OtherCog(commands.Cog):
return_when=asyncio.FIRST_COMPLETED, return_when=asyncio.FIRST_COMPLETED,
) )
done_tasks = done done_tasks = done
done = done_tasks or pending
done = pending or done_tasks
try: try:
done = done.pop() done = done_tasks.pop()
except KeyError: except KeyError:
return await ctx.respond( return await ctx.respond(
"Something went wrong. Try again?\n" "Something went wrong. Try again?\n"
@ -418,7 +416,7 @@ class OtherCog(commands.Cog):
await asyncio.sleep(1) await asyncio.sleep(1)
await ctx.edit(content=f"Preparing to screenshot {friendly_url}... (16%)") await ctx.edit(content=f"Preparing to screenshot {friendly_url}... (16%)")
okay = await pending.pop() okay = await (pending or done_tasks).pop()
if okay is not True: if okay is not True:
return await ctx.edit( return await ctx.edit(
content="That domain is blacklisted, doesn't exist, or there was no answer from the DNS server." content="That domain is blacklisted, doesn't exist, or there was no answer from the DNS server."