mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
feat(StageChannel): v13 support messages (#9145)
Co-authored-by: kyranet <kyradiscord@gmail.com>
This commit is contained in:
@@ -10,7 +10,8 @@ class WebhooksUpdate extends Action {
|
|||||||
/**
|
/**
|
||||||
* Emitted whenever a channel has its webhooks changed.
|
* Emitted whenever a channel has its webhooks changed.
|
||||||
* @event Client#webhookUpdate
|
* @event Client#webhookUpdate
|
||||||
* @param {TextChannel|NewsChannel|VoiceChannel|ForumChannel} channel The channel that had a webhook update
|
* @param {TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel} channel
|
||||||
|
* The channel that had a webhook update
|
||||||
*/
|
*/
|
||||||
if (channel) client.emit(Events.WEBHOOKS_UPDATE, channel);
|
if (channel) client.emit(Events.WEBHOOKS_UPDATE, channel);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,24 +2,37 @@
|
|||||||
|
|
||||||
const { Collection } = require('@discordjs/collection');
|
const { Collection } = require('@discordjs/collection');
|
||||||
const GuildChannel = require('./GuildChannel');
|
const GuildChannel = require('./GuildChannel');
|
||||||
|
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
||||||
|
const MessageManager = require('../managers/MessageManager');
|
||||||
|
const { VideoQualityModes } = require('../util/Constants');
|
||||||
const Permissions = require('../util/Permissions');
|
const Permissions = require('../util/Permissions');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a voice-based guild channel on Discord.
|
* Represents a voice-based guild channel on Discord.
|
||||||
* @extends {GuildChannel}
|
* @extends {GuildChannel}
|
||||||
|
* @implements {TextBasedChannel}
|
||||||
*/
|
*/
|
||||||
class BaseGuildVoiceChannel extends GuildChannel {
|
class BaseGuildVoiceChannel extends GuildChannel {
|
||||||
|
constructor(guild, data, client) {
|
||||||
|
super(guild, data, client, false);
|
||||||
|
/**
|
||||||
|
* A manager of the messages sent to this channel
|
||||||
|
* @type {MessageManager}
|
||||||
|
*/
|
||||||
|
this.messages = new MessageManager(this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the guild considers this channel NSFW
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
this.nsfw = Boolean(data.nsfw);
|
||||||
|
|
||||||
|
this._patch(data);
|
||||||
|
}
|
||||||
|
|
||||||
_patch(data) {
|
_patch(data) {
|
||||||
super._patch(data);
|
super._patch(data);
|
||||||
|
|
||||||
if ('rtc_region' in data) {
|
|
||||||
/**
|
|
||||||
* The RTC region for this voice-based channel. This region is automatically selected if `null`.
|
|
||||||
* @type {?string}
|
|
||||||
*/
|
|
||||||
this.rtcRegion = data.rtc_region;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('bitrate' in data) {
|
if ('bitrate' in data) {
|
||||||
/**
|
/**
|
||||||
* The bitrate of this voice-based channel
|
* The bitrate of this voice-based channel
|
||||||
@@ -28,6 +41,14 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|||||||
this.bitrate = data.bitrate;
|
this.bitrate = data.bitrate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('rtc_region' in data) {
|
||||||
|
/**
|
||||||
|
* The RTC region for this voice-based channel. This region is automatically selected if `null`.
|
||||||
|
* @type {?string}
|
||||||
|
*/
|
||||||
|
this.rtcRegion = data.rtc_region;
|
||||||
|
}
|
||||||
|
|
||||||
if ('user_limit' in data) {
|
if ('user_limit' in data) {
|
||||||
/**
|
/**
|
||||||
* The maximum amount of users allowed in this channel.
|
* The maximum amount of users allowed in this channel.
|
||||||
@@ -35,6 +56,40 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|||||||
*/
|
*/
|
||||||
this.userLimit = data.user_limit;
|
this.userLimit = data.user_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('video_quality_mode' in data) {
|
||||||
|
/**
|
||||||
|
* The camera video quality mode of the channel.
|
||||||
|
* @type {?VideoQualityMode}
|
||||||
|
*/
|
||||||
|
this.videoQualityMode = VideoQualityModes[data.video_quality_mode];
|
||||||
|
} else {
|
||||||
|
this.videoQualityMode ??= null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('last_message_id' in data) {
|
||||||
|
/**
|
||||||
|
* The last message id sent in the channel, if one was sent
|
||||||
|
* @type {?Snowflake}
|
||||||
|
*/
|
||||||
|
this.lastMessageId = data.last_message_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('messages' in data) {
|
||||||
|
for (const message of data.messages) this.messages._add(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('rate_limit_per_user' in data) {
|
||||||
|
/**
|
||||||
|
* The rate limit per user (slowmode) for this channel in seconds
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
this.rateLimitPerUser = data.rate_limit_per_user;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('nsfw' in data) {
|
||||||
|
this.nsfw = data.nsfw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,22 +135,6 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the RTC region of the channel.
|
|
||||||
* @param {?string} rtcRegion The new region of the channel. Set to `null` to remove a specific region for the channel
|
|
||||||
* @param {string} [reason] The reason for modifying this region.
|
|
||||||
* @returns {Promise<BaseGuildVoiceChannel>}
|
|
||||||
* @example
|
|
||||||
* // Set the RTC region to sydney
|
|
||||||
* channel.setRTCRegion('sydney');
|
|
||||||
* @example
|
|
||||||
* // Remove a fixed region for this channel - let Discord decide automatically
|
|
||||||
* channel.setRTCRegion(null, 'We want to let Discord decide.');
|
|
||||||
*/
|
|
||||||
setRTCRegion(rtcRegion, reason) {
|
|
||||||
return this.edit({ rtcRegion }, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an invite to this guild channel.
|
* Creates an invite to this guild channel.
|
||||||
* @param {CreateInviteOptions} [options={}] The options for creating the invite
|
* @param {CreateInviteOptions} [options={}] The options for creating the invite
|
||||||
@@ -119,6 +158,79 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|||||||
fetchInvites(cache = true) {
|
fetchInvites(cache = true) {
|
||||||
return this.guild.invites.fetch({ channelId: this.id, cache });
|
return this.guild.invites.fetch({ channelId: this.id, cache });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the bitrate of the channel.
|
||||||
|
* @param {number} bitrate The new bitrate
|
||||||
|
* @param {string} [reason] Reason for changing the channel's bitrate
|
||||||
|
* @returns {Promise<BaseGuildVoiceChannel>}
|
||||||
|
* @example
|
||||||
|
* // Set the bitrate of a voice channel
|
||||||
|
* channel.setBitrate(48_000)
|
||||||
|
* .then(channel => console.log(`Set bitrate to ${channel.bitrate}bps for ${channel.name}`))
|
||||||
|
* .catch(console.error);
|
||||||
|
*/
|
||||||
|
setBitrate(bitrate, reason) {
|
||||||
|
return this.edit({ bitrate }, reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the RTC region of the channel.
|
||||||
|
* @param {?string} rtcRegion The new region of the channel. Set to `null` to remove a specific region for the channel
|
||||||
|
* @param {string} [reason] The reason for modifying this region.
|
||||||
|
* @returns {Promise<BaseGuildVoiceChannel>}
|
||||||
|
* @example
|
||||||
|
* // Set the RTC region to sydney
|
||||||
|
* channel.setRTCRegion('sydney');
|
||||||
|
* @example
|
||||||
|
* // Remove a fixed region for this channel - let Discord decide automatically
|
||||||
|
* channel.setRTCRegion(null, 'We want to let Discord decide.');
|
||||||
|
*/
|
||||||
|
setRTCRegion(rtcRegion, reason) {
|
||||||
|
return this.edit({ rtcRegion }, reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the user limit of the channel.
|
||||||
|
* @param {number} userLimit The new user limit
|
||||||
|
* @param {string} [reason] Reason for changing the user limit
|
||||||
|
* @returns {Promise<BaseGuildVoiceChannel>}
|
||||||
|
* @example
|
||||||
|
* // Set the user limit of a voice channel
|
||||||
|
* channel.setUserLimit(42)
|
||||||
|
* .then(channel => console.log(`Set user limit to ${channel.userLimit} for ${channel.name}`))
|
||||||
|
* .catch(console.error);
|
||||||
|
*/
|
||||||
|
setUserLimit(userLimit, reason) {
|
||||||
|
return this.edit({ userLimit }, reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the camera video quality mode of the channel.
|
||||||
|
* @param {VideoQualityMode|number} videoQualityMode The new camera video quality mode.
|
||||||
|
* @param {string} [reason] Reason for changing the camera video quality mode.
|
||||||
|
* @returns {Promise<BaseGuildVoiceChannel>}
|
||||||
|
*/
|
||||||
|
setVideoQualityMode(videoQualityMode, reason) {
|
||||||
|
return this.edit({ videoQualityMode }, reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
||||||
|
/* eslint-disable no-empty-function */
|
||||||
|
get lastMessage() {}
|
||||||
|
send() {}
|
||||||
|
sendTyping() {}
|
||||||
|
createMessageCollector() {}
|
||||||
|
awaitMessages() {}
|
||||||
|
createMessageComponentCollector() {}
|
||||||
|
awaitMessageComponent() {}
|
||||||
|
bulkDelete() {}
|
||||||
|
fetchWebhooks() {}
|
||||||
|
createWebhook() {}
|
||||||
|
setRateLimitPerUser() {}
|
||||||
|
setNSFW() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextBasedChannel.applyToClass(BaseGuildVoiceChannel, true, ['lastPinAt']);
|
||||||
|
|
||||||
module.exports = BaseGuildVoiceChannel;
|
module.exports = BaseGuildVoiceChannel;
|
||||||
|
|||||||
@@ -52,6 +52,19 @@ class StageChannel extends BaseGuildVoiceChannel {
|
|||||||
return this.edit({ topic }, reason);
|
return this.edit({ topic }, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the bitrate of the channel.
|
||||||
|
* @name StageChannel#setBitrate
|
||||||
|
* @param {number} bitrate The new bitrate
|
||||||
|
* @param {string} [reason] Reason for changing the channel's bitrate
|
||||||
|
* @returns {Promise<StageChannel>}
|
||||||
|
* @example
|
||||||
|
* // Set the bitrate of a voice channel
|
||||||
|
* stageChannel.setBitrate(48_000)
|
||||||
|
* .then(channel => console.log(`Set bitrate to ${channel.bitrate}bps for ${channel.name}`))
|
||||||
|
* .catch(console.error);
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the RTC region of the channel.
|
* Sets the RTC region of the channel.
|
||||||
* @name StageChannel#setRTCRegion
|
* @name StageChannel#setRTCRegion
|
||||||
@@ -65,6 +78,27 @@ class StageChannel extends BaseGuildVoiceChannel {
|
|||||||
* // Remove a fixed region for this channel - let Discord decide automatically
|
* // Remove a fixed region for this channel - let Discord decide automatically
|
||||||
* stageChannel.setRTCRegion(null, 'We want to let Discord decide.');
|
* stageChannel.setRTCRegion(null, 'We want to let Discord decide.');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the user limit of the channel.
|
||||||
|
* @name StageChannel#setUserLimit
|
||||||
|
* @param {number} userLimit The new user limit
|
||||||
|
* @param {string} [reason] Reason for changing the user limit
|
||||||
|
* @returns {Promise<StageChannel>}
|
||||||
|
* @example
|
||||||
|
* // Set the user limit of a voice channel
|
||||||
|
* stageChannel.setUserLimit(42)
|
||||||
|
* .then(channel => console.log(`Set user limit to ${channel.userLimit} for ${channel.name}`))
|
||||||
|
* .catch(console.error);
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the camera video quality mode of the channel.
|
||||||
|
* @name StageChannel#setVideoQualityMode
|
||||||
|
* @param {VideoQualityMode|number} videoQualityMode The new camera video quality mode.
|
||||||
|
* @param {string} [reason] Reason for changing the camera video quality mode.
|
||||||
|
* @returns {Promise<StageChannel>}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = StageChannel;
|
module.exports = StageChannel;
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
const process = require('node:process');
|
const process = require('node:process');
|
||||||
const BaseGuildVoiceChannel = require('./BaseGuildVoiceChannel');
|
const BaseGuildVoiceChannel = require('./BaseGuildVoiceChannel');
|
||||||
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
|
||||||
const MessageManager = require('../managers/MessageManager');
|
|
||||||
const { VideoQualityModes } = require('../util/Constants');
|
|
||||||
const Permissions = require('../util/Permissions');
|
const Permissions = require('../util/Permissions');
|
||||||
|
|
||||||
let deprecationEmittedForEditable = false;
|
let deprecationEmittedForEditable = false;
|
||||||
@@ -12,65 +9,8 @@ let deprecationEmittedForEditable = false;
|
|||||||
/**
|
/**
|
||||||
* Represents a guild voice channel on Discord.
|
* Represents a guild voice channel on Discord.
|
||||||
* @extends {BaseGuildVoiceChannel}
|
* @extends {BaseGuildVoiceChannel}
|
||||||
* @implements {TextBasedChannel}
|
|
||||||
*/
|
*/
|
||||||
class VoiceChannel extends BaseGuildVoiceChannel {
|
class VoiceChannel extends BaseGuildVoiceChannel {
|
||||||
constructor(guild, data, client) {
|
|
||||||
super(guild, data, client, false);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A manager of the messages sent to this channel
|
|
||||||
* @type {MessageManager}
|
|
||||||
*/
|
|
||||||
this.messages = new MessageManager(this);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the guild considers this channel NSFW
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
this.nsfw = Boolean(data.nsfw);
|
|
||||||
|
|
||||||
this._patch(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
_patch(data) {
|
|
||||||
super._patch(data);
|
|
||||||
|
|
||||||
if ('video_quality_mode' in data) {
|
|
||||||
/**
|
|
||||||
* The camera video quality mode of the channel.
|
|
||||||
* @type {?VideoQualityMode}
|
|
||||||
*/
|
|
||||||
this.videoQualityMode = VideoQualityModes[data.video_quality_mode];
|
|
||||||
} else {
|
|
||||||
this.videoQualityMode ??= null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('last_message_id' in data) {
|
|
||||||
/**
|
|
||||||
* The last message id sent in the channel, if one was sent
|
|
||||||
* @type {?Snowflake}
|
|
||||||
*/
|
|
||||||
this.lastMessageId = data.last_message_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('messages' in data) {
|
|
||||||
for (const message of data.messages) this.messages._add(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('rate_limit_per_user' in data) {
|
|
||||||
/**
|
|
||||||
* The rate limit per user (slowmode) for this channel in seconds
|
|
||||||
* @type {number}
|
|
||||||
*/
|
|
||||||
this.rateLimitPerUser = data.rate_limit_per_user;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('nsfw' in data) {
|
|
||||||
this.nsfw = data.nsfw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the channel is editable by the client user
|
* Whether the channel is editable by the client user
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
@@ -120,58 +60,16 @@ class VoiceChannel extends BaseGuildVoiceChannel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the bitrate of the channel.
|
* Sets the bitrate of the channel.
|
||||||
|
* @name VoiceChannel#setBitrate
|
||||||
* @param {number} bitrate The new bitrate
|
* @param {number} bitrate The new bitrate
|
||||||
* @param {string} [reason] Reason for changing the channel's bitrate
|
* @param {string} [reason] Reason for changing the channel's bitrate
|
||||||
* @returns {Promise<VoiceChannel>}
|
* @returns {Promise<VoiceChannel>}
|
||||||
* @example
|
* @example
|
||||||
* // Set the bitrate of a voice channel
|
* // Set the bitrate of a voice channel
|
||||||
* voiceChannel.setBitrate(48_000)
|
* voiceChannel.setBitrate(48_000)
|
||||||
* .then(vc => console.log(`Set bitrate to ${vc.bitrate}bps for ${vc.name}`))
|
* .then(channel => console.log(`Set bitrate to ${channel.bitrate}bps for ${channel.name}`))
|
||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
setBitrate(bitrate, reason) {
|
|
||||||
return this.edit({ bitrate }, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the user limit of the channel.
|
|
||||||
* @param {number} userLimit The new user limit
|
|
||||||
* @param {string} [reason] Reason for changing the user limit
|
|
||||||
* @returns {Promise<VoiceChannel>}
|
|
||||||
* @example
|
|
||||||
* // Set the user limit of a voice channel
|
|
||||||
* voiceChannel.setUserLimit(42)
|
|
||||||
* .then(vc => console.log(`Set user limit to ${vc.userLimit} for ${vc.name}`))
|
|
||||||
* .catch(console.error);
|
|
||||||
*/
|
|
||||||
setUserLimit(userLimit, reason) {
|
|
||||||
return this.edit({ userLimit }, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the camera video quality mode of the channel.
|
|
||||||
* @param {VideoQualityMode|number} videoQualityMode The new camera video quality mode.
|
|
||||||
* @param {string} [reason] Reason for changing the camera video quality mode.
|
|
||||||
* @returns {Promise<VoiceChannel>}
|
|
||||||
*/
|
|
||||||
setVideoQualityMode(videoQualityMode, reason) {
|
|
||||||
return this.edit({ videoQualityMode }, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
|
||||||
/* eslint-disable no-empty-function */
|
|
||||||
get lastMessage() {}
|
|
||||||
send() {}
|
|
||||||
sendTyping() {}
|
|
||||||
createMessageCollector() {}
|
|
||||||
awaitMessages() {}
|
|
||||||
createMessageComponentCollector() {}
|
|
||||||
awaitMessageComponent() {}
|
|
||||||
bulkDelete() {}
|
|
||||||
fetchWebhooks() {}
|
|
||||||
createWebhook() {}
|
|
||||||
setRateLimitPerUser() {}
|
|
||||||
setNSFW() {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the RTC region of the channel.
|
* Sets the RTC region of the channel.
|
||||||
@@ -186,8 +84,27 @@ class VoiceChannel extends BaseGuildVoiceChannel {
|
|||||||
* // Remove a fixed region for this channel - let Discord decide automatically
|
* // Remove a fixed region for this channel - let Discord decide automatically
|
||||||
* voiceChannel.setRTCRegion(null, 'We want to let Discord decide.');
|
* voiceChannel.setRTCRegion(null, 'We want to let Discord decide.');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the user limit of the channel.
|
||||||
|
* @name VoiceChannel#setUserLimit
|
||||||
|
* @param {number} userLimit The new user limit
|
||||||
|
* @param {string} [reason] Reason for changing the user limit
|
||||||
|
* @returns {Promise<VoiceChannel>}
|
||||||
|
* @example
|
||||||
|
* // Set the user limit of a voice channel
|
||||||
|
* voiceChannel.setUserLimit(42)
|
||||||
|
* .then(channel => console.log(`Set user limit to ${channel.userLimit} for ${channel.name}`))
|
||||||
|
* .catch(console.error);
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the camera video quality mode of the channel.
|
||||||
|
* @name VoiceChannel#setVideoQualityMode
|
||||||
|
* @param {VideoQualityMode|number} videoQualityMode The new camera video quality mode.
|
||||||
|
* @param {string} [reason] Reason for changing the camera video quality mode.
|
||||||
|
* @returns {Promise<VoiceChannel>}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
TextBasedChannel.applyToClass(VoiceChannel, true, ['lastPinAt']);
|
|
||||||
|
|
||||||
module.exports = VoiceChannel;
|
module.exports = VoiceChannel;
|
||||||
|
|||||||
@@ -237,7 +237,8 @@ class Webhook {
|
|||||||
* @typedef {Object} WebhookEditData
|
* @typedef {Object} WebhookEditData
|
||||||
* @property {string} [name=this.name] The new name for the webhook
|
* @property {string} [name=this.name] The new name for the webhook
|
||||||
* @property {?(BufferResolvable)} [avatar] The new avatar for the webhook
|
* @property {?(BufferResolvable)} [avatar] The new avatar for the webhook
|
||||||
* @property {GuildTextChannelResolvable} [channel] The new channel for the webhook
|
* @property {GuildTextChannelResolvable|VoiceChannel|StageChannel|ForumChannel} [channel]
|
||||||
|
* The new channel for the webhook
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -712,7 +712,8 @@ exports.ChannelTypes = createEnum([
|
|||||||
* * NewsChannel
|
* * NewsChannel
|
||||||
* * ThreadChannel
|
* * ThreadChannel
|
||||||
* * VoiceChannel
|
* * VoiceChannel
|
||||||
* @typedef {DMChannel|TextChannel|NewsChannel|ThreadChannel|VoiceChannel} TextBasedChannels
|
* * StageChannel
|
||||||
|
* @typedef {DMChannel|TextChannel|NewsChannel|ThreadChannel|VoiceChannel|StageChannel} TextBasedChannels
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -731,6 +732,7 @@ exports.ChannelTypes = createEnum([
|
|||||||
* * GUILD_PUBLIC_THREAD
|
* * GUILD_PUBLIC_THREAD
|
||||||
* * GUILD_PRIVATE_THREAD
|
* * GUILD_PRIVATE_THREAD
|
||||||
* * GUILD_VOICE
|
* * GUILD_VOICE
|
||||||
|
* * GUILD_STAGE_VOICE
|
||||||
* @typedef {string} TextBasedChannelTypes
|
* @typedef {string} TextBasedChannelTypes
|
||||||
*/
|
*/
|
||||||
exports.TextBasedChannelTypes = [
|
exports.TextBasedChannelTypes = [
|
||||||
@@ -741,6 +743,7 @@ exports.TextBasedChannelTypes = [
|
|||||||
'GUILD_PUBLIC_THREAD',
|
'GUILD_PUBLIC_THREAD',
|
||||||
'GUILD_PRIVATE_THREAD',
|
'GUILD_PRIVATE_THREAD',
|
||||||
'GUILD_VOICE',
|
'GUILD_VOICE',
|
||||||
|
'GUILD_STAGE_VOICE',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
26
typings/index.d.ts
vendored
26
typings/index.d.ts
vendored
@@ -479,17 +479,23 @@ export class BaseGuildTextChannel extends TextBasedChannelMixin(GuildChannel) {
|
|||||||
public setType(type: Pick<typeof ChannelTypes, 'GUILD_NEWS'>, reason?: string): Promise<NewsChannel>;
|
public setType(type: Pick<typeof ChannelTypes, 'GUILD_NEWS'>, reason?: string): Promise<NewsChannel>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BaseGuildVoiceChannel extends GuildChannel {
|
export class BaseGuildVoiceChannel extends TextBasedChannelMixin(GuildChannel, ['lastPinTimestamp', 'lastPinAt']) {
|
||||||
public constructor(guild: Guild, data?: RawGuildChannelData);
|
public constructor(guild: Guild, data?: RawGuildChannelData);
|
||||||
public readonly members: Collection<Snowflake, GuildMember>;
|
public readonly members: Collection<Snowflake, GuildMember>;
|
||||||
public readonly full: boolean;
|
public readonly full: boolean;
|
||||||
public readonly joinable: boolean;
|
public readonly joinable: boolean;
|
||||||
public rtcRegion: string | null;
|
|
||||||
public bitrate: number;
|
public bitrate: number;
|
||||||
|
public nsfw: boolean;
|
||||||
|
public rtcRegion: string | null;
|
||||||
|
public rateLimitPerUser: number | null;
|
||||||
public userLimit: number;
|
public userLimit: number;
|
||||||
|
public videoQualityMode: VideoQualityMode | null;
|
||||||
public createInvite(options?: CreateInviteOptions): Promise<Invite>;
|
public createInvite(options?: CreateInviteOptions): Promise<Invite>;
|
||||||
public setRTCRegion(rtcRegion: string | null, reason?: string): Promise<this>;
|
public setRTCRegion(rtcRegion: string | null, reason?: string): Promise<this>;
|
||||||
public fetchInvites(cache?: boolean): Promise<Collection<string, Invite>>;
|
public fetchInvites(cache?: boolean): Promise<Collection<string, Invite>>;
|
||||||
|
public setBitrate(bitrate: number, reason?: string): Promise<VoiceChannel>;
|
||||||
|
public setUserLimit(userLimit: number, reason?: string): Promise<VoiceChannel>;
|
||||||
|
public setVideoQualityMode(videoQualityMode: VideoQualityMode | number, reason?: string): Promise<VoiceChannel>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BaseMessageComponent {
|
export class BaseMessageComponent {
|
||||||
@@ -2321,9 +2327,9 @@ export class SnowflakeUtil extends null {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class StageChannel extends BaseGuildVoiceChannel {
|
export class StageChannel extends BaseGuildVoiceChannel {
|
||||||
|
public readonly stageInstance: StageInstance | null;
|
||||||
public topic: string | null;
|
public topic: string | null;
|
||||||
public type: 'GUILD_STAGE_VOICE';
|
public type: 'GUILD_STAGE_VOICE';
|
||||||
public readonly stageInstance: StageInstance | null;
|
|
||||||
public createStageInstance(options: StageInstanceCreateOptions): Promise<StageInstance>;
|
public createStageInstance(options: StageInstanceCreateOptions): Promise<StageInstance>;
|
||||||
public setTopic(topic: string): Promise<StageChannel>;
|
public setTopic(topic: string): Promise<StageChannel>;
|
||||||
}
|
}
|
||||||
@@ -2799,17 +2805,11 @@ export class Formatters extends null {
|
|||||||
public static userMention: typeof userMention;
|
public static userMention: typeof userMention;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class VoiceChannel extends TextBasedChannelMixin(BaseGuildVoiceChannel, ['lastPinTimestamp', 'lastPinAt']) {
|
export class VoiceChannel extends BaseGuildVoiceChannel {
|
||||||
public videoQualityMode: VideoQualityMode | null;
|
|
||||||
/** @deprecated Use manageable instead */
|
/** @deprecated Use manageable instead */
|
||||||
public readonly editable: boolean;
|
public readonly editable: boolean;
|
||||||
public readonly speakable: boolean;
|
public readonly speakable: boolean;
|
||||||
public type: 'GUILD_VOICE';
|
public type: 'GUILD_VOICE';
|
||||||
public nsfw: boolean;
|
|
||||||
public rateLimitPerUser: number | null;
|
|
||||||
public setBitrate(bitrate: number, reason?: string): Promise<VoiceChannel>;
|
|
||||||
public setUserLimit(userLimit: number, reason?: string): Promise<VoiceChannel>;
|
|
||||||
public setVideoQualityMode(videoQualityMode: VideoQualityMode | number, reason?: string): Promise<VoiceChannel>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class VoiceRegion {
|
export class VoiceRegion {
|
||||||
@@ -3365,7 +3365,7 @@ export class GuildChannelManager extends CachedManager<Snowflake, GuildBasedChan
|
|||||||
public createWebhook(
|
public createWebhook(
|
||||||
channel: GuildChannelResolvable,
|
channel: GuildChannelResolvable,
|
||||||
name: string,
|
name: string,
|
||||||
options?: TextChannel | NewsChannel | VoiceChannel | Snowflake,
|
options?: TextChannel | NewsChannel | VoiceChannel | StageChannel | ForumChannel | Snowflake,
|
||||||
): Promise<Webhook>;
|
): Promise<Webhook>;
|
||||||
public addFollower(
|
public addFollower(
|
||||||
channel: NewsChannel | Snowflake,
|
channel: NewsChannel | Snowflake,
|
||||||
@@ -4575,7 +4575,7 @@ export interface ClientEvents extends BaseClientEvents {
|
|||||||
typingStart: [typing: Typing];
|
typingStart: [typing: Typing];
|
||||||
userUpdate: [oldUser: User | PartialUser, newUser: User];
|
userUpdate: [oldUser: User | PartialUser, newUser: User];
|
||||||
voiceStateUpdate: [oldState: VoiceState, newState: VoiceState];
|
voiceStateUpdate: [oldState: VoiceState, newState: VoiceState];
|
||||||
webhookUpdate: [channel: TextChannel | NewsChannel | VoiceChannel | ForumChannel];
|
webhookUpdate: [channel: TextChannel | NewsChannel | VoiceChannel | ForumChannel | StageChannel];
|
||||||
/** @deprecated Use interactionCreate instead */
|
/** @deprecated Use interactionCreate instead */
|
||||||
interaction: [interaction: Interaction];
|
interaction: [interaction: Interaction];
|
||||||
interactionCreate: [interaction: Interaction];
|
interactionCreate: [interaction: Interaction];
|
||||||
@@ -6437,7 +6437,7 @@ export type WebhookClientOptions = Pick<
|
|||||||
export interface WebhookEditData {
|
export interface WebhookEditData {
|
||||||
name?: string;
|
name?: string;
|
||||||
avatar?: BufferResolvable | null;
|
avatar?: BufferResolvable | null;
|
||||||
channel?: GuildTextChannelResolvable;
|
channel?: GuildTextChannelResolvable | VoiceChannel | StageChannel | ForumChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type WebhookEditMessageOptions = Pick<
|
export type WebhookEditMessageOptions = Pick<
|
||||||
|
|||||||
@@ -1323,7 +1323,7 @@ declare const GuildBasedChannel: GuildBasedChannel;
|
|||||||
declare const NonThreadGuildBasedChannel: NonThreadGuildBasedChannel;
|
declare const NonThreadGuildBasedChannel: NonThreadGuildBasedChannel;
|
||||||
declare const GuildTextBasedChannel: GuildTextBasedChannel;
|
declare const GuildTextBasedChannel: GuildTextBasedChannel;
|
||||||
|
|
||||||
expectType<DMChannel | PartialDMChannel | NewsChannel | TextChannel | ThreadChannel | VoiceChannel>(TextBasedChannel);
|
expectType<DMChannel | PartialDMChannel | NewsChannel | TextChannel | ThreadChannel | VoiceChannel | StageChannel>(TextBasedChannel);
|
||||||
expectType<
|
expectType<
|
||||||
| 'DM'
|
| 'DM'
|
||||||
| 'GUILD_NEWS'
|
| 'GUILD_NEWS'
|
||||||
@@ -1332,6 +1332,7 @@ expectType<
|
|||||||
| 'GUILD_PRIVATE_THREAD'
|
| 'GUILD_PRIVATE_THREAD'
|
||||||
| 'GUILD_NEWS_THREAD'
|
| 'GUILD_NEWS_THREAD'
|
||||||
| 'GUILD_VOICE'
|
| 'GUILD_VOICE'
|
||||||
|
| 'GUILD_STAGE_VOICE'
|
||||||
>(TextBasedChannelTypes);
|
>(TextBasedChannelTypes);
|
||||||
expectType<StageChannel | VoiceChannel>(VoiceBasedChannel);
|
expectType<StageChannel | VoiceChannel>(VoiceBasedChannel);
|
||||||
expectType<CategoryChannel | NewsChannel | StageChannel | StoreChannel | TextChannel | ThreadChannel | VoiceChannel | ForumChannel>(
|
expectType<CategoryChannel | NewsChannel | StageChannel | StoreChannel | TextChannel | ThreadChannel | VoiceChannel | ForumChannel>(
|
||||||
@@ -1340,4 +1341,4 @@ expectType<CategoryChannel | NewsChannel | StageChannel | StoreChannel | TextCha
|
|||||||
expectType<CategoryChannel | NewsChannel | StageChannel | StoreChannel | TextChannel | VoiceChannel | ForumChannel>(
|
expectType<CategoryChannel | NewsChannel | StageChannel | StoreChannel | TextChannel | VoiceChannel | ForumChannel>(
|
||||||
NonThreadGuildBasedChannel,
|
NonThreadGuildBasedChannel,
|
||||||
);
|
);
|
||||||
expectType<NewsChannel | TextChannel | ThreadChannel | VoiceChannel>(GuildTextBasedChannel);
|
expectType<NewsChannel | TextChannel | ThreadChannel | VoiceChannel | StageChannel>(GuildTextBasedChannel);
|
||||||
|
|||||||
Reference in New Issue
Block a user