Skip to content

Commit

Permalink
refactor: remove the separate ModalActionRow
Browse files Browse the repository at this point in the history
  • Loading branch information
monbrey committed Feb 9, 2022
1 parent 680506e commit e30c279
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 108 deletions.
6 changes: 4 additions & 2 deletions src/structures/MessageActionRow.js
Expand Up @@ -12,14 +12,16 @@ class MessageActionRow extends BaseMessageComponent {
* Components that can be placed in an action row
* * MessageButton
* * MessageSelectMenu
* @typedef {MessageButton|MessageSelectMenu} MessageActionRowComponent
* * InputTextComponent
* @typedef {MessageButton|MessageSelectMenu|InputTextComponent} MessageActionRowComponent
*/

/**
* Options for components that can be placed in an action row
* * MessageButtonOptions
* * MessageSelectMenuOptions
* @typedef {MessageButtonOptions|MessageSelectMenuOptions} MessageActionRowComponentOptions
* * InputTextComponentOptions
* @typedef {MessageButtonOptions|MessageSelectMenuOptions|InputTextComponentOptions} MessageActionRowComponentOptions
*/

/**
Expand Down
12 changes: 6 additions & 6 deletions src/structures/Modal.js
Expand Up @@ -8,7 +8,7 @@ class Modal {
* @typedef {object} ModalOptions
* @property {string} [customId] A unique string to be sent in the interaction when clicked
* @property {string} [title] The title to be displayed on this modal
* @property {ModalActionRow[]|ModalActionRow[]} [components]
* @property {MessageActionRow[]|MessageActionRowOptions[]} [components]
* Action rows containing interactive components for the modal (input text components)
*/

Expand All @@ -18,8 +18,8 @@ class Modal {
*/
constructor(data = {}, client = null) {
/**
* A list of ModalActionRows in the modal
* @type {ModalActionRow[]}
* A list of MessageActionRows in the modal
* @type {MessageActionRow[]}
*/
this.components = data.components?.map(c => BaseMessageComponent.create(c, client)) ?? [];

Expand All @@ -38,7 +38,7 @@ class Modal {

/**
* Adds components to the modal.
* @param {...ModalActionRowResolvable[]} components The components to add
* @param {...MessageActionRowResolvable[]} components The components to add
* @returns {Modal}
*/
addComponents(...components) {
Expand All @@ -48,7 +48,7 @@ class Modal {

/**
* Sets the components of the modal.
* @param {...ModalActionRowResolvable[]} components The components to set
* @param {...MessageActionRowResolvable[]} components The components to set
* @returns {Modal}
*/
setComponents(...components) {
Expand All @@ -70,7 +70,7 @@ class Modal {
* Removes, replaces, and inserts components in the modal.
* @param {number} index The index to start at
* @param {number} deleteCount The number of components to remove
* @param {...ModalActionRowResolvable[]} [components] The replacing components
* @param {...MessageActionRowResolvable[]} [components] The replacing components
* @returns {Modal}
*/
spliceComponents(index, deleteCount, ...components) {
Expand Down
99 changes: 0 additions & 99 deletions src/structures/ModalActionRow.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/structures/ModalSubmitInteraction.js
Expand Up @@ -16,7 +16,7 @@ class ModalSubmitInteraction extends Interaction {

/**
* The inputs within the modal
* @type {Array<ModalActionRow<ModalActionRowComponent>>}
* @type {Array<MessageActionRow<MessageActionRowComponent>>}
*/
this.components = data.data.components?.map(c => BaseMessageComponent.create(c, this.client)) ?? [];
}
Expand Down

0 comments on commit e30c279

Please sign in to comment.