while condition:
try:
msg = await self.client.wait_for('message', check=check, timeout = 60)
except asyncio.TimeoutError:
condition = False
break
else:
my_num = msg.content.split(' ')
if len(my_num) > 2:
await ctx.send("Seems like you added too many arguments... Only use `category` `number`", delete_after=2)
category = my_num[0]
try:
index = int(my_num[1])
except ValueError:
await ctx.send("The second argument needs to be an integer", delete_after=2)
except IndexError:
await ctx.send("Provide two arguments: `category` `number` (example: plants 3)")
if category.lower() == "plants":
try:
my_query = new_list[index-1]
except IndexError:
await ctx.send("the number you wrote doesn't exist!", delete_after=2)
queried_potion = all_items[my_query]
try:
signs = queried_potion['sign']
except KeyError:
signs = []
try:
symbols = queried_potion['symbol']
except KeyError:
symbols = []
sign = " | ".join(signs) if len(signs) != 0 else "None"
symbol = " | ".join(symbols) if len(symbols) != 0 else "None"
em = discord.Embed(title=f"Information for: {my_query}", description= f"**Symbols:** \n{symbol} \n\n**Signs:**\n {sign}", color = self.client.theme)
await mess.edit(embed=em)
Above is my code which I wrote for someone, the loop does what I was intending for it to do but there is something wrong. After the "wait_for" times out, the bot crashes for some reason. I can't seem to find any reason as to why.
All variables used are defined, and there are no errors the bot just dies after it times out.
Any idea why that might be?
Image of terminal after bot crashed: [edit]


while condition:? It looks likeawait self.client.wait_forraisesasyncio.TimeoutErrorand therefore exits your while-statement after the timeout.