Discord Bot reveals only its own identity, missing other guild members

Despite following a tutorial and having admin rights, my Discord bot shows only its name, ignoring the five other guild users. See this example:

import discord
import os

bot_key = os.getenv('BOT_KEY')
client = discord.Client()

@client.event
async def on_connect():
    for server in client.guilds:
        print(server, [user.display_name for user in server.members])

client.run(bot_key)

hey, check if u enabled members intent in both code and bot settings; i had similar issues and turnning that on solved it. might be the missing part or something with your permissions.

hey, i had this before. i re-enabled the members intent and updated discord.py. a full restart helped too. sometimes discord caches things so wait a bit after changes. might b a pesky cache issue.