【发布时间】:2020-05-26 09:53:33
【问题描述】:
我的禁止命令有问题,我的管理员可以互相禁止,我不希望这样,但我不知道如何在我的代码中修复它
#Ban command
@client.command()
@commands.has_permissions(ban_members=True)
async def ban(ctx, member : discord.Member, *, reason=None):
await member.ban(reason=reason)
await ctx.send(f'{user.mention} has been banned!')
我希望它变成这样,但我对 python 很陌生,我不知道如何编写它(注释部分)
#Ban command
@client.command()
@commands.has_permissions(ban_members=True)
async def ban(ctx, member : discord.Member, *, reason=None):
#if mentioned user has the same role as the author:
await ctx.send('Cant ban Moderators/Admins')
else:
await member.ban(reason=reason)
await ctx.send(f'{user.mention} has been banned!')
【问题讨论】:
标签: python python-3.x discord discord.py discord.py-rewrite