Answer the question
In order to leave comments, you need to log in
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}`)
}
});
Answer the question
In order to leave comments, you need to log in
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.
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]}`)
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question