I am trying to let my discord bot display the image file of emojis. So you post a emoji and the bot replies with an attached image of the emoji.
It's working for emojis of servers on which the bot is online. But how can i get the url of emojis from other servers?
I search for the emoji with bot.emojis.get But how can i search "outside" of the client "bot"? Or get the url on a different way?
My code for emojis from joined servers:
const emoji = bot.emojis.get(emojiID);
await message.channel.send({files: [
{
attachment: emoji.url,
name: emoji.name + '.png'
}
]});
Another Problem is emoji.animated
is returning undefined
all the time. why? https://discord.js.org/#/docs/main/stable/class/Emoji?scrollTo=animated
Since all emoji URLs are in the form:
https://cdn.discordapp.com/emojis/${emoji.id}./* extension of the emoji e.g: .png */
Y.ou can simply just use that since you already have the ID of the emoji. Keep in mind this will only work for emojis that the bot has access to. If you would like to get the URL of emojis that the client doesn't have access to, you would need to use some regex to get the emoji ID from a message.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments