首页 > 解决方案 > discord.py 如何在服务器之间克隆频道?

问题描述

我正在尝试创建一个基本上可以复制服务器的机器人。不使用 discord.new/templates 的原因是这些只能用于新创建的服务器。

据我所知,频道和类别没有“权限”属性。有没有一种方法可以让我以某种方式查看频道的所有权限并将它们复制到不同服务器上的不同频道?

谢谢!

标签: discorddiscord.py

解决方案


它们被称为通道覆盖

获得频道的覆盖

overwrites = channel.overwrites  # assuming channel is defined

然后在另一个公会

await guild.create_text_channel(..., overwrites=overwrites)
# the ... is just for example and you can have other arguments there to fit your needs

文档:TextChannel.overwrites


推荐阅读