发出脚踢命令

时间:2020-10-05 23:05:33

标签: python-3.x discord.py

我正在执行“禁止命令”,这里有一个明显的问题 真的很傻,所以我需要帮助。

@client.command()
@commands.has_permissions(kick_members=True)
@client.has_permissions(kick_members=True)
async def kick(ctx, user, *, reason):
    try:
        await user.ban(delete_messages_days=4)
    except:
        print('USER BAN ATTEMPT FAILED.')
        ctx.send("I can't ban {}".format(user))

1 个答案:

答案 0 :(得分:1)

在命令kick_membersban_members上使用@commands.has_permissions装饰器:

@bot.command()
@commands.has_permissions(kick_members=True, ban_members=True)
async def command(ctx):
    pass