重复消息时出错

2024-06-02 10:36:09 发布

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

我有这个事件来捕捉错误

@bot.event
async def on_command_error(msg,error):
    if error.args[0] == 'The check functions for command hi failed.':
        await msg.send("{} **is not an NSFW channel**".format(msg.channel.mention))

@commands.is_nsfw()
@bot.command()
async def hi(msg):
    msg.send("OK")

当事件捕捉到错误时,它会继续发送相同的消息两次。 例如,它将发送#频道名称不是NSFW频道

我用的是不和谐.py你知道吗

提前谢谢你的帮助


Tags: eventsendasyncisdefbot错误channel