【发布时间】:2021-08-04 21:25:03
【问题描述】:
我一直在尝试创建具有特定权限的频道。 一切似乎都很好,但是当我进入新创建频道的设置时,它似乎没有任何效果。权限同步和覆盖都不会影响频道。这是为什么 ? 我的代码:
role = discord.utils.get(ctx.guild.roles, name=arg.title())
if role is None:
role = await ctx.guild.create_role(name=arg.title())
channel = discord.utils.get(ctx.guild.voice_channels, name=arg.title())
if channel:
if channel not in category.voice_channels:
await channel.move(category=category, beginning=True)
await channel.set_permissions(role, connect=True, view_channel=True)
await channel.set_permissions(ctx.guild.default_role, connect=False, view_channel=False)
else:
overwrites = {
ctx.guild.default_role: discord.PermissionOverwrite(connect=False, view_channel=False),
role: discord.PermissionOverwrite(connect=True, view_channel=True)
}
channel = await category.create_voice_channel(arg.title(), overwrite=overwrites)
await channel.edit(sync_permissions=False)
PS: 我想将权限同步设置为 False,我只是在创建频道后才找到一种方法。 创建的时候有办法吗?
【问题讨论】:
-
如果你已经覆盖了权限,
permissions_synced已经是false,你不需要再次编辑 -
不知道谢谢!您还知道为什么我的机器人没有创建具有适当权限的频道吗?
标签: python discord.py