Discord.js v12 MemberList command

I have this memberlist command which works but I have a problem. I get no errors all though it will always send the if(!members) quote and will not give me the actual list of members. Pls help thanks

module.exports = {
    name: 'memberlist',
    description: 'shows the member list with the specified role',
    async execute(message, args, Discord) {
        const role = message.mentions.roles.first() || message.guild.roles.cache.get(args[0]);
        const embe = new Discord.MessageEmbed()
        .setDescription(`${message.author.username} Mention the role or put the role ID`)
        .setColor("RANDOM")
        .setTimestamp()
      if(!role) return message.channel.send(embe) 
        const rname = message.content.split(' ').splice(1).join(' ');
        const rrole = message.guild.roles.cache.find(val => val.name === rname);
        if (!rrole) return message.channel.send({embed: {description: `${message.author.username} 
\`${rname}\` is not a role on this server`, color: "RANDOM", timestamp: new Date()}});
        const members = await message.guild.members.fetch().then((members) => {
            if (Array.isArray(members)) {
              return members(
                (member) =>
                `• **${member.displayName}**
                      (${member.user.tag} - ${member.user.id})`
              )
            } else {
              return `• **${member.displayName}**
                           (${member.user.tag} - ${member.user.id})`
            }
          })
        if(!members)
        return message.channel.send({embed: {description: 
`there are no members that currently have **${role.name}** role`, 
color: "RANDOM", timestamp: new Date()}});
        const embed = new Discord.MessageEmbed()
        .setColor("RANDOM")
        .addField({
            name: `List of ${members}`,
            value: `${members}
            that have the role \`${role.name}\``,
            description: members,
            maxPerPage: 20,
            page: Number(message.arg),
        });
        message.channel.send(embed)
    }
}

138 thoughts on “Discord.js v12 MemberList command”

  1. Hey there, You’ve done a fantastic job. I’ll definitely
    digg it and personally suggest to my friends. I’m confident they will be benefited from this website.

    Reply
  2. I just could not leave your website prior to suggesting that I really enjoyed the usual info a person supply to your visitors? Is going to be again regularly to inspect new posts.

    Reply
  3. Hey I know this is off topic but I was wondering if
    you knew of any widgets I could add to my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and
    was hoping maybe you would have some experience with something like this.
    Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your
    new updates.

    Reply
  4. I have been exploring for a little bit for any high quality articles or blog posts in this kind
    of area . Exploring in Yahoo I ultimately stumbled upon this site.
    Studying this information So i am satisfied to convey that I’ve
    a very good uncanny feeling I came upon exactly what I needed.
    I most indubitably will make sure to do not fail to remember
    this web site and provides it a look on a relentless basis.

    Reply
  5. You actually make it appear so easy together with your presentation however I find this topic to be really something that I feel I’d by no means understand. It sort of feels too complex and very huge for me. I am taking a look forward to your next publish, I’ll try to get the cling of it!

    Reply
  6. I blog typically and I greatly enjoy your web content. This fantastic guide has seriously actually peaked my rate of interest. I am likely going to book mark your website as well as keep looking for fresh facts regarding once a week. I opted in for your RSS feed in addition.

    Reply
  7. Great post and straight to the point. I am not sure if this is really the best place to ask but do you guys have any ideea where to get some professional writers? Thank you 🙂

    Reply
  8. It’s appropriate time to make some plans for
    the future and it’s time to be happy. I’ve learn this put up
    and if I may I desire to counsel you some
    fascinating things or suggestions. Maybe you could write next articles regarding this article.
    I wish to learn even more things about it!

    Reply
  9. great submit, very informative. I ponder why the opposite specialists of this sector do not
    understand this. You must proceed your writing.
    I’m sure, you’ve a great readers’ base already!

    Reply
  10. I’m very pleased to discover this page. I want to to thank
    you for ones time for this wonderful read!! I definitely enjoyed every bit of it
    and I have you bookmarked to look at new information on your web site.

    Reply
  11. Appreciating the time and effort you put into your website and detailed information you present.
    It’s great to come across a blog every once in a while that isn’t the same
    unwanted rehashed material. Excellent read! I’ve bookmarked your site and I’m adding your RSS feeds
    to my Google account.

    Reply
  12. Do you mind if I quote a few of your posts as long as I provide credit and sources back to your site?

    My blog site is in the very same niche as yours and my users
    would genuinely benefit from some of the information you provide here.
    Please let me know if this okay with you. Cheers!

    Reply
  13. I’m not sure why but this blog is loading incredibly slow for me.
    Is anyone else having this problem or is it a problem on my end?

    I’ll check back later on and see if the problem still exists.

    Reply
  14. Howdy! I could have sworn I’ve visited this website before but after going through a few of the articles I
    realized it’s new to me. Anyways, I’m certainly pleased I came across it and I’ll
    be bookmarking it and checking back regularly!

    Reply

Leave a Comment