Bot discord | Sololearn: Learn to code for FREE!

+1

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

+4

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" };

+1

Taken from https://anidiots.guide/understanding/roles : // assuming role.id is an actual ID of a valid role: if(message.member.roles.has(role.id)) { ... } else { ... }

0

I use js

0

the above code IS discordJS