Skip to content

Commit

Permalink
docs: updates and consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
monbrey committed Jun 4, 2021
1 parent 659d1ce commit b9754ed
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 20 deletions.
24 changes: 13 additions & 11 deletions src/structures/MessageActionRow.js
Expand Up @@ -4,33 +4,35 @@ const BaseMessageComponent = require('./BaseMessageComponent');
const { MessageComponentTypes } = require('../util/Constants');

/**
* Represents an ActionRow containing message components.
* Represents an action row containing message components.
* @extends {BaseMessageComponent}
*/
class MessageActionRow extends BaseMessageComponent {
/**
* Components that can be placed in a MessageActionRow
* * MessageButton
* Components that can be placed in an action row
* * {@link MessageButton}
* * {@link MessageSelectMenu}
* @typedef {MessageButton|MessageSelectMenu} MessageActionRowComponent
*/

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

/**
* Data that can be resolved into a components that can be placed in a MessageActionRow
* * MessageActionRowComponent
* * MessageActionRowComponentOptions
* Data that can be resolved into components that can be placed in an action row
* * {@link MessageActionRowComponent}
* * {@link MessageActionRowComponentOptions}
* @typedef {MessageActionRowComponent|MessageActionRowComponentOptions} MessageActionRowComponentResolvable
*/

/**
* @typedef {BaseMessageComponentOptions} MessageActionRowOptions
* @property {MessageActionRowComponentResolvable[]} [components]
* The components to place in this ActionRow
* The components to place in this action row
*/

/**
Expand All @@ -40,14 +42,14 @@ class MessageActionRow extends BaseMessageComponent {
super({ type: 'ACTION_ROW' });

/**
* The components in this MessageActionRow
* The components in this action row
* @type {MessageActionRowComponent[]}
*/
this.components = (data.components ?? []).map(c => BaseMessageComponent.create(c, null, true));
}

/**
* Adds components to the row.
* Adds components to the action row.
* @param {...MessageActionRowComponentResolvable[]} components The components to add
* @returns {MessageActionRow}
*/
Expand Down
7 changes: 4 additions & 3 deletions src/structures/MessageButton.js
Expand Up @@ -6,7 +6,7 @@ const { MessageButtonStyles, MessageComponentTypes } = require('../util/Constant
const Util = require('../util/Util');

/**
* Represents a Button message component.
* Represents a button message component.
* @extends {BaseMessageComponent}
*/
class MessageButton extends BaseMessageComponent {
Expand Down Expand Up @@ -119,7 +119,8 @@ class MessageButton extends BaseMessageComponent {
}

/**
* Sets the URL of this button. MessageButton#style should be LINK
* Sets the URL of this button.
* <note>MessageButton#style must be LINK when setting a URL</note>
* @param {string} url The URL of this button
* @returns {MessageButton}
*/
Expand Down Expand Up @@ -153,7 +154,7 @@ class MessageButton extends BaseMessageComponent {
*/

/**
* Resolves the style of a MessageButton
* Resolves the style of a button
* @param {MessageButtonStyleResolvable} style The style to resolve
* @returns {MessageButtonStyle}
* @private
Expand Down
6 changes: 3 additions & 3 deletions src/structures/MessageComponentInteraction.js
Expand Up @@ -21,13 +21,13 @@ class MessageComponentInteraction extends Interaction {
this.message = data.message ? this.channel?.messages.add(data.message) ?? data.message : null;

/**
* The custom ID of the component which was clicked
* The custom ID of the component which was interacted with
* @type {string}
*/
this.customID = data.data.custom_id;

/**
* The type of component that was interacted with
* The type of component which was interacted with
* @type {string}
*/
this.componentType = MessageComponentInteraction.resolveType(data.data.component_type);
Expand All @@ -51,7 +51,7 @@ class MessageComponentInteraction extends Interaction {
this.webhook = new WebhookClient(this.applicationID, this.token, this.client.options);

/**
* The values selected in a MessageSelectMenu interaction
* The values selected, if the component which was interacted with was a select menu
* @type {string[]}
*/
this.values = this.componentType === 'SELECT_MENU' ? data.data.values : null;
Expand Down
2 changes: 1 addition & 1 deletion src/structures/MessageComponentInteractionCollector.js
Expand Up @@ -40,7 +40,7 @@ class MessageComponentInteractionCollector extends Collector {
this.channel = this.message ? this.message.channel : source;

/**
* The users which have interacted to buttons on this collector
* The users which have interacted to components on this collector
* @type {Collection}
*/
this.users = new Collection();
Expand Down
4 changes: 2 additions & 2 deletions src/structures/MessageSelectMenu.js
Expand Up @@ -5,7 +5,7 @@ const { MessageComponentTypes } = require('../util/Constants');
const Util = require('../util/Util');

/**
* Represents a SelectMenu message components
* Represents a select menu message component
* @extends {BaseMessageComponent}
*/
class MessageSelectMenu extends BaseMessageComponent {
Expand Down Expand Up @@ -79,7 +79,7 @@ class MessageSelectMenu extends BaseMessageComponent {
}

/**
* Sets the maximum number of selection allowed for this select menu
* Sets the maximum number of selections allowed for this select menu
* @param {number} maxValues Number of selections to be allowed
* @returns {MessageSelectMenu}
*/
Expand Down

0 comments on commit b9754ed

Please sign in to comment.