python - 如何获得不和谐公会的成员(discord.py)?

标签 python python-3.x discord.py python-3.8

我知道这个问题的一些答案是:

for member in guild.members:
    id = member.id
    #do stuff here

但是不,这对我不起作用,我已经尝试过了,它只有机器人本身在成员列表中,尽管它确实显示了实际的成员数量(但我不确定这是否有用以任何方式)。所以我想问是否有另一种方法可以做到这一点。

最佳答案

新的 Discord intents 系统破坏了很多东西,所以你需要确保更新 discord.py 并用所有 intents 实例化你的客户端:

intents = discord.Intents.all()
client = discord.Client(intents=intents)

关于python - 如何获得不和谐公会的成员(discord.py)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64840612/

相关文章:

Python - 将文本保存到文件时,它会添加冗余字符

Python 正则表达式在模式中用可选词拆分

python - 初始化时出现 tkinter StringVar() 错误

python - 在不使用上下文的情况下发送消息的替代方法是什么?

python - 将 datetime.datetime 对象写入文件

python - 拆分输出以填充嵌套字典 python

python - 创建不完整月份的月份名称分类列的最佳方法

python - 限制类变量的修改,新实例除外

python - 为什么输入模块会导出 "submodules"?

python-3.x - ClientConnectorCertificateError : Cannot connect to host discordapp. com :443, AWS 上的认证错误。(ec2)