discord py, ctx.guild.members, only returns bot

Viewed 4140

ctx.guild.members

is an array which is supposed to return every member in the server the command was called from but if i do

print(ctx.guild.members)

it only returns the bot itself

[<Member id=769576973214547969 name='test bot' discriminator='2461' bot=True nick=None guild=<Guild id=768187276873957437 name='test server' shard_id=None chunked=False member_count=4>>]

im trying to meet the quality standards which is why its worded long and not to the point

1 Answers

In the new version of discord.py(1.5.x), there're some updates about Intents. Intents are like permissions, you have to define it to use some things like getting members, channels etc.

import discord

intents = discord.Intents().all()
client = discord.Bot(prefix = '', intents=intents)

For more information about Intents, you can look at the API References.

Related