So... I've started a while ago with Discord.JS, and I have been searching and searching, but I just can't really find how to react to message with "standard" Discord emojis. I mean...
https://i.stack.imgur.com/gLeHx.png - those emojis.
I want to do something like this:
execute(client, message, args) {
message.content.toLowerCase();
message.channel.send('Something...').then(resource => {
resource.react('${args}');
});
}
args = 842839246934114324 (:smile: emoji)
Get emoji by unicode symbol:
You need to copy the unicode symbols (copy them from discord or from a website like this one ):
And then just say message.react('✅')
You can get the unicode emojis from discord by sending the emoji as you noramlly would and prepending \
before it. This will write the emoji as a unicode symbol which you can just copy into your code.
eg: instead of :laughing:
type \:laughing:
Get emoji by Id (only works with custom emojis):
const emoji = message.guild.emojis.resolve(id);
// OR
const emoji = client.emojis.resolve(id);
message.react(emoji);
message.chanenl.send("hi").then(msg=>{
msg.react("ID")
// OR
msg.react("✅")
// OR
//V 11
let emoji = client.emojis.get("ID")
//V 12
let emoji= client.emojis.cache.get("ID")
if(emoji) return msg.react(emoji)
})
Adding onto MrCodingB's response: Getting a native Unicode symbol from discord emojis is actually really easy; all you need to do is add an emoji and add a \
in front of it, then send the message:) Although this is possible I personally use getemoji.com.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.