guild.text_channels仅返回1个频道,而不是所有频道

问题描述 投票:0回答:1

[当我使用ctx.guild.text_channels并打印分配给我的变量时,它仅显示不和谐服务器中的第一个文本通道

我尝试查看不和谐重写的文档,如果有某种循环我必须使用,但找不到任何循环。所以我相信我做错了。

只是告诉大家我有成员:discord.Member,因为我稍后将使用它。

Discord公会频道列表:http://prntscr.com/prdcaa

@bot.command(pass_contect=True)
async def check_client_channel(ctx, member: discord.Member):
    channels = discord.utils.get(ctx.guild.text_channels)
    print(channels)
    channel_name = member.display_name + "-" + member.discriminator

执行函数时的结果:

test2

预期结果:(有点类似)

["test2", "general", "test", "testing-2611"]

python discord discord.py-rewrite
1个回答
0
投票

此版本为rewrite/master版本


@bot.command()
async def on(msg):
    chans=msg.guild.text_channels
    print([i.name for i in chans])

© www.soinside.com 2019 - 2024. All rights reserved.