小编Mih*_*ian的帖子

如果用户在拥有特定角色时离开服务器,则禁止该用户 discord.py

我想这样做,如果用户在他们拥有Muted[Banned]角色被永久禁止的情况下离开服务器。

这是我试过的代码:

@bot.event
async def on_member_remove(ctx, member, reason=None):
    role="[Banned]"
    guild = ctx.guild
    if role in member.roles:
        await guild.ban(discord.Object(id=member.id), reason="Leaved the server when soft banned")
Run Code Online (Sandbox Code Playgroud)

*这只是一个尝试,只有被禁止的角色。

用户不会被禁止,也没有错误或任何可以帮助我解决问题的内容。

python discord discord.py

1
推荐指数
1
解决办法
53
查看次数

标签 统计

discord ×1

discord.py ×1

python ×1