如何列出不和.pyb

2024-05-14 00:18:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要一个服务器中所有语音频道的列表,我在文档中看到了getunall_频道,但我不确定如何实现它。在

https://discordpy.readthedocs.io/en/latest/api.html?highlight=voice%20channels


Tags: 文档httpsio服务器api列表htmlreadthedocs
1条回答
网友
1楼 · 发布于 2024-05-14 00:18:23

循环检查Server.channels检查Channel.type与{}

from discord import ChannelType

@bot.command(pass_context=True)
async def voicechannels(ctx):
    channels = (c.name for c in ctx.message.server.channels if c.type==ChannelType.voice)
    await bot.say("\n".join(channels))

相关问题 更多 >