Skip to content

Commit

Permalink
feat: set methods for MessageActionRow and MessageSelectMenu (#6490)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImRodry committed Aug 24, 2021
1 parent 7aff15a commit fb50dd9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/structures/MessageActionRow.js
Expand Up @@ -59,6 +59,16 @@ class MessageActionRow extends BaseMessageComponent {
return this;
}

/**
* Sets the components of the action row.
* @param {...MessageActionRowComponentResolvable[]} components The components to set
* @returns {MessageActionRow}
*/
setComponents(...components) {
this.spliceComponents(0, this.components.length, components);
return this;
}

/**
* Removes, replaces, and inserts components in the action row.
* @param {number} index The index to start at
Expand Down
10 changes: 10 additions & 0 deletions src/structures/MessageSelectMenu.js
Expand Up @@ -145,6 +145,16 @@ class MessageSelectMenu extends BaseMessageComponent {
return this;
}

/**
* Sets the options of the select menu.
* @param {...MessageSelectOptionData|MessageSelectOptionData[]} options The options to set
* @returns {MessageSelectMenu}
*/
setOptions(...options) {
this.spliceOptions(0, this.options.length, options);
return this;
}

/**
* Removes, replaces, and inserts options in the select menu.
* @param {number} index The index to start at
Expand Down
4 changes: 4 additions & 0 deletions typings/index.d.ts
Expand Up @@ -1183,6 +1183,9 @@ export class MessageActionRow extends BaseMessageComponent {
public addComponents(
...components: MessageActionRowComponentResolvable[] | MessageActionRowComponentResolvable[][]
): this;
public setComponents(
...components: MessageActionRowComponentResolvable[] | MessageActionRowComponentResolvable[][]
): this;
public spliceComponents(
index: number,
deleteCount: number,
Expand Down Expand Up @@ -1392,6 +1395,7 @@ export class MessageSelectMenu extends BaseMessageComponent {
public placeholder: string | null;
public type: 'SELECT_MENU';
public addOptions(...options: MessageSelectOptionData[] | MessageSelectOptionData[][]): this;
public setOptions(...options: MessageSelectOptionData[] | MessageSelectOptionData[][]): this;
public setCustomId(customId: string): this;
public setDisabled(disabled?: boolean): this;
public setMaxValues(maxValues: number): this;
Expand Down

0 comments on commit fb50dd9

Please sign in to comment.