📌  相关文章
📜  discord.py 检查用户是否有角色 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:58.018000             🧑  作者: Mango

代码示例1
@bot.command(pass_context=True)
    @commands.has_role("Admin")
    async def unmute(ctx, user: discord.Member):
        role = discord.utils.find(lambda r: r.name == 'Member', ctx.message.server.roles)
        if role in user.roles:
            await bot.say("{} is not muted".format(user))
        else:
            await bot.add_roles(user, role)