Answer the question
In order to leave comments, you need to log in
How to display a message on Timeout Discord.py error?
I want to make it so that when the response time runs out, an error appears: " Command raised an exception: TimeoutError: ", and with this error, the channel in which the command was first issued a message about this error.
@bot.command(aliases = ['item-create', 'create-item', 'ic', 'ci'])
@commands.has_permissions(administrator= True)
async def _create_item(ctx, name : str = None, description : str = None, role: discord.Role = None, price: int = None):
if role or name or description or price == None:
embed = discord.Embed(title='Информация о предмете', colour=discord.Colour.from_rgb(0, 191, 255))
embed.add_field(name='Название', value='')
embed.set_footer(text='Введите cancel, чтобы выйти.')
msg = await ctx.send(':one: Как назвать данный предмет? Придумайте уникальное имя!', embed=embed)
await bot.wait_for('message', timeout=15, check=lambda message: message.author == ctx.author)
Answer the question
In order to leave comments, you need to log in
try:
await bot.wait_for('message', timeout=15, check=lambda message: message.author == ctx.author)
except asyncio.TimeoutError:
await ctx.send(content = "Время на ответ вышло.")
return
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question