【发布时间】:2021-05-30 05:17:08
【问题描述】:
我有 5 个文本通道和 2 个语音通道。从一个频道到另一个频道,我想为这些频道授予 4 个不同角色的权限。
text_channel_name = ['server-gateway', 'chatroom', 'gameplay-map', 'spectator-chat', 'log', 'staff-room']
voice_channel_name = ['player-voicechat','spectator-voicechat']
role_name = ['Mediator', 'Player', 'Ghost', 'Spectator'] # (not including admin role)
我希望我的频道设置如下:
| Channel Name | Description |
|---|---|
| server-gateway | even the ones who first entered can see this channel. |
| chatroom | anyone who has roles can enter this room and have chat here. |
| gameplay-map | anyone with roles can see this, but only ones role with 'Mediator' and 'Player' can write something in here. |
| spectator chat | can only be accessable with someone with 'ghost' and 'spectator' roles |
| log, staff-room | only server admins can access this channel |
| player-voicechat | can only be accessable to ones with 'Mediator' or 'Player' role and admin |
| spectator-voicechat | can only be accessable to ones with 'Ghost' or 'Spectator' role and admin |
我应该如何在 discord.py 上设置我的频道?我给了'Mediator'角色除了管理服务器和管理角色权限之外的所有权限。我是否必须取消某些权限才能使我的计划生效?
编辑:有人建议在为我的机器人制作新服务器时使用服务器模板,但从长远来看,我认为这不是可行的解决方案。我想让我的机器人获得尽可能少的帮助,所以我希望我的机器人在进入新服务器时自动运行设置过程。我剩下要做的就是为角色指定权限,这些权限应该因渠道而异,才能按预期工作。
我想问的是我可以用来为一个频道批量指定角色权限的格式(最好是同时在多个频道上工作的代码行)
【问题讨论】:
-
感谢刚刚编辑它的人。我试图制作一张桌子,但“桌子”显示为损坏。
-
您可以在服务器设置中管理每个频道和角色的权限,您需要 discord.py 做什么?
-
可能用于生成具有完全相同设置的新服务器,而无需手动重做。
-
@JasonRebeloNeves 你可以使用server templates。不过这篇文章没有提到多台服务器。
-
@JonathanFeenstra Jason 是对的。当机器人进入全新的服务器时,我正在使它工作。我事先为机器人生成通道制作了部件,我想为它们设置权限。
标签: python discord discord.py