Get the Emoji url from a message in discord.js

creme

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

newbie

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Get emoji informations from a message in discord.js

From Dev

Get last message from text channel with discord.js

From Dev

how to pull message data from discord.js?

From Dev

Discord.JS getting all attachments from a message

From Dev

Discord.js DiscordAPI Error: Unknown Emoji - Reacting to an Embed

From Dev

Discord.js DiscordAPI Error: Unknown Emoji - Reacting to an Embed

From Dev

Discord.JS get member from user ID

From Dev

Get page url from embeded JS script

From Dev

How to get parameter from url in js?

From Dev

Welcome message embed Discord.js

From Dev

How to send message with discord.js with ID

From Dev

Discord js using message id in Embed

From Dev

Discord.js How to mention message author?

From Dev

Discord.JS Send message to tagged user

From Dev

Send a message if there is a role Discord.js

From Dev

Discord.js -- make presenceUpdate send a message

From Dev

Await reply in private message discord.js

From Dev

Discord Custom Activity Attribute Error, emoji object doesn't have attribute 'get'

From Dev

Sending Message to Discord Channel without message from user

From Dev

Get Data from JSON file using a variable (JS/Discord.js)

From Dev

Node: Get var from JS file from URL

From Dev

Emoji from android to web

From Dev

Reading emoji from database

From Dev

Make Discord Bot post image from the link from the message

From Dev

How to GET from FTP url in meteor.js?

From Dev

d3.js get JSON from url

From Dev

JS Get image directly from video stream as data url

From Dev

Get parameters from Stripe page redirect URL Node.js

From Dev

d3.js get JSON from url