From fee9a218e8342ab64ba5ca2eefcd71d963d15739 Mon Sep 17 00:00:00 2001 From: Jyguy Date: Fri, 27 Mar 2020 15:54:27 -0400 Subject: [PATCH] docs(MessageMentionTypes): move possible values to description (#3990) * docs(MessageMentionTypes): correct type * docs(MessageMentionTypes): change role to roles * docs(MessageMentionOptions): correct description to allow usage as an array * remove unneeded part of description Co-Authored-By: Ryan Munro * docs: add DisableMentionType to remove literal string types Co-authored-by: Ryan Munro --- src/structures/Webhook.js | 4 ++-- src/structures/interfaces/TextBasedChannel.js | 19 +++++++++++++++---- src/util/Constants.js | 3 +-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/structures/Webhook.js b/src/structures/Webhook.js index 4dd8d1951..b9aed9dfb 100644 --- a/src/structures/Webhook.js +++ b/src/structures/Webhook.js @@ -86,8 +86,8 @@ class Webhook { * @property {Object[]} [embeds] An array of embeds for the message * @property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content * (see [here](https://discordapp.com/developers/docs/resources/channel#embed-object) for more details) - * @property {'none' | 'all' | 'everyone'} [disableMentions=this.client.options.disableMentions] Whether or not - * all mentions or everyone/here mentions should be sanitized to prevent unexpected mentions + * @property {DisableMentionType} [disableMentions=this.client.options.disableMentions] Whether or not all mentions or + * everyone/here mentions should be sanitized to prevent unexpected mentions * @property {FileOptions[]|string[]} [files] Files to send with the message * @property {string|boolean} [code] Language for optional codeblock formatting to apply * @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if diff --git a/src/structures/interfaces/TextBasedChannel.js b/src/structures/interfaces/TextBasedChannel.js index 609a05050..b63c92aea 100644 --- a/src/structures/interfaces/TextBasedChannel.js +++ b/src/structures/interfaces/TextBasedChannel.js @@ -59,8 +59,8 @@ class TextBasedChannel { * @property {MessageEmbed|Object} [embed] An embed for the message * (see [here](https://discordapp.com/developers/docs/resources/channel#embed-object) for more details) * @property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content - * @property {'none' | 'all' | 'everyone'} [disableMentions=this.client.options.disableMentions] Whether or not - * all mentions or everyone/here mentions should be sanitized to prevent unexpected mentions + * @property {DisableMentionType} [disableMentions=this.client.options.disableMentions] Whether or not all mentions or + * everyone/here mentions should be sanitized to prevent unexpected mentions * @property {FileOptions[]|BufferResolvable[]} [files] Files to send with the message * @property {string|boolean} [code] Language for optional codeblock formatting to apply * @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if @@ -77,8 +77,19 @@ class TextBasedChannel { */ /** - * Types of mentions to enable in MessageMentionOptions - * @typedef {'role' | 'users' | 'everyone'} MessageMentionTypes + * Types of mentions to enable in MessageMentionOptions. + * - `roles` + * - `users` + * - `everyone` + * @typedef {string} MessageMentionTypes + */ + + /** + * The type of mentions to disable. + * - `none` + * - `all` + * - `everyone` + * @typedef {string} DisableMentionType */ /** diff --git a/src/util/Constants.js b/src/util/Constants.js index 7bc28a4e2..508ede0eb 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -21,8 +21,7 @@ const browser = (exports.browser = typeof window !== 'undefined'); * the message cache lifetime (in seconds, 0 for never) * @property {boolean} [fetchAllMembers=false] Whether to cache all guild members and users upon startup, as well as * upon joining a guild (should be avoided whenever possible) - * @property {'none' | 'all' | 'everyone'} [disableMentions='none'] Default value - * for {@link MessageOptions#disableMentions} + * @property {DisableMentionType} [disableMentions='none'] Default value for {@link MessageOptions#disableMentions} * @property {PartialType[]} [partials] Structures allowed to be partial. This means events can be emitted even when * they're missing all the data for a particular structure. See the "Partials" topic listed in the sidebar for some * important usage information, as partials require you to put checks in place when handling data.