I am having issues trying to get my discord bot to add a role based on an emoji reaction. When I use the command my bot will embed the message and emoji, but the emoji is not clickable. Also, when I type the command I get the error (node:12916) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Emoji
module.exports = {
name: 'reactionrole',
description: "Sets up a reaction role message!",
async execute(message, args, Discord, client) {
const channel = '810124665870325648';
const Pug_Role = message.guild.roles.cache.find(role => role.name === "Pugs");
const Pug_Emoji = ':gun:';
let embed = new Discord.MessageEmbed()
.setColor('#e42643')
.setTitle('Pugs Click Here!')
.setDescription('Choosing Pug will allow you to join some channels!\n\n'
+ `${Pug_Emoji} Pugs`
);
let messageEmbed = await message.channel.send(embed);
messageEmbed.react(Pug_Emoji);
client.on('messageReactionAdd', async (reaction, user) => {
if (reaction.message.partial) await reaction.message.fetch();
if (reaction.partial) await reaction.fetch();
if (user.bot) return;
if (!reaction.message.guild) return;
if (reaction.message.channel.id == channel) {
if (reaction.emoji.name === Pug_Emoji) {
await reaction.message.guild.members.cache.get(user.id).roles.add(Pug_Role);
}
} else {
return;
}
});
client.on('messageReactionRemove', async (reaction, user) => {
if (reaction.message.partial) await reaction.message.fetch();
if (reaction.partial) await reaction.fetch();
if (user.bot) return;
if (!reaction.message.guild) return;
if (reaction.message.channel.id == channel) {
if (reaction.emoji.name === Pug_Emoji) {
await reaction.message.guild.members.cache.get(user.id).roles.remove(Pug_Role);
}
} else {
return;
}
});
}
}