discord.py覆盖create_text_channel权限

时间:2020-08-12 17:52:53

标签: python discord embed discord.py ejabberd-hooks

overwrites = {
    guild.default_role: discord.PermissionOverwrite(read_messages=False),
    guild.me: discord.PermissionOverwrite(read_messages=True)
}

channel = await guild.create_text_channel('secret', overwrites=overwrites

我想添加公会。(用户ID),并且有权读取消息true,请提供帮助,如果您知道该怎么做,我需要它仅使用用户ID添加特定用户

1 个答案:

答案 0 :(得分:0)

您可以使用get_member获取Member对象:

overwrites = {
    guild.default_role: discord.PermissionOverwrite(read_messages=False),
    guild.me: discord.PermissionOverwrite(read_messages=True),
    guild.get_member(id): discord.PermissionOverwrite(read_messages=True),
}