【发布时间】:2021-07-30 16:47:11
【问题描述】:
我即将为我的 Discord Bot 编写两个单独的帮助命令。 Ohne 当用户具有踢权限时应该显示,如果用户没有,则应该显示另一个。我的代码如下所示:
@commands.command(aliases=['Help'])
@has_permissions(kick_members = True)
async def help(self, ctx):
await ctx.message.delete()
print("you have permissions")
@help.error
async def Help(self, error, ctx):
await ctx.message.delete()
print("you have no permissions")
但是当没有权限的人尝试运行该命令时,控制台会引发此错误:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'MissingPermissions' object has no attribute 'message'
我现在的问题是:如何删除邮件?
【问题讨论】:
标签: python discord.py