繁体   English   中英

如何让我的 discord 机器人获取所有服务器中的所有文本通道 ID?

[英]How do I make my discord bot get all text channel id's in all servers?

我基本上希望机器人获取所有服务器中所有文本频道的频道 ID。 我已经找了几个小时,但我似乎找不到任何东西。 我猜它看起来像这样:

for server in bot.guilds:
    for channel in server.channels(Channeltype=text)
        print(channel.id)

discord.Guild有一个名为text_channels的属性。

for guild in bot.guilds:
    for text_ch in guild.text_channels:
        print(text_ch.id)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM