📢 All about adding custom emojis to Discord Roles is here!
⭐ You can easily execute the steps with an eval command.
Discord.js actually has that functionality built-in with the GuildEmojiRoleManager
class. The default collection is empty, making every emote accessible to every role. However, you can change that using the .add(), .remove(), and .set()
methods.
First, get the emoji | message.guild.emojis.cache.get('<Emote ID>')
then the current role restrictions (default: none) | .roles
then add, set, or remove the specified role(s) | .add(['<Role ID>', '<Role ID>')
message.guild.emojis.cache.get('<Emote ID>').roles.add('<Role ID>')
message.guild.emojis.cache.get('<Emote ID>').roles.set('<Role ID>')
message.guild.emojis.cache.get('<Emote ID>').roles.remove('<Role ID>')