#Get Guild Emoji IDs

17 messages · Page 1 of 1 (latest)

crude flame
#

How do you get the ID of a custom guild emoji?

I tried this but it didn't work (GuildEmoji is imported)

if (key === 'emoji' && typeof value == GuildEmoji)
            valueID = value.id;```

I want it to only be for guild emojis, as I'm wanting to store the value in a database. Default Discord emojis are fine, as they go to unicode.
tawdry sonnetBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

crude flame
#

djs v14.9.0, node 18.8.0

unborn plinth
#

typeof will not get you what you want… you‘re either looking for instanceof or you want to know if typeof is object.

crude flame
#

@unborn plinthokay, so I'm going in a different route. I'm using client#emojis#resolveIdentifier(). Does it always resolve to EmojiName%EmojiID

unborn plinth
#

Why not use resolve() instead and access its .id?

crude flame
#

because when someone sends an emoji, discord is resolving it as the full <:name:ID>

crude flame
unborn plinth
#

Ah, true…

unique impBOT
crude flame
#

how would this work?

unborn plinth
#

import it from discord.js, then parseEmoji(value).id

crude flame
#

as in, what I'm importing

unborn plinth
#

No, it‘s a function, so parseEmoji in dromedaryCase

crude flame
#

gotcha