A
A
Anton Antonenko2020-11-29 15:19:11
Python
Anton Antonenko, 2020-11-29 15:19:11

How can I get a list of server members?

I need to remove a certain role from a person by removing the reaction. The whole code is already ready, there is one thing, but I need to find out what kind of person deleted the reaction. To do this, I'm trying to find a list of all server members and find exactly the one among them. But this code, which should display all participants, only displays my bot. I need all server members

if message.content.startswith('//member'):
        for guild in client.guilds:
            for member in guild.members:
                print(member)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Nevzorov, 2020-11-29
@JIeto

How to tag a random user?

C
Chaka YS, 2020-11-29
@Chaka_1

This piece of code works like clockwork... I don't understand what's wrong.
Throw off what is above this code, although it is unlikely that something will change ... Does it give an error after the bot has been deduced?
If it is, then try:

if message.content.startswith('//member'):
    for guild in client.guilds:
         try:
             for member in guild.members:
                 print(member)
         except:
             pass

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question