fix: missed enums and typings from #7290 (#7331)

This commit is contained in:
IRONM00N
2022-01-25 15:23:13 -05:00
committed by GitHub
parent 67250382f9
commit 47633f0fd2
17 changed files with 337 additions and 179 deletions

View File

@@ -1,11 +1,7 @@
'use strict'; 'use strict';
const { Collection } = require('@discordjs/collection'); const { Collection } = require('@discordjs/collection');
const { const { GuildScheduledEventEntityType } = require('discord-api-types/v9');
GuildScheduledEventPrivacyLevel,
GuildScheduledEventEntityType,
GuildScheduledEventStatus,
} = require('discord-api-types/v9');
const CachedManager = require('./CachedManager'); const CachedManager = require('./CachedManager');
const { TypeError, Error } = require('../errors'); const { TypeError, Error } = require('../errors');
const { GuildScheduledEvent } = require('../structures/GuildScheduledEvent'); const { GuildScheduledEvent } = require('../structures/GuildScheduledEvent');
@@ -44,16 +40,16 @@ class GuildScheduledEventManager extends CachedManager {
* @property {string} name The name of the guild scheduled event * @property {string} name The name of the guild scheduled event
* @property {DateResolvable} scheduledStartTime The time to schedule the event at * @property {DateResolvable} scheduledStartTime The time to schedule the event at
* @property {DateResolvable} [scheduledEndTime] The time to end the event at * @property {DateResolvable} [scheduledEndTime] The time to end the event at
* <warn>This is required if `entityType` is `GuildScheduledEventEntityType.External`</warn> * <warn>This is required if `entityType` is {@link GuildScheduledEventEntityType.External}</warn>
* @property {PrivacyLevel|number} privacyLevel The privacy level of the guild scheduled event * @property {PrivacyLevel|number} privacyLevel The privacy level of the guild scheduled event
* @property {GuildScheduledEventEntityType|number} entityType The scheduled entity type of the event * @property {GuildScheduledEventEntityType|number} entityType The scheduled entity type of the event
* @property {string} [description] The description of the guild scheduled event * @property {string} [description] The description of the guild scheduled event
* @property {GuildVoiceChannelResolvable} [channel] The channel of the guild scheduled event * @property {GuildVoiceChannelResolvable} [channel] The channel of the guild scheduled event
* <warn>This is required if `entityType` is `GuildScheduledEventEntityType.StageInstance` or * <warn>This is required if `entityType` is {@link GuildScheduledEventEntityType.StageInstance} or
* `GuildScheduledEventEntityType.Voice`</warn> * {@link GuildScheduledEventEntityType.Voice}</warn>
* @property {GuildScheduledEventEntityMetadataOptions} [entityMetadata] The entity metadata of the * @property {GuildScheduledEventEntityMetadataOptions} [entityMetadata] The entity metadata of the
* guild scheduled event * guild scheduled event
* <warn>This is required if `entityType` is `GuildScheduledEventEntityType.External`</warn> * <warn>This is required if `entityType` is {@link GuildScheduledEventEntityType.External}</warn>
* @property {string} [reason] The reason for creating the guild scheduled event * @property {string} [reason] The reason for creating the guild scheduled event
*/ */
@@ -61,7 +57,7 @@ class GuildScheduledEventManager extends CachedManager {
* Options used to set entity metadata of a guild scheduled event. * Options used to set entity metadata of a guild scheduled event.
* @typedef {Object} GuildScheduledEventEntityMetadataOptions * @typedef {Object} GuildScheduledEventEntityMetadataOptions
* @property {string} [location] The location of the guild scheduled event * @property {string} [location] The location of the guild scheduled event
* <warn>This is required if `entityType` is `GuildScheduledEventEntityType.External`</warn> * <warn>This is required if `entityType` is {@link GuildScheduledEventEntityType.External}</warn>
*/ */
/** /**
@@ -83,9 +79,6 @@ class GuildScheduledEventManager extends CachedManager {
reason, reason,
} = options; } = options;
if (typeof privacyLevel === 'string') privacyLevel = GuildScheduledEventPrivacyLevel[privacyLevel];
if (typeof entityType === 'string') entityType = GuildScheduledEventEntityType[entityType];
let entity_metadata, channel_id; let entity_metadata, channel_id;
if (entityType === GuildScheduledEventEntityType.External) { if (entityType === GuildScheduledEventEntityType.External) {
channel_id = typeof channel === 'undefined' ? channel : null; channel_id = typeof channel === 'undefined' ? channel : null;
@@ -177,7 +170,7 @@ class GuildScheduledEventManager extends CachedManager {
* @property {GuildScheduledEventEntityMetadataOptions} [entityMetadata] The entity metadata of the * @property {GuildScheduledEventEntityMetadataOptions} [entityMetadata] The entity metadata of the
* guild scheduled event * guild scheduled event
* <warn>This can be modified only if `entityType` of the `GuildScheduledEvent` to be edited is * <warn>This can be modified only if `entityType` of the `GuildScheduledEvent` to be edited is
* `GuildScheduledEventEntityType.External`</warn> * {@link GuildScheduledEventEntityType.External}</warn>
* @property {string} [reason] The reason for editing the guild scheduled event * @property {string} [reason] The reason for editing the guild scheduled event
*/ */
@@ -205,10 +198,6 @@ class GuildScheduledEventManager extends CachedManager {
reason, reason,
} = options; } = options;
if (typeof privacyLevel === 'string') privacyLevel = GuildScheduledEventPrivacyLevel[privacyLevel];
if (typeof entityType === 'string') entityType = GuildScheduledEventEntityType[entityType];
if (typeof status === 'string') status = GuildScheduledEventStatus[status];
let entity_metadata; let entity_metadata;
if (entityMetadata) { if (entityMetadata) {
entity_metadata = { entity_metadata = {

View File

@@ -1,6 +1,5 @@
'use strict'; 'use strict';
const { GuildScheduledEventPrivacyLevel } = require('discord-api-types/v9');
const CachedManager = require('./CachedManager'); const CachedManager = require('./CachedManager');
const { TypeError, Error } = require('../errors'); const { TypeError, Error } = require('../errors');
const { StageInstance } = require('../structures/StageInstance'); const { StageInstance } = require('../structures/StageInstance');
@@ -60,8 +59,6 @@ class StageInstanceManager extends CachedManager {
if (typeof options !== 'object') throw new TypeError('INVALID_TYPE', 'options', 'object', true); if (typeof options !== 'object') throw new TypeError('INVALID_TYPE', 'options', 'object', true);
let { topic, privacyLevel } = options; let { topic, privacyLevel } = options;
privacyLevel &&= typeof privacyLevel === 'number' ? privacyLevel : GuildScheduledEventPrivacyLevel[privacyLevel];
const data = await this.client.api['stage-instances'].post({ const data = await this.client.api['stage-instances'].post({
data: { data: {
channel_id: channelId, channel_id: channelId,
@@ -122,8 +119,6 @@ class StageInstanceManager extends CachedManager {
let { topic, privacyLevel } = options; let { topic, privacyLevel } = options;
privacyLevel &&= typeof privacyLevel === 'number' ? privacyLevel : GuildScheduledEventPrivacyLevel[privacyLevel];
const data = await this.client.api('stage-instances', channelId).patch({ const data = await this.client.api('stage-instances', channelId).patch({
data: { data: {
topic, topic,

View File

@@ -64,11 +64,12 @@ class ThreadManager extends CachedManager {
* @typedef {StartThreadOptions} ThreadCreateOptions * @typedef {StartThreadOptions} ThreadCreateOptions
* @property {MessageResolvable} [startMessage] The message to start a thread from. <warn>If this is defined then type * @property {MessageResolvable} [startMessage] The message to start a thread from. <warn>If this is defined then type
* of thread gets automatically defined and cannot be changed. The provided `type` field will be ignored</warn> * of thread gets automatically defined and cannot be changed. The provided `type` field will be ignored</warn>
* @property {ThreadChannelTypes|number} [type] The type of thread to create. Defaults to `GUILD_PUBLIC_THREAD` if * @property {ThreadChannelTypes|number} [type] The type of thread to create.
* created in a {@link TextChannel} <warn>When creating threads in a {@link NewsChannel} this is ignored and is always * Defaults to {@link ChannelType.GuildPublicThread} if created in a {@link TextChannel}
* `GUILD_NEWS_THREAD`</warn> * <warn>When creating threads in a {@link NewsChannel} this is ignored and is always
* {@link ChannelType.GuildNewsThread}</warn>
* @property {boolean} [invitable] Whether non-moderators can add other non-moderators to the thread * @property {boolean} [invitable] Whether non-moderators can add other non-moderators to the thread
* <info>Can only be set when type will be `GUILD_PRIVATE_THREAD`</info> * <info>Can only be set when type will be {@link ChannelType.GuildPrivateThread}</info>
* @property {number} [rateLimitPerUser] The rate limit per user (slowmode) for the new channel in seconds * @property {number} [rateLimitPerUser] The rate limit per user (slowmode) for the new channel in seconds
*/ */

View File

@@ -1,7 +1,7 @@
'use strict'; 'use strict';
const { DiscordSnowflake } = require('@sapphire/snowflake'); const { DiscordSnowflake } = require('@sapphire/snowflake');
const { ApplicationCommandOptionType, ChannelType } = require('discord-api-types/v9'); const { ApplicationCommandOptionType } = require('discord-api-types/v9');
const Base = require('./Base'); const Base = require('./Base');
const ApplicationCommandPermissionsManager = require('../managers/ApplicationCommandPermissionsManager'); const ApplicationCommandPermissionsManager = require('../managers/ApplicationCommandPermissionsManager');
@@ -141,17 +141,19 @@ class ApplicationCommand extends Base {
* <warn>Note that providing a value for the `camelCase` counterpart for any `snake_case` property * <warn>Note that providing a value for the `camelCase` counterpart for any `snake_case` property
* will discard the provided `snake_case` property.</warn> * will discard the provided `snake_case` property.</warn>
* @typedef {Object} ApplicationCommandOptionData * @typedef {Object} ApplicationCommandOptionData
* @property {ApplicationCommandOptionType|number} type The type of the option * @property {ApplicationCommandOptionType} type The type of the option
* @property {string} name The name of the option * @property {string} name The name of the option
* @property {string} description The description of the option * @property {string} description The description of the option
* @property {boolean} [autocomplete] Whether the option is an autocomplete option * @property {boolean} [autocomplete] Whether the option is an autocomplete option
* @property {boolean} [required] Whether the option is required * @property {boolean} [required] Whether the option is required
* @property {ApplicationCommandOptionChoice[]} [choices] The choices of the option for the user to pick from * @property {ApplicationCommandOptionChoice[]} [choices] The choices of the option for the user to pick from
* @property {ApplicationCommandOptionData[]} [options] Additional options if this option is a subcommand (group) * @property {ApplicationCommandOptionData[]} [options] Additional options if this option is a subcommand (group)
* @property {ChannelType[]|number[]} [channelTypes] When the option type is channel, * @property {ChannelType[]} [channelTypes] When the option type is channel,
* the allowed types of channels that can be selected * the allowed types of channels that can be selected
* @property {number} [minValue] The minimum value for an `INTEGER` or `NUMBER` option * @property {number} [minValue] The minimum value for an {@link ApplicationCommandOptionType.Integer} or
* @property {number} [maxValue] The maximum value for an `INTEGER` or `NUMBER` option * {@link ApplicationCommandOptionType.Number} option
* @property {number} [maxValue] The maximum value for an {@link ApplicationCommandOptionType.Integer} or
* {@link ApplicationCommandOptionType.Number} option
*/ */
/** /**
@@ -349,8 +351,10 @@ class ApplicationCommand extends Base {
* @property {ApplicationCommandOption[]} [options] Additional options if this option is a subcommand (group) * @property {ApplicationCommandOption[]} [options] Additional options if this option is a subcommand (group)
* @property {ChannelType[]} [channelTypes] When the option type is channel, * @property {ChannelType[]} [channelTypes] When the option type is channel,
* the allowed types of channels that can be selected * the allowed types of channels that can be selected
* @property {number} [minValue] The minimum value for an `INTEGER` or `NUMBER` option * @property {number} [minValue] The minimum value for an {@link ApplicationCommandOptionType.Integer} or
* @property {number} [maxValue] The maximum value for an `INTEGER` or `NUMBER` option * {@link ApplicationCommandOptionType.Number} option
* @property {number} [maxValue] The maximum value for an {@link ApplicationCommandOptionType.Integer} or
* {@link ApplicationCommandOptionType.Number} option
*/ */
/** /**
@@ -384,11 +388,7 @@ class ApplicationCommand extends Base {
autocomplete: option.autocomplete, autocomplete: option.autocomplete,
choices: option.choices, choices: option.choices,
options: option.options?.map(o => this.transformOption(o, received)), options: option.options?.map(o => this.transformOption(o, received)),
[channelTypesKey]: received [channelTypesKey]: option.channelTypes ?? option.channel_types,
? option.channel_types?.map(type => ChannelType[type])
: option.channelTypes?.map(type => (typeof type === 'string' ? ChannelType[type] : type)) ??
// When transforming to API data, accept API data
option.channel_types,
[minValueKey]: option.minValue ?? option.min_value, [minValueKey]: option.minValue ?? option.min_value,
[maxValueKey]: option.maxValue ?? option.max_value, [maxValueKey]: option.maxValue ?? option.max_value,
}; };

View File

@@ -187,9 +187,10 @@ class BaseGuildTextChannel extends GuildChannel {
* @property {number} [maxUses=0] Maximum number of uses * @property {number} [maxUses=0] Maximum number of uses
* @property {boolean} [unique=false] Create a unique invite, or use an existing one with similar settings * @property {boolean} [unique=false] Create a unique invite, or use an existing one with similar settings
* @property {UserResolvable} [targetUser] The user whose stream to display for this invite, * @property {UserResolvable} [targetUser] The user whose stream to display for this invite,
* required if `targetType` is `STREAM`, the user must be streaming in the channel * required if `targetType` is {@link InviteTargetType.Stream}, the user must be streaming in the channel
* @property {ApplicationResolvable} [targetApplication] The embedded application to open for this invite, * @property {ApplicationResolvable} [targetApplication] The embedded application to open for this invite,
* required if `targetType` is `EMBEDDED_APPLICATION`, the application must have the `EMBEDDED` flag * required if `targetType` is {@link InviteTargetType.Stream}, the application must have the
* {@link InviteTargetType.EmbeddedApplication} flag
* @property {InviteTargetType} [targetType] The type of the target for this voice channel invite * @property {InviteTargetType} [targetType] The type of the target for this voice channel invite
* @property {string} [reason] The reason for creating the invite * @property {string} [reason] The reason for creating the invite
*/ */

View File

@@ -45,7 +45,8 @@ class CategoryChannel extends GuildChannel {
/** /**
* Creates a new channel within this category. * Creates a new channel within this category.
* <info>You cannot create a channel of type `GUILD_CATEGORY` inside a CategoryChannel.</info> * <info>You cannot create a channel of type {@link ChannelType.GuildCategory} inside a
* CategoryChannel.</info>
* @param {string} name The name of the new channel * @param {string} name The name of the new channel
* @param {CategoryCreateChannelOptions} options Options for creating the new channel * @param {CategoryCreateChannelOptions} options Options for creating the new channel
* @returns {Promise<GuildChannel>} * @returns {Promise<GuildChannel>}

View File

@@ -28,7 +28,8 @@ class ContextMenuCommandInteraction extends CommandInteraction {
this.targetId = data.data.target_id; this.targetId = data.data.target_id;
/** /**
* The type of the target of the interaction; either `.User` or `.Message` * The type of the target of the interaction; either {@link ApplicationCommandType.User}
* or {@link ApplicationCommandType.Message}
* @type {ApplicationCommandType.User|ApplicationCommandType.Message} * @type {ApplicationCommandType.User|ApplicationCommandType.Message}
*/ */
this.targetType = data.data.type; this.targetType = data.data.type;

View File

@@ -971,7 +971,7 @@ class Guild extends AnonymousGuild {
/** /**
* Edits the verification level of the guild. * Edits the verification level of the guild.
* @param {VerificationLevel|number} verificationLevel The new verification level of the guild * @param {VerificationLevel} verificationLevel The new verification level of the guild
* @param {string} [reason] Reason for changing the guild's verification level * @param {string} [reason] Reason for changing the guild's verification level
* @returns {Promise<Guild>} * @returns {Promise<Guild>}
* @example * @example

View File

@@ -1,11 +1,7 @@
'use strict'; 'use strict';
const { DiscordSnowflake } = require('@sapphire/snowflake'); const { DiscordSnowflake } = require('@sapphire/snowflake');
const { const { GuildScheduledEventStatus, GuildScheduledEventEntityType } = require('discord-api-types/v9');
GuildScheduledEventPrivacyLevel,
GuildScheduledEventStatus,
GuildScheduledEventEntityType,
} = require('discord-api-types/v9');
const Base = require('./Base'); const Base = require('./Base');
const { Error } = require('../errors'); const { Error } = require('../errors');
const { Endpoints } = require('../util/Constants'); const { Endpoints } = require('../util/Constants');
@@ -36,7 +32,8 @@ class GuildScheduledEvent extends Base {
_patch(data) { _patch(data) {
if ('channel_id' in data) { if ('channel_id' in data) {
/** /**
* The channel id in which the scheduled event will be hosted, or `null` if entity type is `EXTERNAL` * The channel id in which the scheduled event will be hosted,
* or `null` if entity type is {@link GuildScheduledEventEntityType.External}
* @type {?Snowflake} * @type {?Snowflake}
*/ */
this.channelId = data.channel_id; this.channelId = data.channel_id;
@@ -86,21 +83,21 @@ class GuildScheduledEvent extends Base {
/** /**
* The privacy level of the guild scheduled event * The privacy level of the guild scheduled event
* @type {PrivacyLevel} * @type {GuildScheduledEventPrivacyLevel}
*/ */
this.privacyLevel = GuildScheduledEventPrivacyLevel[data.privacy_level]; this.privacyLevel = data.privacy_level;
/** /**
* The status of the guild scheduled event * The status of the guild scheduled event
* @type {GuildScheduledEventStatus} * @type {GuildScheduledEventStatus}
*/ */
this.status = GuildScheduledEventStatus[data.status]; this.status = data.status;
/** /**
* The type of hosting entity associated with the scheduled event * The type of hosting entity associated with the scheduled event
* @type {GuildScheduledEventEntityType} * @type {GuildScheduledEventEntityType}
*/ */
this.entityType = GuildScheduledEventEntityType[data.entity_type]; this.entityType = data.entity_type;
if ('entity_id' in data) { if ('entity_id' in data) {
/** /**
@@ -226,7 +223,8 @@ class GuildScheduledEvent extends Base {
* Options used to create an invite URL to a {@link GuildScheduledEvent} * Options used to create an invite URL to a {@link GuildScheduledEvent}
* @typedef {CreateInviteOptions} CreateGuildScheduledEventInviteURLOptions * @typedef {CreateInviteOptions} CreateGuildScheduledEventInviteURLOptions
* @property {GuildInvitableChannelResolvable} [channel] The channel to create the invite in. * @property {GuildInvitableChannelResolvable} [channel] The channel to create the invite in.
* <warn>This is required when the `entityType` of `GuildScheduledEvent` is `EXTERNAL`, gets ignored otherwise</warn> * <warn>This is required when the `entityType` of `GuildScheduledEvent` is
* {@link GuildScheduledEventEntityType.External}, gets ignored otherwise</warn>
*/ */
/** /**
@@ -387,35 +385,35 @@ class GuildScheduledEvent extends Base {
} }
/** /**
* Indicates whether this guild scheduled event has an `ACTIVE` status. * Indicates whether this guild scheduled event has an {@link GuildScheduledEventStatus.Active} status.
* @returns {boolean} * @returns {boolean}
*/ */
isActive() { isActive() {
return GuildScheduledEventStatus[this.status] === GuildScheduledEventStatus.Active; return this.status === GuildScheduledEventStatus.Active;
} }
/** /**
* Indicates whether this guild scheduled event has a `CANCELED` status. * Indicates whether this guild scheduled event has a {@link GuildScheduledEventStatus.Canceled} status.
* @returns {boolean} * @returns {boolean}
*/ */
isCanceled() { isCanceled() {
return GuildScheduledEventStatus[this.status] === GuildScheduledEventStatus.Canceled; return this.status === GuildScheduledEventStatus.Canceled;
} }
/** /**
* Indicates whether this guild scheduled event has a `COMPLETED` status. * Indicates whether this guild scheduled event has a {@link GuildScheduledEventStatus.Completed} status.
* @returns {boolean} * @returns {boolean}
*/ */
isCompleted() { isCompleted() {
return GuildScheduledEventStatus[this.status] === GuildScheduledEventStatus.Completed; return this.status === GuildScheduledEventStatus.Completed;
} }
/** /**
* Indicates whether this guild scheduled event has a `SCHEDULED` status. * Indicates whether this guild scheduled event has a {@link GuildScheduledEventStatus.Scheduled} status.
* @returns {boolean} * @returns {boolean}
*/ */
isScheduled() { isScheduled() {
return GuildScheduledEventStatus[this.status] === GuildScheduledEventStatus.Scheduled; return this.status === GuildScheduledEventStatus.Scheduled;
} }
} }

View File

@@ -1,14 +1,13 @@
'use strict'; 'use strict';
const { Collection } = require('@discordjs/collection'); const { Collection } = require('@discordjs/collection');
const { InteractionType, ComponentType } = require('discord-api-types/v9');
const Collector = require('./interfaces/Collector'); const Collector = require('./interfaces/Collector');
const { Events } = require('../util/Constants'); const { Events } = require('../util/Constants');
/** /**
* @typedef {CollectorOptions} InteractionCollectorOptions * @typedef {CollectorOptions} InteractionCollectorOptions
* @property {TextBasedChannels} [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 {ComponentType} [componentType] The type of component to listen for
* @property {Guild} [guild] The guild to listen to interactions from * @property {Guild} [guild] The guild to listen to interactions from
* @property {InteractionType} [interactionType] The type of interaction to listen for * @property {InteractionType} [interactionType] The type of interaction to listen for
* @property {number} [max] The maximum total amount of interactions to collect * @property {number} [max] The maximum total amount of interactions to collect
@@ -64,17 +63,13 @@ class InteractionCollector extends Collector {
* The type of interaction to collect * The type of interaction to collect
* @type {?InteractionType} * @type {?InteractionType}
*/ */
this.interactionType = this.interactionType = options.interactionType ?? null;
typeof options.interactionType === 'number'
? InteractionType[options.interactionType]
: options.interactionType ?? null;
/** /**
* The type of component to collect * The type of component to collect
* @type {?MessageComponentType} * @type {?ComponentType}
*/ */
this.componentType = this.componentType = options.componentType ?? null;
typeof options.componentType === 'number' ? ComponentType[options.componentType] : options.componentType ?? null;
/** /**
* The users that have interacted with this collector * The users that have interacted with this collector

View File

@@ -288,10 +288,10 @@ class Message extends Base {
* Reference data sent in a message that contains ids identifying the referenced message. * Reference data sent in a message that contains ids identifying the referenced message.
* This can be present in the following types of message: * This can be present in the following types of message:
* * Crossposted messages (IS_CROSSPOST {@link MessageFlags.FLAGS message flag}) * * Crossposted messages (IS_CROSSPOST {@link MessageFlags.FLAGS message flag})
* * CHANNEL_FOLLOW_ADD * * {@link MessageType.ChannelFollowAdd}
* * CHANNEL_PINNED_MESSAGE * * {@link MessageType.ChannelPinnedMessage}
* * REPLY * * {@link MessageType.Reply}
* * THREAD_STARTER_MESSAGE * * {@link MessageType.ThreadStarterMessage}
* @see {@link https://discord.com/developers/docs/resources/channel#message-types} * @see {@link https://discord.com/developers/docs/resources/channel#message-types}
* @typedef {Object} MessageReference * @typedef {Object} MessageReference
* @property {Snowflake} channelId The channel's id the message was referenced * @property {Snowflake} channelId The channel's id the message was referenced
@@ -482,7 +482,7 @@ class Message extends Base {
/** /**
* @typedef {CollectorOptions} MessageComponentCollectorOptions * @typedef {CollectorOptions} MessageComponentCollectorOptions
* @property {MessageComponentType} [componentType] The type of component to listen for * @property {ComponentType} [componentType] The type of component to listen for
* @property {number} [max] The maximum total amount of interactions to collect * @property {number} [max] The maximum total amount of interactions to collect
* @property {number} [maxComponents] The maximum number of components to collect * @property {number} [maxComponents] The maximum number of components to collect
* @property {number} [maxUsers] The maximum number of users to interact * @property {number} [maxUsers] The maximum number of users to interact
@@ -512,7 +512,7 @@ class Message extends Base {
* @typedef {Object} AwaitMessageComponentOptions * @typedef {Object} AwaitMessageComponentOptions
* @property {CollectorFilter} [filter] The filter applied to this collector * @property {CollectorFilter} [filter] The filter applied to this collector
* @property {number} [time] Time to wait for an interaction before rejecting * @property {number} [time] Time to wait for an interaction before rejecting
* @property {MessageComponentType} [componentType] The type of component interaction to collect * @property {ComponentType} [componentType] The type of component interaction to collect
*/ */
/** /**

View File

@@ -156,7 +156,8 @@ class Sticker extends Base {
/** /**
* A link to the sticker * A link to the sticker
* <info>If the sticker's format is LOTTIE, it returns the URL of the Lottie JSON file.</info> * <info>If the sticker's format is {@link StickerFormatType.Lottie}, it returns
* the URL of the Lottie JSON file.</info>
* @type {string} * @type {string}
*/ */
get url() { get url() {

View File

@@ -292,7 +292,7 @@ class ThreadChannel extends Channel {
* @property {number} [rateLimitPerUser] The rate limit per user (slowmode) for the thread in seconds * @property {number} [rateLimitPerUser] The rate limit per user (slowmode) for the thread in seconds
* @property {boolean} [locked] Whether the thread is locked * @property {boolean} [locked] Whether the thread is locked
* @property {boolean} [invitable] Whether non-moderators can add other non-moderators to a thread * @property {boolean} [invitable] Whether non-moderators can add other non-moderators to a thread
* <info>Can only be edited on `GUILD_PRIVATE_THREAD`</info> * <info>Can only be edited on {@link ChannelType.GuildPrivateThread}</info>
*/ */
/** /**

View File

@@ -423,10 +423,10 @@ exports.SweeperKeys = [
/** /**
* The types of messages that are not `System`. The available types are: * The types of messages that are not `System`. The available types are:
* * `MessageType.Default` * * {@link MessageType.Default}
* * `MessageType.Reply` * * {@link MessageType.Reply}
* * `MessageType.ChatInputCommand` * * {@link MessageType.ChatInputCommand}
* * `MessageType.ContextMenuCommand` * * {@link MessageType.ContextMenuCommand}
* @typedef {MessageType[]} NonSystemMessageTypes * @typedef {MessageType[]} NonSystemMessageTypes
*/ */
exports.NonSystemMessageTypes = [ exports.NonSystemMessageTypes = [
@@ -447,12 +447,12 @@ exports.NonSystemMessageTypes = [
/** /**
* The types of channels that are text-based. The available types are: * The types of channels that are text-based. The available types are:
* * `ChannelType.DM` * * {@link ChannelType.DM}
* * `ChannelType.GuildText` * * {@link ChannelType.GuildText}
* * `ChannelType.GuildNews` * * {@link ChannelType.GuildNews}
* * `ChannelType.GuildNewsThread` * * {@link ChannelType.GuildNewsThread}
* * `ChannelType.GuildPublicThread` * * {@link ChannelType.GuildPublicThread}
* * `ChannelType.GuildPrivateThread` * * {@link ChannelType.GuildPrivateThread}
* @typedef {ChannelType} TextBasedChannelTypes * @typedef {ChannelType} TextBasedChannelTypes
*/ */
exports.TextBasedChannelTypes = [ exports.TextBasedChannelTypes = [
@@ -466,9 +466,9 @@ exports.TextBasedChannelTypes = [
/** /**
* The types of channels that are threads. The available types are: * The types of channels that are threads. The available types are:
* * `ChannelType.GuildNewsThread` * * {@link ChannelType.GuildNewsThread}
* * `ChannelType.GuildPublicThread` * * {@link ChannelType.GuildPublicThread}
* * `ChannelType.GuildPrivateThread` * * {@link ChannelType.GuildPrivateThread}
* @typedef {ChannelType[]} ThreadChannelTypes * @typedef {ChannelType[]} ThreadChannelTypes
*/ */
exports.ThreadChannelTypes = [ exports.ThreadChannelTypes = [
@@ -479,8 +479,8 @@ exports.ThreadChannelTypes = [
/** /**
* The types of channels that are voice-based. The available types are: * The types of channels that are voice-based. The available types are:
* * `ChannelType.GuildVoice` * * {@link ChannelType.GuildVoice}
* * `ChannelType.GuildStageVoice` * * {@link ChannelType.GuildStageVoice}
* @typedef {ChannelType[]} VoiceBasedChannelTypes * @typedef {ChannelType[]} VoiceBasedChannelTypes
*/ */
exports.VoiceBasedChannelTypes = [ChannelType.GuildVoice, ChannelType.GuildStageVoice]; exports.VoiceBasedChannelTypes = [ChannelType.GuildVoice, ChannelType.GuildStageVoice];

View File

@@ -9,6 +9,16 @@ const {
ChannelType, ChannelType,
ApplicationCommandPermissionType, ApplicationCommandPermissionType,
MessageType, MessageType,
GuildNSFWLevel,
GuildVerificationLevel,
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
GuildPremiumTier,
GuildScheduledEventStatus,
StageInstancePrivacyLevel,
GuildMFALevel,
TeamMemberMembershipState,
GuildScheduledEventEntityType,
} = require('discord-api-types/v9'); } = require('discord-api-types/v9');
function unknownKeyStrategy(val) { function unknownKeyStrategy(val) {
@@ -17,7 +27,7 @@ function unknownKeyStrategy(val) {
class EnumResolvers extends null { class EnumResolvers extends null {
/** /**
* Resolves enum key to `ChannelType` enum value * Resolves enum key to {@link ChannelType} enum value
* @param {string|ChannelType} key The key to resolve * @param {string|ChannelType} key The key to resolve
* @returns {ChannelType} * @returns {ChannelType}
*/ */
@@ -49,7 +59,7 @@ class EnumResolvers extends null {
} }
/** /**
* Resolves enum key to `InteractionType` enum value * Resolves enum key to {@link InteractionType} enum value
* @param {string|InteractionType} key The key to resolve * @param {string|InteractionType} key The key to resolve
* @returns {InteractionType} * @returns {InteractionType}
*/ */
@@ -69,7 +79,7 @@ class EnumResolvers extends null {
} }
/** /**
* Resolves enum key to `ApplicationCommandType` enum value * Resolves enum key to {@link ApplicationCommandType} enum value
* @param {string|ApplicationCommandType} key The key to resolve * @param {string|ApplicationCommandType} key The key to resolve
* @returns {ApplicationCommandType} * @returns {ApplicationCommandType}
*/ */
@@ -87,7 +97,7 @@ class EnumResolvers extends null {
} }
/** /**
* Resolves enum key to `ApplicationCommandOptionType` enum value * Resolves enum key to {@link ApplicationCommandOptionType} enum value
* @param {string|ApplicationCommandOptionType} key The key to resolve * @param {string|ApplicationCommandOptionType} key The key to resolve
* @returns {ApplicationCommandOptionType} * @returns {ApplicationCommandOptionType}
*/ */
@@ -119,7 +129,7 @@ class EnumResolvers extends null {
} }
/** /**
* Resolves enum key to `ApplicationCommandPermissionType` enum value * Resolves enum key to {@link ApplicationCommandPermissionType} enum value
* @param {string|ApplicationCommandPermissionType} key The key to resolve * @param {string|ApplicationCommandPermissionType} key The key to resolve
* @returns {ApplicationCommandPermissionType} * @returns {ApplicationCommandPermissionType}
*/ */
@@ -135,7 +145,7 @@ class EnumResolvers extends null {
} }
/** /**
* Resolves enum key to `ComponentType` enum value * Resolves enum key to {@link ComponentType} enum value
* @param {string|ComponentType} key The key to resolve * @param {string|ComponentType} key The key to resolve
* @returns {ComponentType} * @returns {ComponentType}
*/ */
@@ -153,7 +163,7 @@ class EnumResolvers extends null {
} }
/** /**
* Resolves enum key to `ButtonStyle` enum value * Resolves enum key to {@link ButtonStyle} enum value
* @param {string|ButtonStyle} key The key to resolve * @param {string|ButtonStyle} key The key to resolve
* @returns {ButtonStyle} * @returns {ButtonStyle}
*/ */
@@ -175,7 +185,7 @@ class EnumResolvers extends null {
} }
/** /**
* Resolves enum key to `MessageType` enum value * Resolves enum key to {@link MessageType} enum value
* @param {string|MessageType} key The key to lookup * @param {string|MessageType} key The key to lookup
* @returns {MessageType} * @returns {MessageType}
*/ */
@@ -231,6 +241,188 @@ class EnumResolvers extends null {
return unknownKeyStrategy(key); return unknownKeyStrategy(key);
} }
} }
/**
* Resolves enum key to {@link GuildNSFWLevel} enum value
* @param {string|GuildNSFWLevel} key The key to lookup
* @returns {GuildNSFWLevel}
*/
static resolveGuildNSFWLevel(key) {
switch (key) {
case 'DEFAULT':
return GuildNSFWLevel.Default;
case 'EXPLICIT':
return GuildNSFWLevel.Explicit;
case 'SAFE':
return GuildNSFWLevel.Safe;
case 'AGE_RESTRICTED':
return GuildNSFWLevel.AgeRestricted;
default:
return unknownKeyStrategy(key);
}
}
/**
* Resolves enum key to {@link GuildVerificationLevel} enum value
* @param {string|GuildVerificationLevel} key The key to lookup
* @returns {GuildVerificationLevel}
*/
static resolveGuildVerificationLevel(key) {
switch (key) {
case 'NONE':
return GuildVerificationLevel.None;
case 'LOW':
return GuildVerificationLevel.Low;
case 'MEDIUM':
return GuildVerificationLevel.Medium;
case 'HIGH':
return GuildVerificationLevel.High;
case 'VERY_HIGH':
return GuildVerificationLevel.VeryHigh;
default:
return unknownKeyStrategy(key);
}
}
/**
* Resolves enum key to {@link GuildDefaultMessageNotifications} enum value
* @param {string|GuildDefaultMessageNotifications} key The key to lookup
* @returns {GuildDefaultMessageNotifications}
*/
static resolveGuildDefaultMessageNotifications(key) {
switch (key) {
case 'ALL_MESSAGES':
return GuildDefaultMessageNotifications.AllMessages;
case 'ONLY_MENTIONS':
return GuildDefaultMessageNotifications.OnlyMentions;
default:
return unknownKeyStrategy(key);
}
}
/**
* Resolves enum key to {@link GuildExplicitContentFilter} enum value
* @param {string|GuildExplicitContentFilter} key The key to lookup
* @returns {GuildExplicitContentFilter}
*/
static resolveGuildExplicitContentFilter(key) {
switch (key) {
case 'DISABLED':
return GuildExplicitContentFilter.Disabled;
case 'MEMBERS_WITHOUT_ROLES':
return GuildExplicitContentFilter.MembersWithoutRoles;
case 'ALL_MEMBERS':
return GuildExplicitContentFilter.AllMembers;
default:
return unknownKeyStrategy(key);
}
}
/**
* Resolves enum key to {@link GuildPremiumTier} enum value
* @param {string|GuildPremiumTier} key The key to lookup
* @returns {GuildPremiumTier}
*/
static resolveGuildPremiumTier(key) {
switch (key) {
case 'NONE':
return GuildPremiumTier.None;
case 'TIER_1':
return GuildPremiumTier.Tier1;
case 'TIER_2':
return GuildPremiumTier.Tier2;
case 'TIER_3':
return GuildPremiumTier.Tier3;
default:
return unknownKeyStrategy(key);
}
}
/**
* Resolves enum key to {@link GuildScheduledEventStatus} enum value
* @param {string|GuildScheduledEventStatus} key The key to lookup
* @returns {GuildScheduledEventStatus}
*/
static resolveGuildScheduledEventStatus(key) {
switch (key) {
case 'SCHEDULED':
return GuildScheduledEventStatus.Scheduled;
case 'ACTIVE':
return GuildScheduledEventStatus.Active;
case 'COMPLETED':
return GuildScheduledEventStatus.Completed;
case 'CANCELED':
return GuildScheduledEventStatus.Canceled;
default:
return unknownKeyStrategy(key);
}
}
/**
* Resolves enum key to {@link StageInstancePrivacyLevel} enum value
* @param {string|StageInstancePrivacyLevel} key The key to lookup
* @returns {StageInstancePrivacyLevel}
*/
static resolveStageInstancePrivacyLevel(key) {
switch (key) {
case 'PUBLIC':
return StageInstancePrivacyLevel.Public;
case 'GUILD_ONLY':
return StageInstancePrivacyLevel.GuildOnly;
default:
return unknownKeyStrategy(key);
}
}
/**
* Resolves enum key to {@link GuildMFALevel} enum value
* @param {string|GuildMFALevel} key The key to lookup
* @returns {GuildMFALevel}
*/
static resolveGuildMFALevel(key) {
switch (key) {
case 'NONE':
return GuildMFALevel.None;
case 'ELEVATED':
return GuildMFALevel.Elevated;
default:
return unknownKeyStrategy(key);
}
}
/**
* Resolves enum key to {@link TeamMemberMembershipState} enum value
* @param {string|TeamMemberMembershipState} key The key to lookup
* @returns {TeamMemberMembershipState}
*/
static resolveTeamMemberMembershipState(key) {
switch (key) {
case 'INVITED':
return TeamMemberMembershipState.Invited;
case 'ACCEPTED':
return TeamMemberMembershipState.Accepted;
default:
return unknownKeyStrategy(key);
}
}
/**
* Resolves enum key to {@link GuildScheduledEventEntityType} enum value
* @param {string|GuildScheduledEventEntityType} key The key to lookup
* @returns {GuildScheduledEventEntityType}
*/
static resolveGuildScheduledEventEntityType(key) {
switch (key) {
case 'STAGE_INSTANCE':
return GuildScheduledEventEntityType.StageInstance;
case 'VOICE':
return GuildScheduledEventEntityType.Voice;
case 'EXTERNAL':
return GuildScheduledEventEntityType.External;
default:
return unknownKeyStrategy(key);
}
}
} }
// Precondition logic wrapper // Precondition logic wrapper

View File

@@ -31,7 +31,6 @@ import {
APIApplicationCommand, APIApplicationCommand,
APIApplicationCommandInteractionData, APIApplicationCommandInteractionData,
APIApplicationCommandOption, APIApplicationCommandOption,
APIApplicationCommandPermission,
APIAuditLogChange, APIAuditLogChange,
APIButtonComponent, APIButtonComponent,
APIEmbed, APIEmbed,
@@ -58,7 +57,6 @@ import {
GuildNSFWLevel, GuildNSFWLevel,
GuildPremiumTier, GuildPremiumTier,
GuildVerificationLevel, GuildVerificationLevel,
InteractionResponseType,
InteractionType, InteractionType,
InviteTargetType, InviteTargetType,
MessageType, MessageType,
@@ -68,7 +66,6 @@ import {
StickerFormatType, StickerFormatType,
StickerType, StickerType,
TeamMemberMembershipState, TeamMemberMembershipState,
UserPremiumType,
WebhookType, WebhookType,
OverwriteType, OverwriteType,
GuildExplicitContentFilter, GuildExplicitContentFilter,
@@ -77,11 +74,9 @@ import {
ApplicationCommandOptionType, ApplicationCommandOptionType,
ApplicationCommandType, ApplicationCommandType,
ActivityType, ActivityType,
AuditLogEvent,
GuildScheduledEventEntityType, GuildScheduledEventEntityType,
GuildScheduledEventPrivacyLevel, GuildScheduledEventPrivacyLevel,
GuildScheduledEventStatus, GuildScheduledEventStatus,
RESTJSONErrorCodes,
} from 'discord-api-types/v9'; } from 'discord-api-types/v9';
import { ChildProcess } from 'node:child_process'; import { ChildProcess } from 'node:child_process';
import { EventEmitter } from 'node:events'; import { EventEmitter } from 'node:events';
@@ -189,10 +184,10 @@ export abstract class AnonymousGuild extends BaseGuild {
protected constructor(client: Client, data: RawAnonymousGuildData, immediatePatch?: boolean); protected constructor(client: Client, data: RawAnonymousGuildData, immediatePatch?: boolean);
public banner: string | null; public banner: string | null;
public description: string | null; public description: string | null;
public nsfwLevel: GuildNSFWLevelKey; public nsfwLevel: GuildNSFWLevel;
public splash: string | null; public splash: string | null;
public vanityURLCode: string | null; public vanityURLCode: string | null;
public verificationLevel: GuildVerificationLevelKey; public verificationLevel: GuildVerificationLevel;
public bannerURL(options?: ImageURLOptions): string | null; public bannerURL(options?: ImageURLOptions): string | null;
public splashURL(options?: ImageURLOptions): string | null; public splashURL(options?: ImageURLOptions): string | null;
} }
@@ -468,7 +463,7 @@ export class ButtonInteraction<Cached extends CacheType = CacheType> extends Mes
ButtonComponent | APIButtonComponent, ButtonComponent | APIButtonComponent,
ButtonComponent | APIButtonComponent ButtonComponent | APIButtonComponent
>; >;
public componentType: 'Button'; public componentType: ComponentType.Button;
public inGuild(): this is ButtonInteraction<'raw' | 'cached'>; public inGuild(): this is ButtonInteraction<'raw' | 'cached'>;
public inCachedGuild(): this is ButtonInteraction<'cached'>; public inCachedGuild(): this is ButtonInteraction<'cached'>;
public inRawGuild(): this is ButtonInteraction<'raw'>; public inRawGuild(): this is ButtonInteraction<'raw'>;
@@ -844,6 +839,20 @@ export class EnumResolvers extends null {
public static resolveComponentType(key: string | ComponentType): ComponentType; public static resolveComponentType(key: string | ComponentType): ComponentType;
public static resolveButtonStyle(key: string | ButtonStyle): ButtonStyle; public static resolveButtonStyle(key: string | ButtonStyle): ButtonStyle;
public static resolveMessageType(key: string | MessageType): MessageType; public static resolveMessageType(key: string | MessageType): MessageType;
public static resolveGuildNSFWLevel(key: string | GuildNSFWLevel): GuildNSFWLevel;
public static resolveGuildVerificationLevel(key: string | GuildVerificationLevel): GuildVerificationLevel;
public static resolveGuildDefaultMessageNotifications(
key: string | GuildDefaultMessageNotifications,
): GuildDefaultMessageNotifications;
public static resolveGuildExplicitContentFilter(key: string | GuildExplicitContentFilter): GuildExplicitContentFilter;
public static resolveGuildPremiumTier(key: string | GuildPremiumTier): GuildPremiumTier;
public static resolveGuildScheduledEventStatus(key: string | GuildScheduledEventStatus): GuildScheduledEventStatus;
public static resolveStageInstancePrivacyLevel(key: string | StageInstancePrivacyLevel): StageInstancePrivacyLevel;
public static resolveGuildMFALevel(key: string | GuildMFALevel): GuildMFALevel;
public static resolveTeamMemberMembershipState(key: string | TeamMemberMembershipState): TeamMemberMembershipState;
public static resolveGuildScheduledEventEntityType(
key: string | GuildScheduledEventEntityType,
): GuildScheduledEventEntityType;
} }
export class DiscordAPIError extends Error { export class DiscordAPIError extends Error {
@@ -893,10 +902,10 @@ export class Guild extends AnonymousGuild {
public bans: GuildBanManager; public bans: GuildBanManager;
public channels: GuildChannelManager; public channels: GuildChannelManager;
public commands: GuildApplicationCommandManager; public commands: GuildApplicationCommandManager;
public defaultMessageNotifications: GuildDefaultMessageNotificationsKey | number; public defaultMessageNotifications: GuildDefaultMessageNotifications;
public discoverySplash: string | null; public discoverySplash: string | null;
public emojis: GuildEmojiManager; public emojis: GuildEmojiManager;
public explicitContentFilter: GuildExplicitContentFilterKey; public explicitContentFilter: GuildExplicitContentFilter;
public invites: GuildInviteManager; public invites: GuildInviteManager;
public readonly joinedAt: Date; public readonly joinedAt: Date;
public joinedTimestamp: number; public joinedTimestamp: number;
@@ -911,7 +920,7 @@ export class Guild extends AnonymousGuild {
public preferredLocale: string; public preferredLocale: string;
public premiumSubscriptionCount: number | null; public premiumSubscriptionCount: number | null;
public premiumProgressBarEnabled: boolean; public premiumProgressBarEnabled: boolean;
public premiumTier: PremiumTier; public premiumTier: GuildPremiumTier;
public presences: PresenceManager; public presences: PresenceManager;
public readonly publicUpdatesChannel: TextChannel | null; public readonly publicUpdatesChannel: TextChannel | null;
public publicUpdatesChannelId: Snowflake | null; public publicUpdatesChannelId: Snowflake | null;
@@ -956,17 +965,14 @@ export class Guild extends AnonymousGuild {
public setAFKTimeout(afkTimeout: number, reason?: string): Promise<Guild>; public setAFKTimeout(afkTimeout: number, reason?: string): Promise<Guild>;
public setBanner(banner: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>; public setBanner(banner: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
public setDefaultMessageNotifications( public setDefaultMessageNotifications(
defaultMessageNotifications: GuildDefaultMessageNotificationsKey | number, defaultMessageNotifications: GuildDefaultMessageNotifications,
reason?: string, reason?: string,
): Promise<Guild>; ): Promise<Guild>;
public setDiscoverySplash( public setDiscoverySplash(
discoverySplash: BufferResolvable | Base64Resolvable | null, discoverySplash: BufferResolvable | Base64Resolvable | null,
reason?: string, reason?: string,
): Promise<Guild>; ): Promise<Guild>;
public setExplicitContentFilter( public setExplicitContentFilter(explicitContentFilter: GuildExplicitContentFilter, reason?: string): Promise<Guild>;
explicitContentFilter: GuildExplicitContentFilterKey | number,
reason?: string,
): Promise<Guild>;
public setIcon(icon: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>; public setIcon(icon: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
public setName(name: string, reason?: string): Promise<Guild>; public setName(name: string, reason?: string): Promise<Guild>;
public setOwner(owner: GuildMemberResolvable, reason?: string): Promise<Guild>; public setOwner(owner: GuildMemberResolvable, reason?: string): Promise<Guild>;
@@ -976,7 +982,7 @@ export class Guild extends AnonymousGuild {
public setSplash(splash: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>; public setSplash(splash: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
public setSystemChannel(systemChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>; public setSystemChannel(systemChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
public setSystemChannelFlags(systemChannelFlags: SystemChannelFlagsResolvable, reason?: string): Promise<Guild>; public setSystemChannelFlags(systemChannelFlags: SystemChannelFlagsResolvable, reason?: string): Promise<Guild>;
public setVerificationLevel(verificationLevel: GuildVerificationLevelKey | number, reason?: string): Promise<Guild>; public setVerificationLevel(verificationLevel: GuildVerificationLevel, reason?: string): Promise<Guild>;
public setPremiumProgressBarEnabled(enabled?: boolean, reason?: string): Promise<Guild>; public setPremiumProgressBarEnabled(enabled?: boolean, reason?: string): Promise<Guild>;
public setWidgetSettings(settings: GuildWidgetSettingsData, reason?: string): Promise<Guild>; public setWidgetSettings(settings: GuildWidgetSettingsData, reason?: string): Promise<Guild>;
public toJSON(): unknown; public toJSON(): unknown;
@@ -1161,7 +1167,7 @@ export class GuildPreview extends Base {
public toString(): string; public toString(): string;
} }
export class GuildScheduledEvent<S extends GuildScheduledEventStatusKey = GuildScheduledEventStatusKey> extends Base { export class GuildScheduledEvent<S extends GuildScheduledEventStatus = GuildScheduledEventStatus> extends Base {
private constructor(client: Client, data: RawGuildScheduledEventData); private constructor(client: Client, data: RawGuildScheduledEventData);
public id: Snowflake; public id: Snowflake;
public guildId: Snowflake; public guildId: Snowflake;
@@ -1203,10 +1209,10 @@ export class GuildScheduledEvent<S extends GuildScheduledEventStatusKey = GuildS
options?: T, options?: T,
): Promise<GuildScheduledEventManagerFetchSubscribersResult<T>>; ): Promise<GuildScheduledEventManagerFetchSubscribersResult<T>>;
public toString(): string; public toString(): string;
public isActive(): this is GuildScheduledEvent<'Active'>; public isActive(): this is GuildScheduledEvent<GuildScheduledEventStatus.Active>;
public isCanceled(): this is GuildScheduledEvent<'Canceled'>; public isCanceled(): this is GuildScheduledEvent<GuildScheduledEventStatus.Canceled>;
public isCompleted(): this is GuildScheduledEvent<'Completed'>; public isCompleted(): this is GuildScheduledEvent<GuildScheduledEventStatus.Completed>;
public isScheduled(): this is GuildScheduledEvent<'Scheduled'>; public isScheduled(): this is GuildScheduledEvent<GuildScheduledEventStatus.Scheduled>;
} }
export class GuildTemplate extends Base { export class GuildTemplate extends Base {
@@ -1587,7 +1593,7 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
ActionRowComponent | Exclude<APIMessageComponent, APIActionRowComponent>, ActionRowComponent | Exclude<APIMessageComponent, APIActionRowComponent>,
ActionRowComponent | Exclude<APIMessageComponent, APIActionRowComponent> ActionRowComponent | Exclude<APIMessageComponent, APIActionRowComponent>
>; >;
public componentType: Exclude<keyof typeof ComponentType, 'ActionRow'>; public componentType: Exclude<ComponentType, ComponentType.ActionRow>;
public customId: string; public customId: string;
public channelId: Snowflake; public channelId: Snowflake;
public deferred: boolean; public deferred: boolean;
@@ -1854,7 +1860,7 @@ export class SelectMenuInteraction<Cached extends CacheType = CacheType> extends
SelectMenuComponent | APISelectMenuComponent, SelectMenuComponent | APISelectMenuComponent,
SelectMenuComponent | APISelectMenuComponent SelectMenuComponent | APISelectMenuComponent
>; >;
public componentType: 'SelectMenu'; public componentType: ComponentType.SelectMenu;
public values: string[]; public values: string[];
public inGuild(): this is SelectMenuInteraction<'raw' | 'cached'>; public inGuild(): this is SelectMenuInteraction<'raw' | 'cached'>;
public inCachedGuild(): this is SelectMenuInteraction<'cached'>; public inCachedGuild(): this is SelectMenuInteraction<'cached'>;
@@ -1999,7 +2005,7 @@ export class StageInstance extends Base {
public guildId: Snowflake; public guildId: Snowflake;
public channelId: Snowflake; public channelId: Snowflake;
public topic: string; public topic: string;
public privacyLevel: StageInstancePrivacyLevelKey; public privacyLevel: StageInstancePrivacyLevel;
/** @deprecated See https://github.com/discord/discord-api-docs/pull/4296 for more information */ /** @deprecated See https://github.com/discord/discord-api-docs/pull/4296 for more information */
public discoverableDisabled: boolean | null; public discoverableDisabled: boolean | null;
public readonly channel: StageChannel | null; public readonly channel: StageChannel | null;
@@ -2152,7 +2158,7 @@ export class TeamMember extends Base {
public team: Team; public team: Team;
public readonly id: Snowflake; public readonly id: Snowflake;
public permissions: string[]; public permissions: string[];
public membershipState: TeamMemberMembershipStateKey; public membershipState: TeamMemberMembershipState;
public user: User; public user: User;
public toString(): UserMention; public toString(): UserMention;
@@ -2917,7 +2923,7 @@ export class GuildScheduledEventManager extends CachedManager<
public fetch< public fetch<
T extends GuildScheduledEventResolvable | FetchGuildScheduledEventOptions | FetchGuildScheduledEventsOptions, T extends GuildScheduledEventResolvable | FetchGuildScheduledEventOptions | FetchGuildScheduledEventsOptions,
>(options?: T): Promise<GuildScheduledEventManagerFetchResult<T>>; >(options?: T): Promise<GuildScheduledEventManagerFetchResult<T>>;
public edit<S extends GuildScheduledEventStatusKey, T extends GuildScheduledEventSetStatusArg<S>>( public edit<S extends GuildScheduledEventStatus, T extends GuildScheduledEventSetStatusArg<S>>(
guildScheduledEvent: GuildScheduledEventResolvable, guildScheduledEvent: GuildScheduledEventResolvable,
options: GuildScheduledEventEditOptions<S, T>, options: GuildScheduledEventEditOptions<S, T>,
): Promise<GuildScheduledEvent<T>>; ): Promise<GuildScheduledEvent<T>>;
@@ -3238,16 +3244,16 @@ export interface BaseApplicationCommandOptionsData {
} }
export interface UserApplicationCommandData extends BaseApplicationCommandData { export interface UserApplicationCommandData extends BaseApplicationCommandData {
type: 'User' | ApplicationCommandType.User; type: ApplicationCommandType.User;
} }
export interface MessageApplicationCommandData extends BaseApplicationCommandData { export interface MessageApplicationCommandData extends BaseApplicationCommandData {
type: 'Message' | ApplicationCommandType.Message; type: ApplicationCommandType.Message;
} }
export interface ChatInputApplicationCommandData extends BaseApplicationCommandData { export interface ChatInputApplicationCommandData extends BaseApplicationCommandData {
description: string; description: string;
type?: 'ChatInput' | ApplicationCommandType.ChatInput; type?: ApplicationCommandType.ChatInput;
options?: ApplicationCommandOptionData[]; options?: ApplicationCommandOptionData[];
} }
@@ -3258,20 +3264,17 @@ export type ApplicationCommandData =
export interface ApplicationCommandChannelOptionData extends BaseApplicationCommandOptionsData { export interface ApplicationCommandChannelOptionData extends BaseApplicationCommandOptionsData {
type: CommandOptionChannelResolvableType; type: CommandOptionChannelResolvableType;
channelTypes?: (keyof typeof ChannelType)[]; channelTypes?: ChannelType[];
channel_types?: (keyof typeof ChannelType)[]; channel_types?: ChannelType[];
} }
export interface ApplicationCommandChannelOption extends BaseApplicationCommandOptionsData { export interface ApplicationCommandChannelOption extends BaseApplicationCommandOptionsData {
type: ApplicationCommandOptionType.Channel; type: ApplicationCommandOptionType.Channel;
channelTypes?: (keyof typeof ChannelType)[]; channelTypes?: ChannelType[];
} }
export interface ApplicationCommandAutocompleteOption extends Omit<BaseApplicationCommandOptionsData, 'autocomplete'> { export interface ApplicationCommandAutocompleteOption extends Omit<BaseApplicationCommandOptionsData, 'autocomplete'> {
type: type:
| 'String'
| 'Number'
| 'Integer'
| ApplicationCommandOptionType.String | ApplicationCommandOptionType.String
| ApplicationCommandOptionType.Number | ApplicationCommandOptionType.Number
| ApplicationCommandOptionType.Integer; | ApplicationCommandOptionType.Integer;
@@ -3305,17 +3308,17 @@ export interface ApplicationCommandNumericOption extends ApplicationCommandChoic
} }
export interface ApplicationCommandSubGroupData extends Omit<BaseApplicationCommandOptionsData, 'required'> { export interface ApplicationCommandSubGroupData extends Omit<BaseApplicationCommandOptionsData, 'required'> {
type: 'SubcommandGroup' | ApplicationCommandOptionType.SubcommandGroup; type: ApplicationCommandOptionType.SubcommandGroup;
options?: ApplicationCommandSubCommandData[]; options?: ApplicationCommandSubCommandData[];
} }
export interface ApplicationCommandSubGroup extends Omit<BaseApplicationCommandOptionsData, 'required'> { export interface ApplicationCommandSubGroup extends Omit<BaseApplicationCommandOptionsData, 'required'> {
type: 'SubcommandGroup'; type: ApplicationCommandOptionType.SubcommandGroup;
options?: ApplicationCommandSubCommand[]; options?: ApplicationCommandSubCommand[];
} }
export interface ApplicationCommandSubCommandData extends Omit<BaseApplicationCommandOptionsData, 'required'> { export interface ApplicationCommandSubCommandData extends Omit<BaseApplicationCommandOptionsData, 'required'> {
type: 'Subcommand' | ApplicationCommandOptionType.Subcommand; type: ApplicationCommandOptionType.Subcommand;
options?: ( options?: (
| ApplicationCommandChoicesData | ApplicationCommandChoicesData
| ApplicationCommandNonOptionsData | ApplicationCommandNonOptionsData
@@ -3326,7 +3329,7 @@ export interface ApplicationCommandSubCommandData extends Omit<BaseApplicationCo
} }
export interface ApplicationCommandSubCommand extends Omit<BaseApplicationCommandOptionsData, 'required'> { export interface ApplicationCommandSubCommand extends Omit<BaseApplicationCommandOptionsData, 'required'> {
type: 'Subcommand'; type: ApplicationCommandOptionType.Subcommand;
options?: (ApplicationCommandChoicesOption | ApplicationCommandNonOptions | ApplicationCommandChannelOption)[]; options?: (ApplicationCommandChoicesOption | ApplicationCommandNonOptions | ApplicationCommandChannelOption)[];
} }
@@ -3893,20 +3896,18 @@ export interface CreateRoleOptions extends RoleData {
export interface StageInstanceCreateOptions { export interface StageInstanceCreateOptions {
topic: string; topic: string;
privacyLevel?: StageInstancePrivacyLevelKey | number; privacyLevel?: StageInstancePrivacyLevel;
} }
export interface CrosspostedChannel { export interface CrosspostedChannel {
channelId: Snowflake; channelId: Snowflake;
guildId: Snowflake; guildId: Snowflake;
type: keyof typeof ChannelType; type: ChannelType;
name: string; name: string;
} }
export type DateResolvable = Date | number | string; export type DateResolvable = Date | number | string;
export type GuildDefaultMessageNotificationsKey = keyof typeof GuildDefaultMessageNotifications;
export interface EditGuildTemplateOptions { export interface EditGuildTemplateOptions {
name?: string; name?: string;
description?: string; description?: string;
@@ -3958,8 +3959,6 @@ export interface EscapeMarkdownOptions {
codeBlockContent?: boolean; codeBlockContent?: boolean;
} }
export type GuildExplicitContentFilterKey = keyof typeof GuildExplicitContentFilter;
export interface FetchApplicationCommandOptions extends BaseFetchOptions { export interface FetchApplicationCommandOptions extends BaseFetchOptions {
guildId?: Snowflake; guildId?: Snowflake;
} }
@@ -4257,13 +4256,13 @@ export interface GuildCreateOptions {
afkChannelId?: Snowflake | number; afkChannelId?: Snowflake | number;
afkTimeout?: number; afkTimeout?: number;
channels?: PartialChannelData[]; channels?: PartialChannelData[];
defaultMessageNotifications?: GuildDefaultMessageNotificationsKey | number; defaultMessageNotifications?: GuildDefaultMessageNotifications;
explicitContentFilter?: GuildExplicitContentFilterKey | number; explicitContentFilter?: GuildExplicitContentFilter;
icon?: BufferResolvable | Base64Resolvable | null; icon?: BufferResolvable | Base64Resolvable | null;
roles?: PartialRoleData[]; roles?: PartialRoleData[];
systemChannelFlags?: SystemChannelFlagsResolvable; systemChannelFlags?: SystemChannelFlagsResolvable;
systemChannelId?: Snowflake | number; systemChannelId?: Snowflake | number;
verificationLevel?: GuildVerificationLevelKey | number; verificationLevel?: GuildVerificationLevel;
} }
export interface GuildWidgetSettings { export interface GuildWidgetSettings {
@@ -4273,9 +4272,9 @@ export interface GuildWidgetSettings {
export interface GuildEditData { export interface GuildEditData {
name?: string; name?: string;
verificationLevel?: GuildVerificationLevelKey | number; verificationLevel?: GuildVerificationLevel;
explicitContentFilter?: GuildExplicitContentFilterKey | number; explicitContentFilter?: GuildExplicitContentFilter;
defaultMessageNotifications?: GuildDefaultMessageNotificationsKey | number; defaultMessageNotifications?: GuildDefaultMessageNotifications;
afkChannel?: VoiceChannelResolvable; afkChannel?: VoiceChannelResolvable;
systemChannel?: TextChannelResolvable; systemChannel?: TextChannelResolvable;
systemChannelFlags?: SystemChannelFlagsResolvable; systemChannelFlags?: SystemChannelFlagsResolvable;
@@ -4390,7 +4389,7 @@ export interface GuildScheduledEventCreateOptions {
} }
export interface GuildScheduledEventEditOptions< export interface GuildScheduledEventEditOptions<
S extends GuildScheduledEventStatusKey, S extends GuildScheduledEventStatus,
T extends GuildScheduledEventSetStatusArg<S>, T extends GuildScheduledEventSetStatusArg<S>,
> extends Omit<Partial<GuildScheduledEventCreateOptions>, 'channel'> { > extends Omit<Partial<GuildScheduledEventCreateOptions>, 'channel'> {
channel?: GuildVoiceChannelResolvable | null; channel?: GuildVoiceChannelResolvable | null;
@@ -4418,13 +4417,12 @@ export type GuildScheduledEventManagerFetchSubscribersResult<T extends FetchGuil
export type GuildScheduledEventResolvable = Snowflake | GuildScheduledEvent; export type GuildScheduledEventResolvable = Snowflake | GuildScheduledEvent;
export type GuildScheduledEventSetStatusArg<T extends GuildScheduledEventStatusKey> = T extends 'Scheduled' export type GuildScheduledEventSetStatusArg<T extends GuildScheduledEventStatus> =
? 'Active' | 'Canceled' T extends GuildScheduledEventStatus.Scheduled
: T extends 'Active' ? GuildScheduledEventStatus.Active | GuildScheduledEventStatus.Canceled
? 'Completed' : T extends GuildScheduledEventStatus.Active
: never; ? GuildScheduledEventStatus.Completed
: never;
export type GuildScheduledEventStatusKey = keyof typeof GuildScheduledEventStatus;
export interface GuildScheduledEventUser<T> { export interface GuildScheduledEventUser<T> {
guildScheduledEventId: Snowflake; guildScheduledEventId: Snowflake;
@@ -4578,8 +4576,6 @@ export interface MakeErrorOptions {
export type MemberMention = UserMention | `<@!${Snowflake}>`; export type MemberMention = UserMention | `<@!${Snowflake}>`;
export type TeamMemberMembershipStateKey = keyof typeof TeamMemberMembershipState;
export type ActionRowComponentOptions = export type ActionRowComponentOptions =
| (Required<BaseMessageComponentOptions> & MessageButtonOptions) | (Required<BaseMessageComponentOptions> & MessageButtonOptions)
| (Required<BaseMessageComponentOptions> & MessageSelectMenuOptions); | (Required<BaseMessageComponentOptions> & MessageSelectMenuOptions);
@@ -4763,8 +4759,6 @@ export interface MultipleShardSpawnOptions {
timeout?: number; timeout?: number;
} }
export type GuildNSFWLevelKey = keyof typeof GuildNSFWLevel;
export interface OverwriteData { export interface OverwriteData {
allow?: PermissionResolvable; allow?: PermissionResolvable;
deny?: PermissionResolvable; deny?: PermissionResolvable;
@@ -4833,8 +4827,6 @@ export interface PartialRecipient {
username: string; username: string;
} }
export type PremiumTier = keyof typeof GuildPremiumTier;
export interface PresenceData { export interface PresenceData {
status?: PresenceStatusData; status?: PresenceStatusData;
afk?: boolean; afk?: boolean;
@@ -4911,8 +4903,6 @@ export type PresenceStatusData = ClientPresenceStatus | 'invisible';
export type PresenceStatus = PresenceStatusData | 'offline'; export type PresenceStatus = PresenceStatusData | 'offline';
export type StageInstancePrivacyLevelKey = keyof typeof StageInstancePrivacyLevel;
export interface RateLimitData { export interface RateLimitData {
timeout: number; timeout: number;
limit: number; limit: number;
@@ -5020,12 +5010,8 @@ export interface StartThreadOptions {
export type Status = number; export type Status = number;
export type StickerFormatKey = keyof typeof StickerFormatType;
export type StickerResolvable = Sticker | Snowflake; export type StickerResolvable = Sticker | Snowflake;
export type StickerKey = keyof typeof StickerType;
export type SystemChannelFlagsString = export type SystemChannelFlagsString =
| 'SUPPRESS_JOIN_NOTIFICATIONS' | 'SUPPRESS_JOIN_NOTIFICATIONS'
| 'SUPPRESS_PREMIUM_SUBSCRIPTIONS' | 'SUPPRESS_PREMIUM_SUBSCRIPTIONS'
@@ -5043,7 +5029,7 @@ export type StageChannelResolvable = StageChannel | Snowflake;
export interface StageInstanceEditOptions { export interface StageInstanceEditOptions {
topic?: string; topic?: string;
privacyLevel?: StageInstancePrivacyLevelKey | number; privacyLevel?: StageInstancePrivacyLevel;
} }
export type SweeperKey = keyof SweeperDefinitions; export type SweeperKey = keyof SweeperDefinitions;
@@ -5168,8 +5154,6 @@ export interface Vanity {
uses: number; uses: number;
} }
export type GuildVerificationLevelKey = keyof typeof GuildVerificationLevel;
export type VoiceBasedChannelTypes = VoiceBasedChannel['type']; export type VoiceBasedChannelTypes = VoiceBasedChannel['type'];
export type VoiceChannelResolvable = Snowflake | VoiceChannel; export type VoiceChannelResolvable = Snowflake | VoiceChannel;

View File

@@ -891,7 +891,7 @@ declare const applicationNonChoiceOptionData: ApplicationCommandOptionData & {
declare const applicationSubGroupCommandData: ApplicationCommandSubGroupData; declare const applicationSubGroupCommandData: ApplicationCommandSubGroupData;
{ {
expectType<'SubcommandGroup' | ApplicationCommandOptionType.SubcommandGroup>(applicationSubGroupCommandData.type); expectType<ApplicationCommandOptionType.SubcommandGroup>(applicationSubGroupCommandData.type);
expectType<ApplicationCommandSubCommandData[] | undefined>(applicationSubGroupCommandData.options); expectType<ApplicationCommandSubCommandData[] | undefined>(applicationSubGroupCommandData.options);
} }