elif cmd_args[0].upper() == "D!CREATECHANNEL":
everyone = discord.PermissionOverwrite(read_messages=False, send_messages=False, create_instant_invite=False, manage_channel=False, manage_permissions=False, manage_webhooks=False, send_TTS_messages=False, manage_messages=False, embed_links=False, attach_files=False, read_message_history=False, mention_everyone=False, use_external_emojis=False, add_reactions=False)
Member = discord.PermissionOverwrite(read_messages=True, send_messages=True, create_instant_invite=False, manage_channel=False, manage_permissions=False, manage_webhooks=False)
server = message.server
await client.create_channel(server, cmd_args[1], (server.default_role, everyone), (discord.utils.get(message.server.roles, name='Member'), Member))
pass
机器人会创建一个https://cdn.discordapp.com/attachments/471468848718020623/473202969492455425/gng.PNG这样的频道(命令rn使之成为D!createchannel名称) 我希望机器人执行的操作是https://cdn.discordapp.com/attachments/471468848718020623/473202968989138945/Capturegbgg.PNG(为此,我希望命令是D!createchannel名称@The Golden Atlas [16-A])我只是不知道该怎么做这样做可能是我很笨,没有看到它,但我真的需要此帮助,这是我机器人需要工作的最后一刻
答案 0 :(得分:0)
您可以从message.member
获取所有提及的成员,然后为每个成员建立一个(target, PermissionOverwrite)
元组并将其传递给create_channel
。
elif cmd_args[0].upper() == "D!CREATECHANNEL":
everyone = discord.PermissionOverwrite(read_messages=False, send_messages=False, create_instant_invite=False, manage_channel=False, manage_permissions=False, manage_webhooks=False, send_TTS_messages=False, manage_messages=False, embed_links=False, attach_files=False, read_message_history=False, mention_everyone=False, use_external_emojis=False, add_reactions=False)
Member = discord.PermissionOverwrite(read_messages=True, send_messages=True, create_instant_invite=False, manage_channel=False, manage_permissions=False, manage_webhooks=False)
server = message.server
member_perms = [(mentioned, Member) for mentioned in message.mentions]
await client.create_channel(server, cmd_args[1], (server.default_role, everyone), (discord.utils.get(message.server.roles, name='Member'), Member), *member_perms)