Easiest way to check if an emoji is default or belongs to the server

I'm trying to have a bot copy message reactions over to another channel for a starboard. What's the easiest way to check if a bot can "use" reaction emoji? Basically trying to prevent this:
13 Replies
d.js toolkit
d.js toolkit2y ago
• 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.
probablyraging
If the bot is in the server where the emoji exists, it can use it. Though you could check BaseGuildEmojiManager but I think that is a unnecessary step If the emoji is from another guild, it will need the perms to use external emojis I believe To prevent that, you should use the <:emoji:id> identifier
jr
jrOP2y ago
Is ReactionEmoji/GuildEmoji .toString reliable or should I manually do <:emoji:id>?
probablyraging
toString method should give you the identifier
jr
jrOP2y ago
@probablyraging Does it matter if the emoji comes from a guild the bot is not in? I'm having some trouble getting things working, even with the external emoji permission
probablyraging
Yes, the bot won't be able to use it
jr
jrOP2y ago
Ah, ok. How do I detect if an emoji comes from a server the bot is not in? if(reaction.emoji instanceof GuildEmoji || reaction.emoji.id === null)? Not sure if instanceof GuildEmoji is reliable
d.js docs
d.js docs2y ago
property GuildEmoji#guild The guild this emoji is part of
probablyraging
Would probably be the best bet
jr
jrOP2y ago
Ah ok I'll try (emoji.guild && emoji.id) || emoji.id === null
probablyraging
That won't tell you if the bot can access it. emoji.guild will always be truthy Check if the client has the emoji.guild.id in it's cache
jr
jrOP2y ago
Alrighty will do, thanks so much 🙂
probablyraging
Np
Want results from more Discord servers?
Add your server