diff --git a/src/builders/SelectMenu.ts b/src/builders/SelectMenu.ts index 7a40665..3141e99 100644 --- a/src/builders/SelectMenu.ts +++ b/src/builders/SelectMenu.ts @@ -177,6 +177,8 @@ export class RoleSelectMenu extends SelectMenu }; + /** * Represents a Select Menu for selecting mentionable entities. * @example @@ -187,6 +189,34 @@ export class MentionableSelectMenu extends SelectMenu = {}) { super({ ...data, type: ComponentType.MentionableSelect }); } + + /** + * Sets the default selected roles or users for the select menu. + * @param mentionables - Role/User id and type to be set as default. + * @returns The current MentionableSelectMenu instance. + */ + setDefaults(...mentionables: RestOrArray) { + this.data.default_values = mentionables.flat().map(mentionable => ({ + id: mentionable.id, + type: SelectMenuDefaultValueType[mentionable.type], + })); + return this; + } + + /** + * Adds default selected roles or users for the select menu. + * @param mentionables - Role/User id and type to be added as default. + * @returns The current MentionableSelectMenu instance. + */ + addDefaultMentionables(...mentionables: RestOrArray) { + this.data.default_values = (this.data.default_values ?? []).concat( + mentionables.flat().map(mentionable => ({ + id: mentionable.id, + type: SelectMenuDefaultValueType[mentionable.type], + })), + ); + return this; + } } /**