Discord.py: on_guild_join does not get a list of all server members

Created on 19 Oct 2020  路  11Comments  路  Source: Rapptz/discord.py

Hi, after the update, I just can't get a list of all server members when the bot connects to it

import discord
intents = discord.Intents.default()
intents.members = True
intents.guilds = True

Here is the event itself

@bot.event
async def on_guild_join(guild):
    for member in guild.members:
        print('-------------------')
        print (member.id)

For some reason, it only displays the bot itself
And I don't know what to do, it's either a bug, or I'm crooked

bug

Most helpful comment

image
袨泻 :(

All 11 comments

have you set your intents on the developer portal?

image
Yes

show your bot constructor

bot constructor? I don't quite understand

This is your bot constructor 馃憞馃徏
bot = commands.Bot(command_prefix='!', intents=intents)

This is not the place to ask for #help btw. Join the discord.py server - https://discord.gg/dpy

image

join https://discord.gg/dpy and close this

image
袨泻 :(

you need to use intents.presences else it won't work

Now it only displays one random participant

Duplicate of #5867

This is not an issue with discord.py. GitHub issues for this repository should be used to report issues with this library.

For further help specific to using this library, you should join either the official discord.py server or the Discord API server, as the README recommends.

Was this page helpful?
0 / 5 - 0 ratings