mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
feat: backport text-in-voice support to v13 (#7999)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
@@ -10,7 +10,7 @@ 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} channel The channel that had a webhook update
|
* @param {TextChannel|NewsChannel|VoiceChannel} channel The channel that had a webhook update
|
||||||
*/
|
*/
|
||||||
if (channel) client.emit(Events.WEBHOOKS_UPDATE, channel);
|
if (channel) client.emit(Events.WEBHOOKS_UPDATE, channel);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,16 +89,6 @@ class BaseGuildTextChannel extends GuildChannel {
|
|||||||
return this.edit({ defaultAutoArchiveDuration }, reason);
|
return this.edit({ defaultAutoArchiveDuration }, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets whether this channel is flagged as NSFW.
|
|
||||||
* @param {boolean} [nsfw=true] Whether the channel should be considered NSFW
|
|
||||||
* @param {string} [reason] Reason for changing the channel's NSFW flag
|
|
||||||
* @returns {Promise<TextChannel>}
|
|
||||||
*/
|
|
||||||
setNSFW(nsfw = true, reason) {
|
|
||||||
return this.edit({ nsfw }, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the type of this channel (only conversion between text and news is supported)
|
* Sets the type of this channel (only conversion between text and news is supported)
|
||||||
* @param {string} type The new channel type
|
* @param {string} type The new channel type
|
||||||
@@ -109,44 +99,6 @@ class BaseGuildTextChannel extends GuildChannel {
|
|||||||
return this.edit({ type }, reason);
|
return this.edit({ type }, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetches all webhooks for the channel.
|
|
||||||
* @returns {Promise<Collection<Snowflake, Webhook>>}
|
|
||||||
* @example
|
|
||||||
* // Fetch webhooks
|
|
||||||
* channel.fetchWebhooks()
|
|
||||||
* .then(hooks => console.log(`This channel has ${hooks.size} hooks`))
|
|
||||||
* .catch(console.error);
|
|
||||||
*/
|
|
||||||
fetchWebhooks() {
|
|
||||||
return this.guild.channels.fetchWebhooks(this.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Options used to create a {@link Webhook} in a {@link TextChannel} or a {@link NewsChannel}.
|
|
||||||
* @typedef {Object} ChannelWebhookCreateOptions
|
|
||||||
* @property {?(BufferResolvable|Base64Resolvable)} [avatar] Avatar for the webhook
|
|
||||||
* @property {string} [reason] Reason for creating the webhook
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a webhook for the channel.
|
|
||||||
* @param {string} name The name of the webhook
|
|
||||||
* @param {ChannelWebhookCreateOptions} [options] Options for creating the webhook
|
|
||||||
* @returns {Promise<Webhook>} Returns the created Webhook
|
|
||||||
* @example
|
|
||||||
* // Create a webhook for the current channel
|
|
||||||
* channel.createWebhook('Snek', {
|
|
||||||
* avatar: 'https://i.imgur.com/mI8XcpG.jpg',
|
|
||||||
* reason: 'Needed a cool new Webhook'
|
|
||||||
* })
|
|
||||||
* .then(console.log)
|
|
||||||
* .catch(console.error)
|
|
||||||
*/
|
|
||||||
createWebhook(name, options = {}) {
|
|
||||||
return this.guild.channels.createWebhook(this.id, name, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a new topic for the guild channel.
|
* Sets a new topic for the guild channel.
|
||||||
* @param {?string} topic The new topic for the guild channel
|
* @param {?string} topic The new topic for the guild channel
|
||||||
@@ -221,6 +173,10 @@ class BaseGuildTextChannel extends GuildChannel {
|
|||||||
createMessageComponentCollector() {}
|
createMessageComponentCollector() {}
|
||||||
awaitMessageComponent() {}
|
awaitMessageComponent() {}
|
||||||
bulkDelete() {}
|
bulkDelete() {}
|
||||||
|
fetchWebhooks() {}
|
||||||
|
createWebhook() {}
|
||||||
|
setRateLimitPerUser() {}
|
||||||
|
setNSFW() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextBasedChannel.applyToClass(BaseGuildTextChannel, true);
|
TextBasedChannel.applyToClass(BaseGuildTextChannel, true);
|
||||||
|
|||||||
@@ -94,8 +94,16 @@ class DMChannel extends Channel {
|
|||||||
createMessageComponentCollector() {}
|
createMessageComponentCollector() {}
|
||||||
awaitMessageComponent() {}
|
awaitMessageComponent() {}
|
||||||
// Doesn't work on DM channels; bulkDelete() {}
|
// Doesn't work on DM channels; bulkDelete() {}
|
||||||
|
// Doesn't work on DM channels; setRateLimitPerUser() {}
|
||||||
|
// Doesn't work on DM channels; setNSFW() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextBasedChannel.applyToClass(DMChannel, true, ['bulkDelete']);
|
TextBasedChannel.applyToClass(DMChannel, true, [
|
||||||
|
'bulkDelete',
|
||||||
|
'fetchWebhooks',
|
||||||
|
'createWebhook',
|
||||||
|
'setRateLimitPerUser',
|
||||||
|
'setNSFW',
|
||||||
|
]);
|
||||||
|
|
||||||
module.exports = DMChannel;
|
module.exports = DMChannel;
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ class Message extends Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The channel that the message was sent in
|
* The channel that the message was sent in
|
||||||
* @type {TextChannel|DMChannel|NewsChannel|ThreadChannel}
|
* @type {TextBasedChannel}
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get channel() {
|
get channel() {
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ module.exports = MessagePayload;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A target for a message.
|
* A target for a message.
|
||||||
* @typedef {TextChannel|DMChannel|User|GuildMember|Webhook|WebhookClient|Interaction|InteractionWebhook|
|
* @typedef {TextBasedChannel|User|GuildMember|Webhook|WebhookClient|Interaction|InteractionWebhook|
|
||||||
* Message|MessageManager} MessageTarget
|
* Message|MessageManager} MessageTarget
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -545,8 +545,10 @@ class ThreadChannel extends Channel {
|
|||||||
createMessageComponentCollector() {}
|
createMessageComponentCollector() {}
|
||||||
awaitMessageComponent() {}
|
awaitMessageComponent() {}
|
||||||
bulkDelete() {}
|
bulkDelete() {}
|
||||||
|
// Doesn't work on Thread channels; setRateLimitPerUser() {}
|
||||||
|
// Doesn't work on Thread channels; setNSFW() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextBasedChannel.applyToClass(ThreadChannel, true);
|
TextBasedChannel.applyToClass(ThreadChannel, true, ['setRateLimitPerUser', 'setNSFW']);
|
||||||
|
|
||||||
module.exports = ThreadChannel;
|
module.exports = ThreadChannel;
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
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 { VideoQualityModes } = require('../util/Constants');
|
||||||
const Permissions = require('../util/Permissions');
|
const Permissions = require('../util/Permissions');
|
||||||
|
|
||||||
@@ -10,8 +12,21 @@ 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);
|
||||||
|
|
||||||
|
this._patch(data);
|
||||||
|
}
|
||||||
|
|
||||||
_patch(data) {
|
_patch(data) {
|
||||||
super._patch(data);
|
super._patch(data);
|
||||||
|
|
||||||
@@ -24,6 +39,26 @@ class VoiceChannel extends BaseGuildVoiceChannel {
|
|||||||
} else {
|
} else {
|
||||||
this.videoQualityMode ??= null;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -112,6 +147,21 @@ class VoiceChannel extends BaseGuildVoiceChannel {
|
|||||||
return this.edit({ 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.
|
||||||
* @name VoiceChannel#setRTCRegion
|
* @name VoiceChannel#setRTCRegion
|
||||||
@@ -127,4 +177,6 @@ class VoiceChannel extends BaseGuildVoiceChannel {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextBasedChannel.applyToClass(VoiceChannel, true, ['lastPinAt']);
|
||||||
|
|
||||||
module.exports = VoiceChannel;
|
module.exports = VoiceChannel;
|
||||||
|
|||||||
@@ -330,6 +330,64 @@ class TextBasedChannel {
|
|||||||
throw new TypeError('MESSAGE_BULK_DELETE_TYPE');
|
throw new TypeError('MESSAGE_BULK_DELETE_TYPE');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches all webhooks for the channel.
|
||||||
|
* @returns {Promise<Collection<Snowflake, Webhook>>}
|
||||||
|
* @example
|
||||||
|
* // Fetch webhooks
|
||||||
|
* channel.fetchWebhooks()
|
||||||
|
* .then(hooks => console.log(`This channel has ${hooks.size} hooks`))
|
||||||
|
* .catch(console.error);
|
||||||
|
*/
|
||||||
|
fetchWebhooks() {
|
||||||
|
return this.guild.channels.fetchWebhooks(this.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options used to create a {@link Webhook} in a guild text-based channel.
|
||||||
|
* @typedef {Object} ChannelWebhookCreateOptions
|
||||||
|
* @property {?(BufferResolvable|Base64Resolvable)} [avatar] Avatar for the webhook
|
||||||
|
* @property {string} [reason] Reason for creating the webhook
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a webhook for the channel.
|
||||||
|
* @param {string} name The name of the webhook
|
||||||
|
* @param {ChannelWebhookCreateOptions} [options] Options for creating the webhook
|
||||||
|
* @returns {Promise<Webhook>} Returns the created Webhook
|
||||||
|
* @example
|
||||||
|
* // Create a webhook for the current channel
|
||||||
|
* channel.createWebhook('Snek', {
|
||||||
|
* avatar: 'https://i.imgur.com/mI8XcpG.jpg',
|
||||||
|
* reason: 'Needed a cool new Webhook'
|
||||||
|
* })
|
||||||
|
* .then(console.log)
|
||||||
|
* .catch(console.error)
|
||||||
|
*/
|
||||||
|
createWebhook(name, options = {}) {
|
||||||
|
return this.guild.channels.createWebhook(this.id, name, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the rate limit per user (slowmode) for this channel.
|
||||||
|
* @param {number} rateLimitPerUser The new rate limit in seconds
|
||||||
|
* @param {string} [reason] Reason for changing the channel's rate limit
|
||||||
|
* @returns {Promise<this>}
|
||||||
|
*/
|
||||||
|
setRateLimitPerUser(rateLimitPerUser, reason) {
|
||||||
|
return this.edit({ rateLimitPerUser }, reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether this channel is flagged as NSFW.
|
||||||
|
* @param {boolean} [nsfw=true] Whether the channel should be considered NSFW
|
||||||
|
* @param {string} [reason] Reason for changing the channel's NSFW flag
|
||||||
|
* @returns {Promise<this>}
|
||||||
|
*/
|
||||||
|
setNSFW(nsfw = true, reason) {
|
||||||
|
return this.edit({ nsfw }, reason);
|
||||||
|
}
|
||||||
|
|
||||||
static applyToClass(structure, full = false, ignore = []) {
|
static applyToClass(structure, full = false, ignore = []) {
|
||||||
const props = ['send'];
|
const props = ['send'];
|
||||||
if (full) {
|
if (full) {
|
||||||
@@ -342,6 +400,10 @@ class TextBasedChannel {
|
|||||||
'awaitMessages',
|
'awaitMessages',
|
||||||
'createMessageComponentCollector',
|
'createMessageComponentCollector',
|
||||||
'awaitMessageComponent',
|
'awaitMessageComponent',
|
||||||
|
'fetchWebhooks',
|
||||||
|
'createWebhook',
|
||||||
|
'setRateLimitPerUser',
|
||||||
|
'setNSFW',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
for (const prop of props) {
|
for (const prop of props) {
|
||||||
|
|||||||
@@ -558,7 +558,8 @@ exports.ChannelTypes = createEnum([
|
|||||||
* * TextChannel
|
* * TextChannel
|
||||||
* * NewsChannel
|
* * NewsChannel
|
||||||
* * ThreadChannel
|
* * ThreadChannel
|
||||||
* @typedef {DMChannel|TextChannel|NewsChannel|ThreadChannel} TextBasedChannels
|
* * VoiceChannel
|
||||||
|
* @typedef {DMChannel|TextChannel|NewsChannel|ThreadChannel|VoiceChannel} TextBasedChannels
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -576,6 +577,7 @@ exports.ChannelTypes = createEnum([
|
|||||||
* * GUILD_NEWS_THREAD
|
* * GUILD_NEWS_THREAD
|
||||||
* * GUILD_PUBLIC_THREAD
|
* * GUILD_PUBLIC_THREAD
|
||||||
* * GUILD_PRIVATE_THREAD
|
* * GUILD_PRIVATE_THREAD
|
||||||
|
* * GUILD_VOICE
|
||||||
* @typedef {string} TextBasedChannelTypes
|
* @typedef {string} TextBasedChannelTypes
|
||||||
*/
|
*/
|
||||||
exports.TextBasedChannelTypes = [
|
exports.TextBasedChannelTypes = [
|
||||||
@@ -585,6 +587,7 @@ exports.TextBasedChannelTypes = [
|
|||||||
'GUILD_NEWS_THREAD',
|
'GUILD_NEWS_THREAD',
|
||||||
'GUILD_PUBLIC_THREAD',
|
'GUILD_PUBLIC_THREAD',
|
||||||
'GUILD_PRIVATE_THREAD',
|
'GUILD_PRIVATE_THREAD',
|
||||||
|
'GUILD_VOICE',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
31
typings/index.d.ts
vendored
31
typings/index.d.ts
vendored
@@ -433,26 +433,23 @@ export class BaseGuildEmoji extends Emoji {
|
|||||||
export class BaseGuildTextChannel extends TextBasedChannelMixin(GuildChannel) {
|
export class BaseGuildTextChannel extends TextBasedChannelMixin(GuildChannel) {
|
||||||
protected constructor(guild: Guild, data?: RawGuildChannelData, client?: Client, immediatePatch?: boolean);
|
protected constructor(guild: Guild, data?: RawGuildChannelData, client?: Client, immediatePatch?: boolean);
|
||||||
public defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
|
public defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
|
||||||
public messages: MessageManager;
|
public rateLimitPerUser: number | null;
|
||||||
public nsfw: boolean;
|
public nsfw: boolean;
|
||||||
public threads: ThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForNewsChannel>;
|
public threads: ThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForNewsChannel>;
|
||||||
public topic: string | null;
|
public topic: string | null;
|
||||||
public createInvite(options?: CreateInviteOptions): Promise<Invite>;
|
public createInvite(options?: CreateInviteOptions): Promise<Invite>;
|
||||||
public createWebhook(name: string, options?: ChannelWebhookCreateOptions): Promise<Webhook>;
|
|
||||||
public fetchInvites(cache?: boolean): Promise<Collection<string, Invite>>;
|
public fetchInvites(cache?: boolean): Promise<Collection<string, Invite>>;
|
||||||
public setDefaultAutoArchiveDuration(
|
public setDefaultAutoArchiveDuration(
|
||||||
defaultAutoArchiveDuration: ThreadAutoArchiveDuration | 'MAX',
|
defaultAutoArchiveDuration: ThreadAutoArchiveDuration | 'MAX',
|
||||||
reason?: string,
|
reason?: string,
|
||||||
): Promise<this>;
|
): Promise<this>;
|
||||||
public setNSFW(nsfw?: boolean, reason?: string): Promise<this>;
|
|
||||||
public setTopic(topic: string | null, reason?: string): Promise<this>;
|
public setTopic(topic: string | null, reason?: string): Promise<this>;
|
||||||
public setType(type: Pick<typeof ChannelTypes, 'GUILD_TEXT'>, reason?: string): Promise<TextChannel>;
|
public setType(type: Pick<typeof ChannelTypes, 'GUILD_TEXT'>, reason?: string): Promise<TextChannel>;
|
||||||
public setType(type: Pick<typeof ChannelTypes, 'GUILD_NEWS'>, reason?: string): Promise<NewsChannel>;
|
public setType(type: Pick<typeof ChannelTypes, 'GUILD_NEWS'>, reason?: string): Promise<NewsChannel>;
|
||||||
public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BaseGuildVoiceChannel extends GuildChannel {
|
export class BaseGuildVoiceChannel extends GuildChannel {
|
||||||
protected 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;
|
||||||
@@ -893,9 +890,14 @@ export class DiscordAPIError extends Error {
|
|||||||
public requestData: HTTPErrorData;
|
public requestData: HTTPErrorData;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DMChannel extends TextBasedChannelMixin(Channel, ['bulkDelete']) {
|
export class DMChannel extends TextBasedChannelMixin(Channel, [
|
||||||
|
'bulkDelete',
|
||||||
|
'fetchWebhooks',
|
||||||
|
'createWebhook',
|
||||||
|
'setRateLimitPerUser',
|
||||||
|
'setNSFW',
|
||||||
|
]) {
|
||||||
private constructor(client: Client, data?: RawDMChannelData);
|
private constructor(client: Client, data?: RawDMChannelData);
|
||||||
public messages: MessageManager;
|
|
||||||
public recipient: User;
|
public recipient: User;
|
||||||
public type: 'DM';
|
public type: 'DM';
|
||||||
public fetch(force?: boolean): Promise<this>;
|
public fetch(force?: boolean): Promise<this>;
|
||||||
@@ -2430,7 +2432,6 @@ export class TextChannel extends BaseGuildTextChannel {
|
|||||||
public rateLimitPerUser: number;
|
public rateLimitPerUser: number;
|
||||||
public threads: ThreadManager<AllowedThreadTypeForTextChannel>;
|
public threads: ThreadManager<AllowedThreadTypeForTextChannel>;
|
||||||
public type: 'GUILD_TEXT';
|
public type: 'GUILD_TEXT';
|
||||||
public setRateLimitPerUser(rateLimitPerUser: number, reason?: string): Promise<TextChannel>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TextInputComponent extends BaseMessageComponent {
|
export class TextInputComponent extends BaseMessageComponent {
|
||||||
@@ -2455,7 +2456,7 @@ export class TextInputComponent extends BaseMessageComponent {
|
|||||||
public static resolveStyle(style: TextInputStyleResolvable): TextInputStyle;
|
public static resolveStyle(style: TextInputStyleResolvable): TextInputStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ThreadChannel extends TextBasedChannelMixin(Channel) {
|
export class ThreadChannel extends TextBasedChannelMixin(Channel, ['fetchWebhooks', 'createWebhook', 'setNSFW']) {
|
||||||
private constructor(guild: Guild, data?: RawThreadChannelData, client?: Client, fromInteraction?: boolean);
|
private constructor(guild: Guild, data?: RawThreadChannelData, client?: Client, fromInteraction?: boolean);
|
||||||
public archived: boolean | null;
|
public archived: boolean | null;
|
||||||
public readonly archivedAt: Date | null;
|
public readonly archivedAt: Date | null;
|
||||||
@@ -2477,7 +2478,6 @@ export class ThreadChannel extends TextBasedChannelMixin(Channel) {
|
|||||||
public readonly sendable: boolean;
|
public readonly sendable: boolean;
|
||||||
public memberCount: number | null;
|
public memberCount: number | null;
|
||||||
public messageCount: number | null;
|
public messageCount: number | null;
|
||||||
public messages: MessageManager;
|
|
||||||
public members: ThreadMemberManager;
|
public members: ThreadMemberManager;
|
||||||
public name: string;
|
public name: string;
|
||||||
public ownerId: Snowflake | null;
|
public ownerId: Snowflake | null;
|
||||||
@@ -2510,7 +2510,6 @@ export class ThreadChannel extends TextBasedChannelMixin(Channel) {
|
|||||||
public setInvitable(invitable?: boolean, reason?: string): Promise<ThreadChannel>;
|
public setInvitable(invitable?: boolean, reason?: string): Promise<ThreadChannel>;
|
||||||
public setLocked(locked?: boolean, reason?: string): Promise<ThreadChannel>;
|
public setLocked(locked?: boolean, reason?: string): Promise<ThreadChannel>;
|
||||||
public setName(name: string, reason?: string): Promise<ThreadChannel>;
|
public setName(name: string, reason?: string): Promise<ThreadChannel>;
|
||||||
public setRateLimitPerUser(rateLimitPerUser: number, reason?: string): Promise<ThreadChannel>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ThreadMember extends Base {
|
export class ThreadMember extends Base {
|
||||||
@@ -2655,12 +2654,13 @@ export class Formatters extends null {
|
|||||||
public static userMention: typeof userMention;
|
public static userMention: typeof userMention;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class VoiceChannel extends BaseGuildVoiceChannel {
|
export class VoiceChannel extends TextBasedChannelMixin(BaseGuildVoiceChannel, ['lastPinTimestamp', 'lastPinAt']) {
|
||||||
public videoQualityMode: VideoQualityMode | null;
|
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 rateLimitPerUser: number | null;
|
||||||
public setBitrate(bitrate: number, reason?: string): Promise<VoiceChannel>;
|
public setBitrate(bitrate: number, reason?: string): Promise<VoiceChannel>;
|
||||||
public setUserLimit(userLimit: number, reason?: string): Promise<VoiceChannel>;
|
public setUserLimit(userLimit: number, reason?: string): Promise<VoiceChannel>;
|
||||||
public setVideoQualityMode(videoQualityMode: VideoQualityMode | number, reason?: string): Promise<VoiceChannel>;
|
public setVideoQualityMode(videoQualityMode: VideoQualityMode | number, reason?: string): Promise<VoiceChannel>;
|
||||||
@@ -3507,6 +3507,7 @@ export interface TextBasedChannelFields extends PartialTextBasedChannelFields {
|
|||||||
readonly lastMessage: Message | null;
|
readonly lastMessage: Message | null;
|
||||||
lastPinTimestamp: number | null;
|
lastPinTimestamp: number | null;
|
||||||
readonly lastPinAt: Date | null;
|
readonly lastPinAt: Date | null;
|
||||||
|
messages: MessageManager;
|
||||||
awaitMessageComponent<T extends MessageComponentTypeResolvable = 'ACTION_ROW'>(
|
awaitMessageComponent<T extends MessageComponentTypeResolvable = 'ACTION_ROW'>(
|
||||||
options?: AwaitMessageCollectorOptionsParams<T, true>,
|
options?: AwaitMessageCollectorOptionsParams<T, true>,
|
||||||
): Promise<MappedInteractionTypes[T]>;
|
): Promise<MappedInteractionTypes[T]>;
|
||||||
@@ -3519,6 +3520,10 @@ export interface TextBasedChannelFields extends PartialTextBasedChannelFields {
|
|||||||
options?: MessageChannelCollectorOptionsParams<T, true>,
|
options?: MessageChannelCollectorOptionsParams<T, true>,
|
||||||
): InteractionCollector<MappedInteractionTypes[T]>;
|
): InteractionCollector<MappedInteractionTypes[T]>;
|
||||||
createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
|
createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
|
||||||
|
createWebhook(name: string, options?: ChannelWebhookCreateOptions): Promise<Webhook>;
|
||||||
|
setRateLimitPerUser(rateLimitPerUser: number, reason?: string): Promise<this>;
|
||||||
|
setNSFW(nsfw?: boolean, reason?: string): Promise<this>;
|
||||||
|
fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
|
||||||
sendTyping(): Promise<void>;
|
sendTyping(): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4199,7 +4204,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];
|
webhookUpdate: [channel: TextChannel | NewsChannel | VoiceChannel];
|
||||||
/** @deprecated Use interactionCreate instead */
|
/** @deprecated Use interactionCreate instead */
|
||||||
interaction: [interaction: Interaction];
|
interaction: [interaction: Interaction];
|
||||||
interactionCreate: [interaction: Interaction];
|
interactionCreate: [interaction: Interaction];
|
||||||
|
|||||||
@@ -770,9 +770,10 @@ declare const guildMember: GuildMember;
|
|||||||
|
|
||||||
// Test whether the structures implement send
|
// Test whether the structures implement send
|
||||||
expectType<TextBasedChannelFields['send']>(dmChannel.send);
|
expectType<TextBasedChannelFields['send']>(dmChannel.send);
|
||||||
expectType<ThreadChannel>(threadChannel);
|
expectType<TextBasedChannelFields['send']>(threadChannel.send);
|
||||||
expectType<NewsChannel>(newsChannel);
|
expectType<TextBasedChannelFields['send']>(newsChannel.send);
|
||||||
expectType<TextChannel>(textChannel);
|
expectType<TextBasedChannelFields['send']>(textChannel.send);
|
||||||
|
expectType<TextBasedChannelFields['send']>(voiceChannel.send);
|
||||||
expectAssignable<PartialTextBasedChannelFields>(user);
|
expectAssignable<PartialTextBasedChannelFields>(user);
|
||||||
expectAssignable<PartialTextBasedChannelFields>(guildMember);
|
expectAssignable<PartialTextBasedChannelFields>(guildMember);
|
||||||
|
|
||||||
@@ -780,6 +781,7 @@ expectType<Message | null>(dmChannel.lastMessage);
|
|||||||
expectType<Message | null>(threadChannel.lastMessage);
|
expectType<Message | null>(threadChannel.lastMessage);
|
||||||
expectType<Message | null>(newsChannel.lastMessage);
|
expectType<Message | null>(newsChannel.lastMessage);
|
||||||
expectType<Message | null>(textChannel.lastMessage);
|
expectType<Message | null>(textChannel.lastMessage);
|
||||||
|
expectType<Message | null>(voiceChannel.lastMessage);
|
||||||
|
|
||||||
expectDeprecated(storeChannel.clone());
|
expectDeprecated(storeChannel.clone());
|
||||||
expectDeprecated(categoryChannel.createChannel('Store', { type: 'GUILD_STORE' }));
|
expectDeprecated(categoryChannel.createChannel('Store', { type: 'GUILD_STORE' }));
|
||||||
@@ -1292,10 +1294,16 @@ 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>(TextBasedChannel);
|
expectType<DMChannel | PartialDMChannel | NewsChannel | TextChannel | ThreadChannel | VoiceChannel>(TextBasedChannel);
|
||||||
expectType<'DM' | 'GUILD_NEWS' | 'GUILD_TEXT' | 'GUILD_PUBLIC_THREAD' | 'GUILD_PRIVATE_THREAD' | 'GUILD_NEWS_THREAD'>(
|
expectType<
|
||||||
TextBasedChannelTypes,
|
| 'DM'
|
||||||
);
|
| 'GUILD_NEWS'
|
||||||
|
| 'GUILD_TEXT'
|
||||||
|
| 'GUILD_PUBLIC_THREAD'
|
||||||
|
| 'GUILD_PRIVATE_THREAD'
|
||||||
|
| 'GUILD_NEWS_THREAD'
|
||||||
|
| 'GUILD_VOICE'
|
||||||
|
>(TextBasedChannelTypes);
|
||||||
expectType<StageChannel | VoiceChannel>(VoiceBasedChannel);
|
expectType<StageChannel | VoiceChannel>(VoiceBasedChannel);
|
||||||
expectType<CategoryChannel | NewsChannel | StageChannel | StoreChannel | TextChannel | ThreadChannel | VoiceChannel>(
|
expectType<CategoryChannel | NewsChannel | StageChannel | StoreChannel | TextChannel | ThreadChannel | VoiceChannel>(
|
||||||
GuildBasedChannel,
|
GuildBasedChannel,
|
||||||
@@ -1303,4 +1311,4 @@ expectType<CategoryChannel | NewsChannel | StageChannel | StoreChannel | TextCha
|
|||||||
expectType<CategoryChannel | NewsChannel | StageChannel | StoreChannel | TextChannel | VoiceChannel>(
|
expectType<CategoryChannel | NewsChannel | StageChannel | StoreChannel | TextChannel | VoiceChannel>(
|
||||||
NonThreadGuildBasedChannel,
|
NonThreadGuildBasedChannel,
|
||||||
);
|
);
|
||||||
expectType<NewsChannel | TextChannel | ThreadChannel>(GuildTextBasedChannel);
|
expectType<NewsChannel | TextChannel | ThreadChannel | VoiceChannel>(GuildTextBasedChannel);
|
||||||
|
|||||||
Reference in New Issue
Block a user