I'm trying to make my bot send an emoji whenever I Type =emoji
I've managed to get everything done but I have no idea how to make the bot send an emoji by the ID of the emoji.
Any help would be appreciated!
To send a custom emoji, you must get that emoji's unique ID . To find that, you must send the emote in discord with a backslash in front of it; essentially escaping the emoji. If you paste this special string into a message, the bot will send the emoji. However, the emoji must be from a guild the bot is part of.
To react with an emoji, you need to use the message. react() method. Once you have the emoji character, all you need to do is copy & paste it as a string inside the . react() method!
How does Discord.js store emojis? There are two places where you can grab emojis using discord.js: in the client, and in the guilds. client.emojis is a collection of every emoji the client has access to, and guild.emojis is a collection of the emojis of a specific guild.
It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend. Usability, consistency, and performance are key focuses of discord.js, and it also has nearly 100% coverage of the Discord API.
Imagine a bot discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
I have seen bots such as MEE6 that can send custom emojis in DMs, so this surely must be possible. I used .first () since there is only one emoji in the server. Both of these do not work. The emoji will appear in the server it is hosted in, but if I try to send it in any other server, it just shows the emoji name and/or ID.
Do you know the name of the emoji? if so, you can simply do this:
message.channel.send("<:emoji name:emoji id>")
If not, you could possibly do,
const emoji = bot.emojis.cache.get("emoji id")
message.channel.send(`${emoji}`)
I assume the emoji has to be cached for the method above to work, i'm sure someone else could brew up a better solution.
Hope i could help!
For an animated emoji use
<a:EmojiName:EmojiID>
If you don't have Nitro to check the emoji's ID check the guide here
You can use
message.channel.send(":emoji name:emoji id")
For if you know the name or the emoji you want
Apparently the format has been changed now.
I was able to get it using
message.channel.send("Hey! :smiley:")
Just like that!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With