feat(StageChannel): v13 support messages

#9145 djs
This commit is contained in:
Elysia 2023-04-15 19:53:43 +07:00
parent 6ed56a153f
commit d89c46ba82
7 changed files with 222 additions and 181 deletions

View File

@ -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);
} }

View File

@ -2,24 +2,35 @@
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);
}
_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 +39,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 +54,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 = Boolean(data.nsfw);
}
} }
/** /**
@ -80,22 +133,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 +156,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<VoiceChannel>}
* @example
* // Set the bitrate of a voice channel
* voiceChannel.setBitrate(48_000)
* .then(vc => console.log(`Set bitrate to ${vc.bitrate}bps for ${vc.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<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() {}
}
TextBasedChannel.applyToClass(BaseGuildVoiceChannel, true, ['lastPinAt']);
module.exports = BaseGuildVoiceChannel; module.exports = BaseGuildVoiceChannel;

View File

@ -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;

View File

@ -2,10 +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 InteractionManager = require('../managers/InteractionManager');
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;
@ -13,71 +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);
/**
* A manager of the interactions sent to this channel
* @type {InteractionManager}
*/
this.interactions = new InteractionManager(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}
@ -127,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.
@ -193,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;

View File

@ -1,7 +1,6 @@
'use strict'; 'use strict';
const process = require('node:process'); const process = require('node:process');
const { Message } = require('./Message');
const MessagePayload = require('./MessagePayload'); const MessagePayload = require('./MessagePayload');
const { Error } = require('../errors'); const { Error } = require('../errors');
const { WebhookTypes } = require('../util/Constants'); const { WebhookTypes } = require('../util/Constants');
@ -73,7 +72,7 @@ class Webhook {
if ('channel_id' in data) { if ('channel_id' in data) {
/** /**
* The id of the channel the webhook belongs to * The channel the webhook belongs to
* @type {Snowflake} * @type {Snowflake}
*/ */
this.channelId = data.channel_id; this.channelId = data.channel_id;
@ -110,15 +109,6 @@ class Webhook {
} }
} }
/**
* The channel the webhook belongs to
* @type {?(TextChannel|VoiceChannel|NewsChannel|ForumChannel)}
* @readonly
*/
get channel() {
return this.client.channels.resolve(this.channelId);
}
/** /**
* Options that can be passed into send. * Options that can be passed into send.
* @typedef {BaseMessageOptions} WebhookMessageOptions * @typedef {BaseMessageOptions} WebhookMessageOptions
@ -126,7 +116,6 @@ class Webhook {
* @property {string} [avatarURL] Avatar URL override for the message * @property {string} [avatarURL] Avatar URL override for the message
* @property {Snowflake} [threadId] The id of the thread in the channel to send to. * @property {Snowflake} [threadId] The id of the thread in the channel to send to.
* <info>For interaction webhooks, this property is ignored</info> * <info>For interaction webhooks, this property is ignored</info>
* @property {string} [threadName] Name of the thread to create (only available if webhook is in a forum channel)
* @property {MessageFlags} [flags] Which flags to set for the message. Only `SUPPRESS_EMBEDS` can be set. * @property {MessageFlags} [flags] Which flags to set for the message. Only `SUPPRESS_EMBEDS` can be set.
*/ */
@ -142,6 +131,7 @@ class Webhook {
* Action rows containing interactive components for the message (buttons, select menus) * Action rows containing interactive components for the message (buttons, select menus)
* @property {Snowflake} [threadId] The id of the thread this message belongs to * @property {Snowflake} [threadId] The id of the thread this message belongs to
* <info>For interaction webhooks, this property is ignored</info> * <info>For interaction webhooks, this property is ignored</info>
* @property {string} [threadName] Name of the thread to create (only available if webhook is in a forum channel)
*/ */
/** /**
@ -198,9 +188,9 @@ class Webhook {
let messagePayload; let messagePayload;
if (options instanceof MessagePayload) { if (options instanceof MessagePayload) {
messagePayload = await options.resolveData(); messagePayload = options.resolveData();
} else { } else {
messagePayload = await MessagePayload.create(this, options).resolveData(); messagePayload = MessagePayload.create(this, options).resolveData();
} }
const { data, files } = await messagePayload.resolveFiles(); const { data, files } = await messagePayload.resolveFiles();
@ -209,8 +199,6 @@ class Webhook {
files, files,
query: { thread_id: messagePayload.options.threadId, wait: true }, query: { thread_id: messagePayload.options.threadId, wait: true },
auth: false, auth: false,
versioned: true,
webhook: true,
}); });
return this.client.channels?.cache.get(d.channel_id)?.messages._add(d, false) ?? d; return this.client.channels?.cache.get(d.channel_id)?.messages._add(d, false) ?? d;
} }
@ -240,7 +228,6 @@ class Webhook {
query: { wait: true }, query: { wait: true },
auth: false, auth: false,
data: body, data: body,
webhook: true,
}); });
return data.toString() === 'ok'; return data.toString() === 'ok';
} }
@ -250,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
*/ */
/** /**
@ -268,7 +256,6 @@ class Webhook {
data: { name, avatar, channel_id: channel }, data: { name, avatar, channel_id: channel },
reason, reason,
auth: !this.token || Boolean(channel), auth: !this.token || Boolean(channel),
webhook: true,
}); });
this.name = data.name; this.name = data.name;
@ -317,7 +304,6 @@ class Webhook {
thread_id: cacheOrOptions.threadId, thread_id: cacheOrOptions.threadId,
}, },
auth: false, auth: false,
webhook: true,
}); });
return this.client.channels?.cache.get(data.channel_id)?.messages._add(data, cacheOrOptions.cache) ?? data; return this.client.channels?.cache.get(data.channel_id)?.messages._add(data, cacheOrOptions.cache) ?? data;
} }
@ -333,12 +319,11 @@ class Webhook {
if (!this.token) throw new Error('WEBHOOK_TOKEN_UNAVAILABLE'); if (!this.token) throw new Error('WEBHOOK_TOKEN_UNAVAILABLE');
let messagePayload; let messagePayload;
if (options instanceof MessagePayload) {
messagePayload = await options.resolveData(); if (options instanceof MessagePayload) messagePayload = options;
} else { else messagePayload = MessagePayload.create(this, options);
messagePayload = await MessagePayload.create(message instanceof Message ? message : this, options).resolveData();
} const { data, files } = await messagePayload.resolveData().resolveFiles();
const { data, files } = await messagePayload.resolveFiles();
const d = await this.client.api const d = await this.client.api
.webhooks(this.id, this.token) .webhooks(this.id, this.token)
@ -350,7 +335,6 @@ class Webhook {
thread_id: messagePayload.options.threadId, thread_id: messagePayload.options.threadId,
}, },
auth: false, auth: false,
webhook: true,
}); });
const messageManager = this.client.channels?.cache.get(d.channel_id)?.messages; const messageManager = this.client.channels?.cache.get(d.channel_id)?.messages;
@ -370,7 +354,7 @@ class Webhook {
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
async delete(reason) { async delete(reason) {
await this.client.api.webhooks(this.id, this.token).delete({ reason, auth: !this.token, webhook: true }); await this.client.api.webhooks(this.id, this.token).delete({ reason, auth: !this.token });
} }
/** /**
@ -390,7 +374,6 @@ class Webhook {
thread_id: threadId, thread_id: threadId,
}, },
auth: false, auth: false,
webhook: true,
}); });
} }

View File

@ -897,7 +897,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
*/ */
/** /**
@ -916,6 +917,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 = [
@ -926,6 +928,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
View File

@ -784,17 +784,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 {
@ -2910,9 +2916,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>;
} }
@ -3358,17 +3364,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 {
@ -4027,7 +4027,7 @@ export class GuildChannelManager extends CachedManager<Snowflake, GuildBasedChan
public createWebhook( public createWebhook(
channel: GuildChannelResolvable, channel: GuildChannelResolvable,
name: string, name: string,
options?: ChannelWebhookCreateOptions, options?: TextChannel | NewsChannel | VoiceChannel | StageChannel | ForumChannel | Snowflake,
): Promise<Webhook>; ): Promise<Webhook>;
public addFollower( public addFollower(
channel: NewsChannel | Snowflake, channel: NewsChannel | Snowflake,
@ -4789,7 +4789,7 @@ export interface ClientEvents extends BaseClientEvents {
userSettingsUpdate: [setting: RawUserSettingsData]; userSettingsUpdate: [setting: RawUserSettingsData];
userGuildSettingsUpdate: [guild: Guild]; userGuildSettingsUpdate: [guild: Guild];
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 | { nonce: Snowflake; id: Snowflake }]; interactionCreate: [interaction: Interaction | { nonce: Snowflake; id: Snowflake }];
@ -7419,7 +7419,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<