Python Discord.py Err0r处理程序
我有一个错误处理函数:Python Discord.py Err0r处理程序,python,discord,discord.py,Python,Discord,Discord.py,我有一个错误处理函数: @clear.error async def clear_error(error, ctx): if isinstance(error, MissingPermissions): await ctx.send(f'Sorry {ctx.author.mention}, you do not have permissions to do that!') 感谢阿卜杜勒·阿齐兹,他给了我这个 但是它不起作用首先,您需要从discord.ext导入命令。
@clear.error
async def clear_error(error, ctx):
if isinstance(error, MissingPermissions):
await ctx.send(f'Sorry {ctx.author.mention}, you do not have permissions to do that!')
感谢阿卜杜勒·阿齐兹,他给了我这个
但是它不起作用首先,您需要从
discord.ext
导入命令。然后,将isinstance(错误,缺少权限):
替换为isinstance(错误,命令。缺少权限):
代码应该如下所示:
from discord.ext import commands
@clear.error
async def clear_error(error, ctx):
if isinstance(error, commands.MissingPermissions):
await ctx.send(f'Sorry {ctx.author.mention}, you do not have permissions to do that!')```
“不起作用”是对这个问题的糟糕描述。你有错误吗?它有什么用吗?一个小精灵会来偷你的午餐吗?不,我没有任何错误,它不会做任何事情,它只对任何人有效