refactor: added TextBasedChannels type (#6286)

This commit is contained in:
Antonio Román
2021-08-04 00:12:51 +02:00
committed by GitHub
parent a72b5a355e
commit 61db5f7618
12 changed files with 42 additions and 45 deletions

View File

@@ -110,8 +110,7 @@ class Channel extends Base {
}
/**
* Indicates whether this channel is text-based
* ({@link TextChannel}, {@link DMChannel}, {@link NewsChannel} or {@link ThreadChannel}).
* Indicates whether this channel is {@link TextBasedChannels text-based}.
* @returns {boolean}
*/
isText() {

View File

@@ -17,7 +17,7 @@ class CommandInteraction extends Interaction {
/**
* The channel this interaction was sent in
* @type {?(TextChannel|NewsChannel|DMChannel)}
* @type {?TextBasedChannels}
* @name CommandInteraction#channel
* @readonly
*/

View File

@@ -89,7 +89,7 @@ class Interaction extends Base {
/**
* The channel this interaction was sent in
* @type {?Channel}
* @type {?TextBasedChannels}
* @readonly
*/
get channel() {

View File

@@ -7,7 +7,7 @@ const { InteractionTypes, MessageComponentTypes } = require('../util/Constants')
/**
* @typedef {CollectorOptions} InteractionCollectorOptions
* @property {TextChannel|DMChannel|NewsChannel} [channel] The channel to listen to interactions from
* @property {TextBasedChannels} [channel] The channel to listen to interactions from
* @property {MessageComponentType} [componentType] The type of component to listen for
* @property {Guild} [guild] The guild to listen to interactions from
* @property {InteractionType} [interactionType] The type of interaction to listen for
@@ -39,7 +39,7 @@ class InteractionCollector extends Collector {
/**
* The channel from which to collect interactions, if provided
* @type {?(TextChannel|DMChannel|NewsChannel)}
* @type {?TextBasedChannels}
*/
this.channel = this.message?.channel ?? options.channel ?? null;

View File

@@ -27,14 +27,14 @@ class Message extends Base {
/**
* @param {Client} client The instantiating client
* @param {APIMessage} data The data for the message
* @param {TextChannel|DMChannel|NewsChannel|ThreadChannel} channel The channel the message was sent in
* @param {TextBasedChannels} channel The channel the message was sent in
*/
constructor(client, data, channel) {
super(client);
/**
* The channel that the message was sent in
* @type {TextChannel|DMChannel|NewsChannel|ThreadChannel}
* @type {TextBasedChannels}
*/
this.channel = channel;

View File

@@ -16,7 +16,7 @@ const { Events } = require('../util/Constants');
*/
class MessageCollector extends Collector {
/**
* @param {TextChannel|DMChannel} channel The channel
* @param {TextBasedChannels} channel The channel
* @param {MessageCollectorOptions} options The options to be applied to this collector
* @emits MessageCollector#message
*/
@@ -25,7 +25,7 @@ class MessageCollector extends Collector {
/**
* The channel
* @type {TextBasedChannel}
* @type {TextBasedChannels}
*/
this.channel = channel;

View File

@@ -8,7 +8,7 @@ const Base = require('./Base');
*/
class Typing extends Base {
/**
* @param {TextChannel|DMChannel|NewsChannel|ThreadChannel} channel The channel this typing came from
* @param {TextBasedChannels} channel The channel this typing came from
* @param {User} user The user that started typing
* @param {APITypingStart} data The raw data received
*/
@@ -17,7 +17,7 @@ class Typing extends Base {
/**
* The channel the status is from
* @type {TextChannel|DMChannel|NewsChannel|ThreadChannel}
* @type {TextBasedChannels}
*/
this.channel = channel;