【问题标题】:My discord bot fails to find my members as of today截至今天,我的不和谐机器人无法找到我的成员
【发布时间】:2021-02-09 14:32:59
【问题描述】:

我用 python 编写了一个不和谐的机器人,它一直工作到今天。今天它找不到我的服务器的成员,这显然是一个破坏者。为了确定故障点,我编写了以下测试例程:

@bot.command(name='test', help='test stuff')
async def test(ctx):
    for guild in bot.guilds:
        for member in guild.members:
            print(member)

    print("Test done")

这是我从文档中复制和粘贴的代码,它应该像往常一样工作。今天我得到了反馈:

Bot is ready. (=> this print command is generated on the startup of the bot)
Keeper of Keys#4019
Test done

Keeper of Keys 是机器人本身的名称。显然,机器人能够找到自己,但不能找到公会的其他成员。难道我做错了什么?提前致谢!

【问题讨论】:

    标签: python discord discord.py


    【解决方案1】:

    好的,我浏览了文档并找到了问题的解决方案:

    https://discordpy.readthedocs.io/en/latest/intents.html#privileged-intents

    这应该可以解决问题。

    【讨论】:

    • 感谢您提供答案。我不知道这个变化
    猜你喜欢
    • 2020-05-10
    • 1970-01-01
    • 1970-01-01
    • 2020-04-15
    • 2017-10-18
    • 1970-01-01
    • 2021-10-20
    • 2020-12-19
    • 2021-11-18
    相关资源
    最近更新 更多