Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何获得discord公会成员(discord.py)?_Python_Python 3.x_Discord.py_Python 3.8 - Fatal编程技术网

Python 如何获得discord公会成员(discord.py)?

Python 如何获得discord公会成员(discord.py)?,python,python-3.x,discord.py,python-3.8,Python,Python 3.x,Discord.py,Python 3.8,我知道这个问题的一些答案是: for member in guild.members: id = member.id #do stuff here 但不,这对我不起作用,我已经尝试过了,它只在成员列表中包含bot本身,尽管它确实显示了实际的成员数(但我不确定这是否有用)。因此,我想问是否还有其他方法可以做到这一点。新的Discord intents系统破坏了很多东西,因此您需要确保更新了Discord.py,并用所有意图实例化您的客户端: intents=discord.int

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

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

但不,这对我不起作用,我已经尝试过了,它只在成员列表中包含bot本身,尽管它确实显示了实际的成员数(但我不确定这是否有用)。因此,我想问是否还有其他方法可以做到这一点。

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

intents=discord.intents.all()
客户端=不一致。客户端(意图=意图)

我认为您实际上必须在web仪表板中启用它<代码>帮会成员是一种特权意图。请在您的bot代码和开发人员门户中查看有关启用意图的文档-