如何通过id获取类别?

Phi*_*ion 3 python-3.x discord.py

我正在制作一个创建频道的机器人。他必须在某个类别中创建频道。我在用guild.create_text_channel()。我在文档中没有找到执行此操作的方法。欢迎任何帮助。

小智 5

您可以用于discord.utils.get通过 id 获取类别。这是它的一个用法:

guild = discord.utils.get(client.guild.categories, id='put the id here without apostrophes')
Run Code Online (Sandbox Code Playgroud)