簡體   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