`for member in guild.members` 停止工作一天
`for member in guild.members` stopped working one day
自从创建我的机器人 spring 以来,我一直在使用 for member in guild.members
(或 ctx.guild.members
)并且它没有问题。然后有一天,它只列出了机器人本身。
我们有新版本的 discord.py 还是什么?
Discord.py 1.5.0+ 要求您启用“意图”。为了获得服务器的成员列表,如果您似乎无法找到它,则需要在 discord developer portal (Click your bot application, and go to the bot tab), take a look at this link: https://discordpy.readthedocs.io/en/latest/intents.html#privileged-intents 中启用服务器成员意图。完成后,您也需要在代码中执行此操作。
对于代码部分,我认为您自己看一下 discord.py docs 会更容易。
自从创建我的机器人 spring 以来,我一直在使用 for member in guild.members
(或 ctx.guild.members
)并且它没有问题。然后有一天,它只列出了机器人本身。
我们有新版本的 discord.py 还是什么?
Discord.py 1.5.0+ 要求您启用“意图”。为了获得服务器的成员列表,如果您似乎无法找到它,则需要在 discord developer portal (Click your bot application, and go to the bot tab), take a look at this link: https://discordpy.readthedocs.io/en/latest/intents.html#privileged-intents 中启用服务器成员意图。完成后,您也需要在代码中执行此操作。
对于代码部分,我认为您自己看一下 discord.py docs 会更容易。