Browse Source

Use conditional statement to decide whether to use ID or name for emoji

master
Abheek Dhawan 4 years ago
parent
commit
9aed52170c
  1. 5
      bot.js

5
bot.js

@ -798,8 +798,9 @@ client.on('messageReactionAdd', (messageReaction, user) => {
messageReaction.message.channel.messages.fetch(messageReaction.message.id) messageReaction.message.channel.messages.fetch(messageReaction.message.id)
.then(message => { .then(message => {
const emoji = messageReaction.emoji.name; const emoji = messageReaction.emoji.name;
const emojiIdentifier = messageReaction.emoji.identifier; const emojiID = messageReaction.emoji.id;
const numEmoji = message.reactions.cache.get(emojiIdentifier).count; let numEmoji;
message.reactions.cache.get(emojiID) ? numEmoji = message.reactions.cache.get(emojiID).count : message.reactions.cache.get(emoji).count;
const messageReactionAddEmbed = new Discord.MessageEmbed() const messageReactionAddEmbed = new Discord.MessageEmbed()
.setTitle("Reaction Added") .setTitle("Reaction Added")
.setAuthor(message.author.tag, message.author.avatarURL()) .setAuthor(message.author.tag, message.author.avatarURL())

Loading…
Cancel
Save