vendredi 3 décembre 2021

discord.js bot to tag random user among all users

I want to include a '-random' command that will tag random member among all members of a server. I have found the following code:

if(command === 'random'){
              
        let random = message.guild.members.cache.random().user;
        message.channel.send('<@'+random+'>');
    }

It works but it will only tag me, the bot itself, or someone else if I tag him or he writes something in the channel. How do I fix this?




Aucun commentaire:

Enregistrer un commentaire