Bot discord | Sololearn: Learn to code for FREE!


Bot discord

So like I'm trying to create bot but I struck on roles. Let's say the server has 3 roles: admin, verifiedmember, and everyone. Admins have all roles. I want to make only admins to use a specific commands like "!mute". How to do that? I already know all ids for each role and member.

5/10/2020 7:46:01 PM

Zahir Khodadin

4 Answers

New Answer


you could use if (!message.member.hasPermission("MUTE_MEMBERS")) { return message.reply( "❌ You can't use that." ); } Or just set up a verification system in your config file. That way you won't have to write that for each Moderator command. It'll be something like this exports.conf = { enabled: true, guildOnly: true, aliases: [], permLevel: "Administrator" };


Taken from : // assuming is an actual ID of a valid role: if(message.member.roles.has( { ... } else { ... }


I use js


the above code IS discordJS