A
A
anubis4652020-07-13 15:45:17
JavaScript
anubis465, 2020-07-13 15:45:17

Discord.js How to display participants on the server?

client.on("message", message => {

    if(message.content == `${prefix}staff-list`) {
        const ListEmbed = new Discord.MessageEmbed()
            .setTitle('Users with the staff role:')
            .setDescription(message.guild.roles.cache.find('729044882903007314').members.map(m=>m.user.tag).join('\n'));
        message.channel.send(ListEmbed);

Unfortunately it doesn't work. Console throws an error : TypeError: fn is not a function

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-07-13
@anubis465

replace

message.guild.roles.cache.find('729044882903007314').members.map(m=>m.user.tag).join('\n'));

on the
message.guild.roles.cache.get('729044882903007314').members.map(m=>m.user.tag).join('\n'));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question