Make a command available to a certain role

Hi, I have a announce command which looks like this :

if (command === “announce”) {
let announcemessage = message.content.match(/(?<=announce ).*$/)[0];
let finalmessage = announcemessage.toUpperCase();
const announceEmbed = new Discord.RichEmbed()
.setDescription("" + finalmessage);;

And I was wondering how I could make this command only available to a certain role, like use a role ID to make the bot recognize that the user has that role, and if the user doesn’t have that role the bot to send a message like “You’re not Authorized” can someone help?

Welcome back to the forums!

This may help: restrict command to role discord js Code Example

You can also try to create a array of allowed ID’s.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.