O
O
old_stalin2020-11-08 02:10:03
Python
old_stalin, 2020-11-08 02:10:03

Stupid mistake in the user iteration loop?

there is a cycle for checking all users in guilds, but for some reason it is performed 1 time, although there are 5 people in the discord.

from builtins import range
import discord
import json
import requests
import asyncio
import datetime
import psycopg2
from datetime import datetime
from discord.ext import commands
from discord.utils import get
from config import settings

botid = f"<@{settings['id']}>"
client = commands.Bot(command_prefix=settings['prefix'])
client.remove_command('help')


@client.event
async def on_ready():
    for guild in client.guilds:
        for member in guild.members:
            print(guild.members)

client.run(settings['token'])

maybe I didn't format it correctly

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shurshur, 2020-11-08
@old_stalin

By default, you cannot get a list of all server users. To do this, you need to enable Intents. Now the bot sees only itself.
See https://discordpy.readthedocs.io/en/latest/intents.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question