discord py,ctx.guild.members,仅 returns 机器人

discord py, ctx.guild.members, only returns bot

ctx.guild.members

是一个数组,它应该 return 调用命令的服务器中的每个成员,但如果我这样做

print(ctx.guild.members)

它只是 return 机器人本身

[<Member id=769576973214547969 name='test bot' discriminator='2461' bot=True nick=None guild=<Guild id=768187276873957437 name='test server' shard_id=None chunked=False member_count=4>>]

我正在努力达到质量标准,这就是为什么它的措辞冗长而不切题

在discord.py(1.5.x)的新版本中,有一些关于Intents的更新。意图就像权限,你必须定义它才能使用一些东西,比如获取会员、频道等。

import discord

intents = discord.Intents().all()
client = discord.Bot(prefix = '', intents=intents)

关于Intents的更多信息,您可以查看API References