Python 如何在discord.py中获取所有成员列表?
输出仅包含标题和颜色的空嵌入消息,不包含说明Python 如何在discord.py中获取所有成员列表?,python,python-3.x,discord.py,Python,Python 3.x,Discord.py,输出仅包含标题和颜色的空嵌入消息,不包含说明 我不知道我该怎么办--很可能你错过了成员的意图。这意味着除非您执行直接HTTP请求,否则不会在缓存中加载成员。要启用: 首先在以下位置启用: 其次,在discord.py中订阅: 导入不一致 从discord.ext导入命令 intents=discord.intents.default() intents.members=True bot=commands.bot(意图=意图,…) @client.command() async def me
我不知道我该怎么办--很可能你错过了
成员的意图。这意味着除非您执行直接HTTP请求,否则不会在缓存中加载成员。要启用:
首先在以下位置启用:
其次,在discord.py中订阅:
导入不一致
从discord.ext导入命令
intents=discord.intents.default()
intents.members=True
bot=commands.bot(意图=意图,…)
@client.command()
async def members_info(ctx):
server_members = ctx.guild.members
data = "\n".join([member.name for member in server_members if "test" in member.roles])
embed = discord.Embed(title = f'Участники сервера', description = f"{data}", color = discord.Color.purple())