0
votes

I am currently working on my discord bot that works a lot with emojis. But somehow I can not let my bot write more than two emojis.

This works:

case 'test':
embed = new Discord.MessageEmbed()
  .setColor(hexColor)
  .setDescription(`Two Emoji <:harold:620608308910358530> <a:nice:634785041762877441> ok.`)
message.channel.send(embed);
break;

The Emojis get displayed in the discord chat as usual.

However, if I do it with more emojis, like:

case 'test':
embed = new Discord.MessageEmbed()
  .setColor(hexColor)
  .setDescription(`Three Emoji <:harold:620608308910358530> <:harold:620608308910358530>  <a:nice:634785041762877441> ok.`)
message.channel.send(embed);
break;

Discord automatically converts the bot's message to this:

Three Emoji :harold: :harold: :nice: ok.

So not the actual emojis are displayed anymore, just their names with : around them.

This prevents me including more than two custom emojis in a single message. Is there a way to prevent this from happening? Or is this just a known limitation from Discord's side?

1

1 Answers

1
votes

When working with custom emojis, it is best to fetch the custom emojis before using it.

case 'test':
const haroldEmoji = client.emojis.cache.get('620608308910358530')
const niceEmoji = client.emojis.cache.get('634785041762877441')

embed = new Discord.MessageEmbed()
  .setColor(hexColor)
  .setDescription(`Three Emoji ${haroldEmoji} ${haroldEmoji} ${niceEmoji} ok.`)
message.channel.send(embed);
break;