Add a way for bots to know which guild an emoji is from #6226
Unanswered
abitofevrything
asked this question in
API Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, there is no way for a bot to reliably identify the guild an emoji came from. The best way to do so currently is to list the emojis for every guild the client is in, cache the results, and then perform a lookup by ID when an event involving an emoji is received (e.g Message Reaction Add).
It seems strange for something to be possible via a "hack" but have no official API support. Therefore, I suggest adding a nullable snowflake
guild_id
field to the Emoji object, which isnull
when the emoji is a standard emoji and the ID of the guild that created the emoji otherwise. An emoji that is deleted from a guild should still have itsguild_id
field point to the guild.It's worth noting that the Discord client does have a way to obtain this information - the endpoint
/emojis/<id>/guild
returns a partial Guild object for the guild the emoji was created in (or 404 if the guild is private). This endpoint is undocumented, and cannot be used by bots, so it is not a solution (currently) to this problem. Adding access to this endpoint for bots would be nice, but adding theguild_id
field would be even nicer.For some context as to why we want to know this information, we are currently rewriting our wrapper around the Discord API for Dart. For every other "main" type of entity, we were able to gather enough information to add support for the fetch, update and delete operations on those entities from only the information contained in the Gateway event. For emojis, we only have the emoji ID, but the endpoints for fetching/updating/deleting require the Guild id to be known (
/guilds/<id>/emojis/<id>
), so we can't add support for those operations.Beta Was this translation helpful? Give feedback.
All reactions