【发布时间】:2021-08-22 16:19:58
【问题描述】:
我的代码:
#Ban command
@bot.command()
async def ban(ctx, member : discord.Member, *, reason='nothing'):
#to check if user has permissions
if has_permissions(ban_members=True):
#to not let admins ban each other
check = False
for i in member.roles:
if i in ctx.author.roles[1:]:
check = True
if(check):
await ctx.send('❌ Cant ban admins/moderators.')
else:
await member.ban(reason=reason)
await ctx.send(f'✓ {member} has been banned')
else:
await ctx.send(' you dont have that permission')
问题是没有权限的用户如果使用该命令不会打印:you don't have that permission,我得到一个错误。
【问题讨论】:
-
错误是什么?
标签: discord.py