如何发送命令在discord.py中排队的错误消息

2024-05-18 06:34:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用此命令对命令进行排队

@commands.max_concurrency(1, per=BucketType.guild, wait=True)

我有没有办法发送消息说你已经排队了

如果我将其设置为false,我可以发送一条错误消息,但用户将不得不再次发送该命令,因为它不会排队

@bot.event
async def on_command_error(context, error):
    if isinstance(error, commands.MaxConcurrencyReached):
        embed = discord.Embed(
            title="Error!",
            description="Please wait for the previous job to finish!",
            color=0xE02B2B
        )
        await context.send(embed=embed)

我希望它发送一条消息“请等待上一个作业完成!”然后将其添加到队列中


Tags: 命令true消息contexterrorembedmaxcommands