fix(types): make value of emoji property in DiscordButtonComponent and DiscordSelectOption partial (#4869)

* fix(types): make value of emoji property in DiscordButtonComponent and DiscordSelectOption partial

* fix: type error

* don't partial tranformer

* undo partial in EmojiToggles
This commit is contained in:
Awesome Stickz
2026-04-05 03:35:22 +05:30
committed by GitHub
parent 9f2123371d
commit ad2a561ceb
2 changed files with 3 additions and 2 deletions

View File

@@ -171,6 +171,7 @@ function transformButtonComponent(bot: Bot, payload: DiscordButtonComponent) {
if (props.label && payload.label) button.label = payload.label;
if (props.customId && payload.custom_id) button.customId = payload.custom_id;
if (props.style && payload.style) button.style = payload.style;
// @ts-expect-error TODO: Deal with partials
if (props.emoji && payload.emoji) button.emoji = bot.transformers.emoji(bot, payload.emoji);
if (props.url && payload.url) button.url = payload.url;
if (props.disabled && payload.disabled) button.disabled = payload.disabled;

View File

@@ -144,7 +144,7 @@ export interface DiscordButtonComponent extends DiscordBaseComponent {
* @remarks
* A button of style {@link ButtonStyles.Premium | Premium} cannot have an emoji
*/
emoji?: Pick<DiscordEmoji, 'id' | 'name' | 'animated'>;
emoji?: Partial<Pick<DiscordEmoji, 'id' | 'name' | 'animated'>>;
/**
* A dev-defined unique string sent on click (max 100 characters).
*
@@ -231,7 +231,7 @@ export interface DiscordSelectOption {
/** An additional description of the option. Maximum 50 characters. */
description?: string;
/** The id, name, and animated properties of an emoji. */
emoji?: Pick<DiscordEmoji, 'id' | 'name' | 'animated'>;
emoji?: Partial<Pick<DiscordEmoji, 'id' | 'name' | 'animated'>>;
/** Will render this option as already-selected by default. */
default?: boolean;
}