mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
refactor: added TextBasedChannels type (#6286)
This commit is contained in:
@@ -14,7 +14,7 @@ module.exports = (client, { d: data }) => {
|
||||
* Emitted whenever the pins of a channel are updated. Due to the nature of the WebSocket event,
|
||||
* not much information can be provided easily here - you need to manually check the pins yourself.
|
||||
* @event Client#channelPinsUpdate
|
||||
* @param {DMChannel|TextChannel|NewsChannel} channel The channel that the pins update occurred in
|
||||
* @param {TextBasedChannels} channel The channel that the pins update occurred in
|
||||
* @param {Date} time The time of the pins update
|
||||
*/
|
||||
client.emit(Events.CHANNEL_PINS_UPDATE, channel, time);
|
||||
|
||||
@@ -16,7 +16,7 @@ class MessageManager extends CachedManager {
|
||||
|
||||
/**
|
||||
* The channel that the messages belong to
|
||||
* @type {TextBasedChannel}
|
||||
* @type {TextBasedChannels}
|
||||
*/
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -89,7 +89,7 @@ class Interaction extends Base {
|
||||
|
||||
/**
|
||||
* The channel this interaction was sent in
|
||||
* @type {?Channel}
|
||||
* @type {?TextBasedChannels}
|
||||
* @readonly
|
||||
*/
|
||||
get channel() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -456,6 +456,15 @@ exports.ChannelTypes = createEnum([
|
||||
'GUILD_STAGE_VOICE',
|
||||
]);
|
||||
|
||||
/**
|
||||
* The channels that are text-based.
|
||||
* * DMChannel
|
||||
* * TextChannel
|
||||
* * NewsChannel
|
||||
* * ThreadChannel
|
||||
* @typedef {DMChannel|TextChannel|NewsChannel|ThreadChannel} TextBasedChannels
|
||||
*/
|
||||
|
||||
/**
|
||||
* The types of channels that are text-based. The available types are:
|
||||
* * DM
|
||||
|
||||
Reference in New Issue
Block a user