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 Khodadin4 Answers
New Answeryou 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 https://anidiots.guide/understanding/roles : // assuming role.id is an actual ID of a valid role: if(message.member.roles.has(role.id)) { ... } else { ... }
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message