Python 我的机器人发出两条不同的错误消息
每当出现错误时,我的bot会将控制台错误发送到执行命令的通道。我最近创建了一个检查,它也会发送一条错误消息,这次是我自己写的消息。我面临的问题是,这两条错误消息都是在通道中发送的。如果我指定了一个检查,是否有任何方法可以得到它,这样它就不会发送控制台错误 主要错误处理程序:Python 我的机器人发出两条不同的错误消息,python,python-3.x,discord,discord.py,Python,Python 3.x,Discord,Discord.py,每当出现错误时,我的bot会将控制台错误发送到执行命令的通道。我最近创建了一个检查,它也会发送一条错误消息,这次是我自己写的消息。我面临的问题是,这两条错误消息都是在通道中发送的。如果我指定了一个检查,是否有任何方法可以得到它,这样它就不会发送控制台错误 主要错误处理程序: async def on_command_error(self, ctx: commands.Context, exc): if isinstance(exc, commands.CommandNot
async def on_command_error(self, ctx: commands.Context, exc):
if isinstance(exc, commands.CommandNotFound):
return
log.error("", exc_info=exc)
await ctx.send(exc)
支票:
async def notblacklisted(ctx):
blrole = discord.utils.get(ctx.guild.roles, id=blacklistrole)
return blrole not in ctx.author.roles