📜  仅响应某些角色 discord.py - Python 代码示例的机器人

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

代码示例1
if message.content.lower().startswith('/role'):
    user = message.author

    if message.channel.is_private or discord.utils.get(user.roles, name="admin") is None:
        return

    role = discord.utils.get(user.server.roles, id="437923291047526402")
    await client.add_roles(user, role)