V
V
Vivitka2021-04-26 23:06:19
Node.js
Vivitka, 2021-04-26 23:06:19

How to get random emoji id for a message in discord.js?

Hello! I am a beginner node.js and java script developer and I need your help! I need to know the random emoji id in discord to use in a message.
In general, I'll tell you with an example: *prefix*Mood
And the bot's answer: My current mood: *random emoji*.

const Emoji = message.guild.emojis.cache.get("Emoji_ID");

client.on('message', message => {
  if (message.content === `${prefix}Настроение`) {
  message.channel.send(`Мое текущее настроение: ${Emoji}`)
   }
});


Vot .. But here's how I can take a random id .. Please help me :D

================

It seems to be asking for a whole code, but I still want to implement my idea. I don't think it's a bad idea..

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2021-04-27
@Howery

Hello, I can offer an implementation through an array.
Only then they will need to be added like this: "<:yeap:755836210219319324>", to get this kind of emoji faster, just send a backslash and the desired emoji, as in the screenshot.
image-2021-04-27-183208.png

let Emoji = ["<:yeap:755836210219319324>", "<:10:754666574602043454>"] 

client.on("message", (message) => {
  var rand = Math.floor(Math.random() * Emoji.length);
  if (message.content === `${prefix}Настроение`) {
  message.channel.send(`Мое текущее настроение: ${ Emoji[rand]}`)
   }
});

I'm sure you can get emoji even easier. I showed the very idea of ​​​​how to take random ones. Good luck)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question