Closed Nephrited closed 3 years ago
Odd? This method accepts this type definition for which the emoji
property is ultimately this:
export type EmojiIdentifierResolvable = string | EmojiResolvable;
export type EmojiResolvable = Snowflake | GuildEmoji | ReactionEmoji;
I fail to see how this could even occur. It looks like you're passing a RawEmoji
instead, which isn't documented nor typed to be sent across?
RawEmoji
looks to be exactly what the DiscordAPI accepts for this call, as documented here on the Discord API, and it does work if forced through.
With that said, an EmojiResolvable looks to be the right way to handle this via the library, so perhaps a non-issue after all. I'll update my code to use it.
This is a library, so things can be altered! If you have a custom emoji, just pass the id. If you want to use a default emoji, just pass the Unicode variant. Under-the-hood, this is transformed to the necessary payload (RawEmoji
) to be sent across. Simply specifying an id or the Unicode variant is a convenience here.
TS enforces a full emoji object of type EmojiIdentifierResolvable
This can be a string or an id, so it's not always an object!
Makes total sense to me. I'll close this out, hopefully anyone with a similar problem will run into it!
Arguably this is just a typings issue then, and RawEmoji
could be added to resolvable items.
Please describe the problem you are having in as much detail as possible: When attempting to create a select dropdown with an emoji, the TS enforces a full emoji object of type
EmojiIdentifierResolvable
, when the Discord API requires only a partial Emoji object consisiting of at most theid
,name
andanimated
fields.Include a reproducible code sample here, if possible:
Further details:
Workaround
Relevant client options:
N/A