1
1
1 22020-05-22 20:27:09
Python
1 2, 2020-05-22 20:27:09

Discord.py How to output members on a server?

There is a code, when activated, the bot sends all server participants, spamming to the channel, because each participant has his own message, but how to make the output in one message?

@client.event
async def on_message( message ):
    if message.content.startswith('member'):
        for guild in client.guilds:
            for member in guild.members:
                await message.channel.send(member)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Damir Modyarov, 2020-05-29
@weRifiCatoR

@client.event
async def on_message( message ):
    if message.content.startswith('member'):
        await message.channel.send('\n'.join(['\n'.join([member for member in guild.members]) for guild in client.guilds]))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question