From 0123e3a1de4e48e2d3771bb664291326308ea282 Mon Sep 17 00:00:00 2001 From: JJSosaL <251519186+jjsosal@users.noreply.github.com> Date: Sun, 22 Mar 2026 14:45:10 +0100 Subject: [PATCH 01/13] feat: add new component types --- lib/Constants.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Constants.ts b/lib/Constants.ts index 26eea6ad..bc0d9e05 100644 --- a/lib/Constants.ts +++ b/lib/Constants.ts @@ -817,7 +817,11 @@ export enum ComponentTypes { CONTENT_INVENTORY_ENTRY = 16, CONTAINER = 17, LABEL = 18, - FILE_UPLOAD = 19, + FILE_UPLOAD = 19, + + RADIO_GROUP = 21, + CHECKBOX_GROUP = 22, + CHECKBOX = 23, } export type SelectMenuNonResolvedTypes = ComponentTypes.STRING_SELECT; From 730531de9ca6608c6e5964b65b1241f1243aedb2 Mon Sep 17 00:00:00 2001 From: JJSosaL <251519186+jjsosal@users.noreply.github.com> Date: Sun, 22 Mar 2026 15:52:51 +0100 Subject: [PATCH 02/13] feat: add `CheckboxComponent`, `CheckboxGroupComponent` and `RadioGroupComponent` --- lib/types/channels.d.ts | 86 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 4 deletions(-) diff --git a/lib/types/channels.d.ts b/lib/types/channels.d.ts index b9302b30..84a53f12 100644 --- a/lib/types/channels.d.ts +++ b/lib/types/channels.d.ts @@ -1127,7 +1127,7 @@ export type RawMessageActionRowComponent = RawButtonComponent | RawSelectMenuCom export type RawMessageComponent = RawMessageActionRow | RawSectionComponent | RawTextDisplayComponent | RawMediaGalleryComponent | RawSeparatorComponent | RawFileComponent | RawContainerComponent; /** @deprecated */ export type RawModalActionRowComponent = RawTextInput; -export type RawModalLabelComponent = RawSelectMenuComponent | RawTextInput | RawModalFileUploadComponent; +export type RawModalLabelComponent = RawCheckboxComponent | RawCheckboxGroupComponent | RawRadioGroupComponent | RawSelectMenuComponent | RawTextInput | RawModalFileUploadComponent; export type RawModalComponent = RawModalActionRow | RawModalLabel | RawTextDisplayComponent; export type RawButtonComponent = RawTextButton | URLButton | RawPremiumButton; export type RawSelectMenuComponent = RawStringSelectMenu | RawUserSelectMenu | RawRoleSelectMenu | RawMentionableSelectMenu | RawChannelSelectMenu; @@ -1152,7 +1152,7 @@ export type ToComponentFromRaw = T extends RawContainerComponent ? ContainerComponent : T extends RawModalLabel ? ModalLabel : T extends RawModalFileUploadComponent ? ModalFileUploadComponent : - never; + T extends RawRadioGroupComponent ? RadioGroupComponent : T extends RawCheckboxComponent ? CheckboxComponent : T extends RawCheckboxGroupComponent ? CheckboxGroupComponent : never; export type ToRawFromComponent = T extends MessageActionRow ? RawMessageActionRow : T extends ModalActionRow ? RawModalActionRow : @@ -1173,7 +1173,7 @@ export type ToRawFromComponent = T extends ContainerComponent ? RawContainerComponent : T extends ModalLabel ? RawModalLabel : T extends ModalFileUploadComponent ? RawModalFileUploadComponent : - never; + T extends RadioGroupComponent ? RawRadioGroupComponent : T extends CheckboxComponent ? RawCheckboxComponent : T extends CheckboxGroupComponent ? RawCheckboxGroupComponent : never; export interface RawActionRowBase { components: Array; @@ -1196,11 +1196,89 @@ export type MessageComponent = MessageActionRow | SectionComponent | TextDisplay /** @deprecated */ export type ModalActionRowComponent = TextInput; /** a child of a label component */ -export type ModalLabelComponent = SelectMenuComponent | TextInput | ModalFileUploadComponent; +export type ModalLabelComponent = CheckboxComponent | CheckboxGroupComponent | RadioGroupComponent | SelectMenuComponent | TextInput | ModalFileUploadComponent; export type ModalComponent = ModalActionRow | ModalLabel | TextDisplayComponent; export type ButtonComponent = TextButton | URLButton | PremiumButton; export type SelectMenuComponent = StringSelectMenu | UserSelectMenu | RoleSelectMenu | MentionableSelectMenu | ChannelSelectMenu; +export interface RadioGroupComponent extends BaseComponent { + customID: string; + id?: number; + options: Array; + required?: boolean; + type: ComponentTypes.RADIO_GROUP; +} + +export interface RawRadioGroupComponent extends BaseComponent { + custom_id: string; + id?: number; + options: Array; + required?: boolean; + type: ComponentTypes.RADIO_GROUP; +} + +export interface RadioGroupOption { + default?: boolean; + description?: string; + label: string; + value: string; +} + +export interface RawRadioGroupOption { + default?: boolean; + description?: string; + label: string; + value: string; +} + +export interface CheckboxComponent extends BaseComponent { + customID: string; + default?: boolean; + id?: number; + type: ComponentTypes.CHECKBOX; +} + +export interface RawCheckboxComponent extends BaseComponent { + custom_id: string; + default?: boolean; + id?: number; + type: ComponentTypes.CHECKBOX; +} + +export interface CheckboxGroupComponent extends BaseComponent { + customID: string; + id?: number; + maxValues?: number; + minValues?: number; + options: Array; + required?: boolean; + type: ComponentTypes.CHECKBOX_GROUP; +} + +export interface RawCheckboxGroupComponent extends BaseComponent { + custom_id: string; + id?: number; + max_values?: number; + min_values?: number; + options: Array; + required?: boolean; + type: ComponentTypes.CHECKBOX_GROUP; +} + +export interface CheckboxGroupOption { + default?: boolean; + description?: string; + label: string; + value: string; +} + +export interface RawCheckboxGroupOption { + default?: boolean; + description?: string; + label: string; + value: string; +} + export interface BaseComponent { /** Autoincremented number if not provided */ id?: number; From 44e3dcd375123168d735728ac5ede1c8260674e6 Mon Sep 17 00:00:00 2001 From: JJSosaL <251519186+jjsosal@users.noreply.github.com> Date: Sun, 22 Mar 2026 16:00:45 +0100 Subject: [PATCH 03/13] feat: add transformers to new modal components --- lib/util/Util.ts | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/lib/util/Util.ts b/lib/util/Util.ts index 54792198..eefa8ddb 100644 --- a/lib/util/Util.ts +++ b/lib/util/Util.ts @@ -294,6 +294,41 @@ export default class Util { type: component.type } as never; } + case ComponentTypes.RADIO_GROUP: { + return { + customId: component.custom_id, + required: component.required, + options: component.options.map(o => ({ + value: o.value, + description: o.description, + default: o.value, + label: o.value + })), + type: component.type + } as never; + } + case ComponentTypes.CHECKBOX: { + return { + customID: component.custom_id, + default: component.default, + type: component.type + } as never; + } + case ComponentTypes.CHECKBOX_GROUP: { + return { + customID: component.custom_id, + maxValues: component.max_values, + minValues: component.min_values, + options: component.options.map(o => ({ + default: o.default, + description: o.description, + label: o.label, + value: o.value + })), + required: component.required, + type: component.type + } as never; + } default: { return component as never; } @@ -461,6 +496,41 @@ export default class Util { required: component.required, type: component.type } as never; + case ComponentTypes.RADIO_GROUP: { + return { + custom_id: component.customID, + required: component.required, + options: component.options.map(o => ({ + value: o.value, + description: o.description, + default: o.value, + label: o.value + })), + type: component.type + } as never; + } + case ComponentTypes.CHECKBOX: { + return { + custom_id: component.customID, + default: component.default, + type: component.type + } as never; + } + case ComponentTypes.CHECKBOX_GROUP: { + return { + custom_id: component.customID, + max_values: component.maxValues, + min_values: component.minValues, + options: component.options.map(o => ({ + default: o.default, + description: o.description, + label: o.label, + value: o.value + })), + required: component.required, + type: component.type + } as never; + } default: { return component as never; } From 3b290d35bd279dee04e2107a4f484b596ca891e9 Mon Sep 17 00:00:00 2001 From: JJSosaL <251519186+jjsosal@users.noreply.github.com> Date: Sun, 22 Mar 2026 16:25:19 +0100 Subject: [PATCH 04/13] chore: add new component types to `ModalComponentTypes` --- lib/Constants.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Constants.ts b/lib/Constants.ts index bc0d9e05..cb22da0f 100644 --- a/lib/Constants.ts +++ b/lib/Constants.ts @@ -817,11 +817,11 @@ export enum ComponentTypes { CONTENT_INVENTORY_ENTRY = 16, CONTAINER = 17, LABEL = 18, - FILE_UPLOAD = 19, + FILE_UPLOAD = 19, - RADIO_GROUP = 21, + RADIO_GROUP = 21, CHECKBOX_GROUP = 22, - CHECKBOX = 23, + CHECKBOX = 23, } export type SelectMenuNonResolvedTypes = ComponentTypes.STRING_SELECT; @@ -829,7 +829,7 @@ export type SelectMenuResolvedTypes = ComponentTypes.USER_SELECT | ComponentType export type SelectMenuTypes = SelectMenuNonResolvedTypes | SelectMenuResolvedTypes; export type MessageComponentTypes = ComponentTypes.BUTTON | SelectMenuTypes; -export type ModalComponentTypes = ComponentTypes.TEXT_INPUT | SelectMenuTypes | ComponentTypes.FILE_UPLOAD; +export type ModalComponentTypes = ComponentTypes.CHECKBOX | ComponentTypes.CHECKBOX_GROUP | ComponentTypes.RADIO_GROUP | ComponentTypes.TEXT_INPUT | SelectMenuTypes | ComponentTypes.FILE_UPLOAD; export enum ButtonStyles { PRIMARY = 1, From ba6b38908bbf1a638c9800a2a62a535ab5032d42 Mon Sep 17 00:00:00 2001 From: JJSosaL <251519186+jjsosal@users.noreply.github.com> Date: Sun, 22 Mar 2026 17:02:22 +0100 Subject: [PATCH 05/13] feat: add new interaction types for modal components --- lib/types/interactions.d.ts | 40 +++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/lib/types/interactions.d.ts b/lib/types/interactions.d.ts index fe97e05d..7a919309 100644 --- a/lib/types/interactions.d.ts +++ b/lib/types/interactions.d.ts @@ -352,6 +352,16 @@ export interface RawModalSubmitComponentsStringValues; } +export interface RawModalSubmitComponentsBooleanValue extends RawModalSubmitComponentsBase { + type: T; + value: boolean; +} + +export interface RawModalSubmitComponentsNullableStringValue extends RawModalSubmitComponentsBase { + type: T; + value: string | null; +} + /** @deprecated */ interface RawModalComponentsActionRow { components: Array; @@ -382,12 +392,15 @@ T extends RawModalSubmitTextInputComponent ? ModalSubmitTextInputComponent : T extends RawModalSubmitMentionableSelectComponent ? ModalSubmitMentionableSelectComponent : T extends RawModalSubmitChannelSelectComponent ? ModalSubmitChannelSelectComponent : T extends RawModalSubmitFileUploadComponent ? ModalSubmitFileUploadComponent : - never; + T extends RawModalSubmitCheckboxComponent ? ModalSubmitCheckboxComponent : + T extends RawModalSubmitCheckboxGroupComponent ? ModalSubmitCheckboxGroupComponent : + T extends RawModalSubmitRadioGroupComponent ? ModalSubmitRadioGroupComponent : + never; /** @deprecated */ export type RawModalSubmitComponentsActionRow = RawModalComponentsActionRow; export type RawModalSubmitComponentsLabel = RawModalComponentsLabel; -export type RawModalSubmitComponents = RawModalSubmitTextInputComponent | RawModalSubmitFileUploadComponent | RawModalSubmitSelectComponents; +export type RawModalSubmitComponents = RawModalSubmitTextInputComponent | RawModalSubmitFileUploadComponent | RawModalSubmitSelectComponents | RawModalSubmitCheckboxComponent | ModalSubmitCheckboxGroupComponent | ModalSubmitRadioGroupComponent; export type RawModalSubmitSelectComponents = RawModalSubmitStringSelectComponent | RawModalSubmitUserSelectComponent | RawModalSubmitRoleSelectComponent | RawModalSubmitMentionableSelectComponent | RawModalSubmitChannelSelectComponent; export interface RawModalSubmitTextInputComponent extends RawModalSubmitComponentsStringValue {} export interface RawModalSubmitStringSelectComponent extends RawModalSubmitComponentsStringValues {} @@ -396,6 +409,9 @@ export interface RawModalSubmitRoleSelectComponent extends RawModalSubmitCompone export interface RawModalSubmitMentionableSelectComponent extends RawModalSubmitComponentsStringValues {} export interface RawModalSubmitChannelSelectComponent extends RawModalSubmitComponentsStringValues {} export interface RawModalSubmitFileUploadComponent extends RawModalSubmitComponentsStringValues { } +export interface RawModalSubmitCheckboxComponent extends RawModalSubmitComponentsBooleanValue { } +export interface RawModalSubmitCheckboxGroupComponent extends RawModalSubmitComponentsStringValues {} +export interface RawModalSubmitRadioGroupComponent extends RawModalSubmitComponentsNullableStringValue {} interface ModalSubmitComponentsBase { customID: string; @@ -411,6 +427,16 @@ export interface ModalSubmitComponentsStringValues; } +export interface ModalSubmitComponentsBooleanValue extends ModalSubmitComponentsBase { + type: T; + value: boolean; +} + +export interface ModalSubmitComponentsNullableStringValue extends ModalSubmitComponentsBase { + type: T; + value: string | null; +} + export type ToRawFromoModalSubmitComponent = T extends ModalSubmitTextInputComponent ? RawModalSubmitTextInputComponent : T extends ModalSubmitStringSelectComponent ? RawModalSubmitStringSelectComponent : @@ -419,12 +445,15 @@ T extends ModalSubmitTextInputComponent ? RawModalSubmitTextInputComponent : T extends ModalSubmitMentionableSelectComponent ? RawModalSubmitMentionableSelectComponent : T extends ModalSubmitChannelSelectComponent ? RawModalSubmitChannelSelectComponent : T extends ModalSubmitFileUploadComponent ? RawModalSubmitFileUploadComponent : - never; + T extends ModalSubmitCheckboxComponent ? RawModalSubmitCheckboxComponent : + T extends ModalSubmitCheckboxGroupComponent ? RawModalSubmitCheckboxGroupComponent : + T extends ModalSubmitRadioGroupComponent ? RawModalSubmitRadioGroupComponent : + never; /** @deprecated */ export type ModalSubmitComponentsActionRow = ModalComponentsActionRow; export type ModalSubmitComponentsLabel = ModalComponentsLabel; -export type ModalSubmitComponents = ModalSubmitTextInputComponent | ModalSubmitSelectComponents | ModalSubmitFileUploadComponent; +export type ModalSubmitComponents = ModalSubmitTextInputComponent | ModalSubmitSelectComponents | ModalSubmitFileUploadComponent | ModalSubmitCheckboxComponent | ModalSubmitCheckboxGroupComponent | ModalSubmitRadioGroupComponent; export type ModalSubmitSelectComponents = ModalSubmitStringSelectComponent | ModalSubmitUserSelectComponent | ModalSubmitRoleSelectComponent | ModalSubmitMentionableSelectComponent | ModalSubmitChannelSelectComponent; export interface ModalSubmitTextInputComponent extends ModalSubmitComponentsStringValue {} export interface ModalSubmitStringSelectComponent extends ModalSubmitComponentsStringValues {} @@ -433,6 +462,9 @@ export interface ModalSubmitRoleSelectComponent extends ModalSubmitComponentsStr export interface ModalSubmitMentionableSelectComponent extends ModalSubmitComponentsStringValues {} export interface ModalSubmitChannelSelectComponent extends ModalSubmitComponentsStringValues {} export interface ModalSubmitFileUploadComponent extends ModalSubmitComponentsStringValues { } +export interface ModalSubmitCheckboxComponent extends ModalSubmitComponentsBooleanValue {} +export interface ModalSubmitCheckboxGroupComponent extends ModalSubmitComponentsStringValues { } +export interface ModalSubmitRadioGroupComponent extends ModalSubmitComponentsNullableStringValue {} export type ApplicationCommandTypesWithTarget = ApplicationCommandTypes.USER | ApplicationCommandTypes.MESSAGE; From 8dcc3c76f5d6aeb40670251e29eb65c789f62d38 Mon Sep 17 00:00:00 2001 From: JJSosaL <251519186+jjsosal@users.noreply.github.com> Date: Sun, 22 Mar 2026 17:05:31 +0100 Subject: [PATCH 06/13] style: fix indent --- lib/types/channels.d.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/types/channels.d.ts b/lib/types/channels.d.ts index 84a53f12..a6c836f8 100644 --- a/lib/types/channels.d.ts +++ b/lib/types/channels.d.ts @@ -1152,7 +1152,10 @@ export type ToComponentFromRaw = T extends RawContainerComponent ? ContainerComponent : T extends RawModalLabel ? ModalLabel : T extends RawModalFileUploadComponent ? ModalFileUploadComponent : - T extends RawRadioGroupComponent ? RadioGroupComponent : T extends RawCheckboxComponent ? CheckboxComponent : T extends RawCheckboxGroupComponent ? CheckboxGroupComponent : never; + T extends RawRadioGroupComponent ? RadioGroupComponent : + T extends RawCheckboxComponent ? CheckboxComponent : + T extends RawCheckboxGroupComponent ? CheckboxGroupComponent : + never; export type ToRawFromComponent = T extends MessageActionRow ? RawMessageActionRow : T extends ModalActionRow ? RawModalActionRow : @@ -1173,7 +1176,10 @@ export type ToRawFromComponent = T extends ContainerComponent ? RawContainerComponent : T extends ModalLabel ? RawModalLabel : T extends ModalFileUploadComponent ? RawModalFileUploadComponent : - T extends RadioGroupComponent ? RawRadioGroupComponent : T extends CheckboxComponent ? RawCheckboxComponent : T extends CheckboxGroupComponent ? RawCheckboxGroupComponent : never; + T extends RadioGroupComponent ? RawRadioGroupComponent : + T extends CheckboxComponent ? RawCheckboxComponent : + T extends CheckboxGroupComponent ? RawCheckboxGroupComponent : + never; export interface RawActionRowBase { components: Array; From d77bce4bc131e23c458fb5ffce59f14313347435 Mon Sep 17 00:00:00 2001 From: JJSosaL <251519186+jjsosal@users.noreply.github.com> Date: Sun, 22 Mar 2026 17:06:48 +0100 Subject: [PATCH 07/13] fix!: typo in `ToRawFromModalSubmitComponent` --- lib/types/interactions.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/types/interactions.d.ts b/lib/types/interactions.d.ts index 7a919309..6c99e724 100644 --- a/lib/types/interactions.d.ts +++ b/lib/types/interactions.d.ts @@ -437,7 +437,7 @@ export interface ModalSubmitComponentsNullableStringValue = +export type ToRawFromModalSubmitComponent = T extends ModalSubmitTextInputComponent ? RawModalSubmitTextInputComponent : T extends ModalSubmitStringSelectComponent ? RawModalSubmitStringSelectComponent : T extends ModalSubmitUserSelectComponent ? RawModalSubmitUserSelectComponent : From a7bcedeb5b4e47522ebbfa94bf2bc3b3f05e7f8e Mon Sep 17 00:00:00 2001 From: JJSosaL <251519186+jjsosal@users.noreply.github.com> Date: Sun, 22 Mar 2026 17:33:50 +0100 Subject: [PATCH 08/13] fix!: `customId` -> `customID` --- lib/util/Util.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util/Util.ts b/lib/util/Util.ts index eefa8ddb..51483ef4 100644 --- a/lib/util/Util.ts +++ b/lib/util/Util.ts @@ -296,7 +296,7 @@ export default class Util { } case ComponentTypes.RADIO_GROUP: { return { - customId: component.custom_id, + customID: component.custom_id, required: component.required, options: component.options.map(o => ({ value: o.value, From 000dc518f09b07db2783a50e6c02d2ca28a4171c Mon Sep 17 00:00:00 2001 From: JJSosaL <251519186+jjsosal@users.noreply.github.com> Date: Sun, 22 Mar 2026 17:52:14 +0100 Subject: [PATCH 09/13] fix: delete parsed type in raw types --- lib/types/interactions.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/types/interactions.d.ts b/lib/types/interactions.d.ts index 6c99e724..a6e1f302 100644 --- a/lib/types/interactions.d.ts +++ b/lib/types/interactions.d.ts @@ -400,7 +400,7 @@ T extends RawModalSubmitTextInputComponent ? ModalSubmitTextInputComponent : /** @deprecated */ export type RawModalSubmitComponentsActionRow = RawModalComponentsActionRow; export type RawModalSubmitComponentsLabel = RawModalComponentsLabel; -export type RawModalSubmitComponents = RawModalSubmitTextInputComponent | RawModalSubmitFileUploadComponent | RawModalSubmitSelectComponents | RawModalSubmitCheckboxComponent | ModalSubmitCheckboxGroupComponent | ModalSubmitRadioGroupComponent; +export type RawModalSubmitComponents = RawModalSubmitTextInputComponent | RawModalSubmitFileUploadComponent | RawModalSubmitSelectComponents | RawModalSubmitCheckboxComponent | RawModalSubmitCheckboxGroupComponent | ModalSubmitRadioGroupComponent; export type RawModalSubmitSelectComponents = RawModalSubmitStringSelectComponent | RawModalSubmitUserSelectComponent | RawModalSubmitRoleSelectComponent | RawModalSubmitMentionableSelectComponent | RawModalSubmitChannelSelectComponent; export interface RawModalSubmitTextInputComponent extends RawModalSubmitComponentsStringValue {} export interface RawModalSubmitStringSelectComponent extends RawModalSubmitComponentsStringValues {} From 61f916d9cf3475cf7b912dc40b73c672e6dc93fa Mon Sep 17 00:00:00 2001 From: JJSosaL <251519186+jjsosal@users.noreply.github.com> Date: Sun, 22 Mar 2026 18:01:10 +0100 Subject: [PATCH 10/13] fix: delete parsed type in raw types --- lib/types/interactions.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/types/interactions.d.ts b/lib/types/interactions.d.ts index a6e1f302..6765abd9 100644 --- a/lib/types/interactions.d.ts +++ b/lib/types/interactions.d.ts @@ -400,7 +400,7 @@ T extends RawModalSubmitTextInputComponent ? ModalSubmitTextInputComponent : /** @deprecated */ export type RawModalSubmitComponentsActionRow = RawModalComponentsActionRow; export type RawModalSubmitComponentsLabel = RawModalComponentsLabel; -export type RawModalSubmitComponents = RawModalSubmitTextInputComponent | RawModalSubmitFileUploadComponent | RawModalSubmitSelectComponents | RawModalSubmitCheckboxComponent | RawModalSubmitCheckboxGroupComponent | ModalSubmitRadioGroupComponent; +export type RawModalSubmitComponents = RawModalSubmitTextInputComponent | RawModalSubmitFileUploadComponent | RawModalSubmitSelectComponents | RawModalSubmitCheckboxComponent | RawModalSubmitCheckboxGroupComponent | RawModalSubmitRadioGroupComponent; export type RawModalSubmitSelectComponents = RawModalSubmitStringSelectComponent | RawModalSubmitUserSelectComponent | RawModalSubmitRoleSelectComponent | RawModalSubmitMentionableSelectComponent | RawModalSubmitChannelSelectComponent; export interface RawModalSubmitTextInputComponent extends RawModalSubmitComponentsStringValue {} export interface RawModalSubmitStringSelectComponent extends RawModalSubmitComponentsStringValues {} From b6b5bb95c8be3b91fe9bb7e1f1003de9ed8b4e16 Mon Sep 17 00:00:00 2001 From: JJSosaL <251519186+jjsosal@users.noreply.github.com> Date: Sun, 22 Mar 2026 18:02:20 +0100 Subject: [PATCH 11/13] chore: handle `CHECKBOX`, `RADIO_GROUP` and `CHECKBOX_GROUP` --- lib/util/Util.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/util/Util.ts b/lib/util/Util.ts index 51483ef4..48326b53 100644 --- a/lib/util/Util.ts +++ b/lib/util/Util.ts @@ -776,6 +776,8 @@ export default class Util { modalSubmitComponentToParsed(component: T): Types.Interactions.ToModalSubmitComponentFromRaw { switch (component.type) { + case ComponentTypes.CHECKBOX: + case ComponentTypes.RADIO_GROUP: case ComponentTypes.TEXT_INPUT: { return { customID: component.custom_id, @@ -789,6 +791,7 @@ export default class Util { case ComponentTypes.ROLE_SELECT: case ComponentTypes.MENTIONABLE_SELECT: case ComponentTypes.CHANNEL_SELECT: + case ComponentTypes.CHECKBOX_GROUP: case ComponentTypes.FILE_UPLOAD: { return { customID: component.custom_id, @@ -796,6 +799,7 @@ export default class Util { values: component.values } as never; } + default: { return component as never; } From 3fb490f78bd743e27792e458021ca8d8e6bf6805 Mon Sep 17 00:00:00 2001 From: JJSosaL <251519186+jjsosal@users.noreply.github.com> Date: Sun, 22 Mar 2026 19:24:46 +0100 Subject: [PATCH 12/13] fix: invalid properties at options --- lib/util/Util.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/util/Util.ts b/lib/util/Util.ts index 48326b53..e1ea2f58 100644 --- a/lib/util/Util.ts +++ b/lib/util/Util.ts @@ -299,10 +299,10 @@ export default class Util { customID: component.custom_id, required: component.required, options: component.options.map(o => ({ - value: o.value, + default: o.default, description: o.description, - default: o.value, - label: o.value + label: o.label, + value: o.value })), type: component.type } as never; @@ -501,10 +501,10 @@ export default class Util { custom_id: component.customID, required: component.required, options: component.options.map(o => ({ - value: o.value, + default: o.default, description: o.description, - default: o.value, - label: o.value + label: o.label, + value: o.value })), type: component.type } as never; From 7b0e14ad1b1aec39d3b1877bcddec33a2fabe594 Mon Sep 17 00:00:00 2001 From: JJSosaL <251519186+jjsosal@users.noreply.github.com> Date: Sun, 22 Mar 2026 19:38:40 +0100 Subject: [PATCH 13/13] feat(ModalSubmitInteractionComponentsWrapper): add methods for new modal components --- ...ModalSubmitInteractionComponentsWrapper.ts | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/lib/util/interactions/ModalSubmitInteractionComponentsWrapper.ts b/lib/util/interactions/ModalSubmitInteractionComponentsWrapper.ts index ddc4a438..eee545ac 100644 --- a/lib/util/interactions/ModalSubmitInteractionComponentsWrapper.ts +++ b/lib/util/interactions/ModalSubmitInteractionComponentsWrapper.ts @@ -51,6 +51,50 @@ export default class ModalSubmitInteractionComponentsWrapper { return component?.values && mapRawToResolved("channel", component.values, this.resolved.channels, false); } + /** + * Get a checkbox option. + * @param name The name of the option + * @param required If true, an error will be thrown if the option is not present. + */ + getCheckboxComponent(name: string, required?: false): Types.Interactions.ModalSubmitCheckboxComponent | undefined; + getCheckboxComponent(name: string, required: true): Types.Interactions.ModalSubmitCheckboxComponent; + getCheckboxComponent(name: string, required?: boolean): Types.Interactions.ModalSubmitCheckboxComponent | undefined { + return this._getComponent(name, required, ComponentTypes.CHECKBOX); + } + + /** + * Get a checkbox group option. + * @param name The name of the option. + * @param required If true, an error will be thrown if the option is not present. + */ + getCheckboxGroupComponent(name: string, required?: false): Types.Interactions.ModalSubmitCheckboxGroupComponent | undefined; + getCheckboxGroupComponent(name: string, required: true): Types.Interactions.ModalSubmitCheckboxGroupComponent; + getCheckboxGroupComponent(name: string, required?: boolean): Types.Interactions.ModalSubmitCheckboxGroupComponent | undefined { + return this._getComponent(name, required, ComponentTypes.CHECKBOX_GROUP); + } + + /** + * Get the values of a checkbox group option. + * @param name The name of the option. + * @param required If true, an error will be thrown if the option is not present. + */ + getCheckboxGroupValues(name: string, required?: false): Array | undefined; + getCheckboxGroupValues(name: string, required: true): Array; + getCheckboxGroupValues(name: string, required?: boolean): Array | undefined { + return this.getCheckboxGroupComponent(name, required as false)?.values; + } + + /** + * Get the value of a checkbox option. + * @param name The name of the option + * @param required If true, an error will be thrown if the option is not present. + */ + getCheckboxValue(name: string, required?: false): boolean | undefined; + getCheckboxValue(name: string, required: true): boolean; + getCheckboxValue(name: string, required?: boolean): boolean | undefined { + return this.getCheckboxComponent(name, required as false)?.value; + } + /** Get the components in this interaction. */ getComponents(): Array { return this.raw.flatMap(r => r.type === ComponentTypes.ACTION_ROW ? r.components : r.component).filter(Boolean); @@ -102,6 +146,30 @@ export default class ModalSubmitInteractionComponentsWrapper { return component?.values && mapRawToResolved("mentionable", component.values, new Collection([...this.resolved.users, ...this.resolved.roles]), false); } + /** + * Get a radio group option. + * @param name The name of the option. + * @param required If true, an error will be thrown if the option is not present. + */ + getRadioGroupComponent(name: string, required?: false): Types.Interactions.ModalSubmitRadioGroupComponent | undefined; + getRadioGroupComponent(name: string, required: true): Types.Interactions.ModalSubmitRadioGroupComponent; + getRadioGroupComponent(name: string, required?: boolean): Types.Interactions.ModalSubmitRadioGroupComponent | undefined { + return this._getComponent(name, required, ComponentTypes.RADIO_GROUP); + } + + /** + * Get the value of a radio group option. + * @param name The name of the option. + * @param required If true, an error will be thrown if the option is not present. + * + * Note: If no option is selected, `null` will be returned. + */ + getRadioGroupValue(name: string, required?: false): string | null | undefined; + getRadioGroupValue(name: string, required: true): string | null; + getRadioGroupValue(name: string, required?: boolean): string | null|undefined { + return this.getRadioGroupComponent(name, required as false)?.value; + } + /** * Get a role select option. * @param name The name of the option.