mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat(enumResolvers): strengthen typings (#7344)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const { InviteTargetType } = require('discord-api-types/v9');
|
||||
const CachedManager = require('./CachedManager');
|
||||
const { Error } = require('../errors');
|
||||
const Invite = require('../structures/Invite');
|
||||
@@ -191,7 +190,7 @@ class GuildInviteManager extends CachedManager {
|
||||
unique,
|
||||
target_user_id: this.client.users.resolveId(targetUser),
|
||||
target_application_id: targetApplication?.id ?? targetApplication?.applicationId ?? targetApplication,
|
||||
target_type: InviteTargetType[targetType],
|
||||
target_type: targetType,
|
||||
},
|
||||
reason,
|
||||
});
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
const Base = require('./Base');
|
||||
const IntegrationApplication = require('./IntegrationApplication');
|
||||
const { IntegrationExpireBehaviors } = require('../util/Constants');
|
||||
|
||||
/**
|
||||
* The information account for an integration
|
||||
@@ -156,7 +155,7 @@ class Integration extends Base {
|
||||
* The behavior of expiring subscribers
|
||||
* @type {?IntegrationExpireBehavior}
|
||||
*/
|
||||
this.expireBehavior = IntegrationExpireBehaviors[data.expire_behavior];
|
||||
this.expireBehavior = data.expire_behavior;
|
||||
} else {
|
||||
this.expireBehavior ??= null;
|
||||
}
|
||||
|
||||
@@ -377,15 +377,6 @@ exports.InviteScopes = [
|
||||
'webhook.incoming',
|
||||
];
|
||||
|
||||
/**
|
||||
* The behavior of expiring subscribers for Integrations. This can be:
|
||||
* * REMOVE_ROLE
|
||||
* * KICK
|
||||
* @typedef {string} IntegrationExpireBehavior
|
||||
* @see {@link https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors}
|
||||
*/
|
||||
exports.IntegrationExpireBehaviors = createEnum(['REMOVE_ROLE', 'KICK']);
|
||||
|
||||
/**
|
||||
* The name of an item to be swept in Sweepers
|
||||
* * `applicationCommands` - both global and guild commands
|
||||
@@ -526,16 +517,6 @@ function keyMirror(arr) {
|
||||
return tmp;
|
||||
}
|
||||
|
||||
function createEnum(keys) {
|
||||
const obj = {};
|
||||
for (const [index, key] of keys.entries()) {
|
||||
if (key === null) continue;
|
||||
obj[key] = index;
|
||||
obj[index] = key;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} Constants Constants that can be used in an enum or object-like way.
|
||||
* @property {Status} Status The available statuses of the client.
|
||||
|
||||
@@ -19,6 +19,7 @@ const {
|
||||
GuildMFALevel,
|
||||
TeamMemberMembershipState,
|
||||
GuildScheduledEventEntityType,
|
||||
IntegrationExpireBehavior,
|
||||
} = require('discord-api-types/v9');
|
||||
|
||||
function unknownKeyStrategy(val) {
|
||||
@@ -26,9 +27,24 @@ function unknownKeyStrategy(val) {
|
||||
}
|
||||
|
||||
class EnumResolvers extends null {
|
||||
/**
|
||||
* A string that can be resolved to a {@link ChannelType} enum value. Here are the available types:
|
||||
* * GUILD_TEXT
|
||||
* * DM
|
||||
* * GUILD_VOICE
|
||||
* * GROUP_DM
|
||||
* * GUILD_CATEGORY
|
||||
* * GUILD_NEWS
|
||||
* * GUILD_NEWS_THREAD
|
||||
* * GUILD_PUBLIC_THREAD
|
||||
* * GUILD_PRIVATE_THREAD
|
||||
* * GUILD_STAGE_VOICE
|
||||
* @typedef {string} ChannelTypeEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link ChannelType} enum value
|
||||
* @param {string|ChannelType} key The key to resolve
|
||||
* @param {ChannelTypeEnumResolvable|ChannelType} key The key to resolve
|
||||
* @returns {ChannelType}
|
||||
*/
|
||||
static resolveChannelType(key) {
|
||||
@@ -58,9 +74,18 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to an {@link InteractionType} enum value. Here are the available types:
|
||||
* * PING
|
||||
* * APPLICATION_COMMAND
|
||||
* * MESSAGE_COMPONENT
|
||||
* * APPLICATION_COMMAND_AUTOCOMPLETE
|
||||
* @typedef {string} InteractionTypeEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link InteractionType} enum value
|
||||
* @param {string|InteractionType} key The key to resolve
|
||||
* @param {InteractionTypeEnumResolvable|InteractionType} key The key to resolve
|
||||
* @returns {InteractionType}
|
||||
*/
|
||||
static resolveInteractionType(key) {
|
||||
@@ -78,9 +103,17 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to an {@link ApplicationCommandType} enum value. Here are the available types:
|
||||
* * CHAT_INPUT
|
||||
* * USER
|
||||
* * MESSAGE
|
||||
* @typedef {string} ApplicationCommandTypeEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link ApplicationCommandType} enum value
|
||||
* @param {string|ApplicationCommandType} key The key to resolve
|
||||
* @param {ApplicationCommandTypeEnumResolvable|ApplicationCommandType} key The key to resolve
|
||||
* @returns {ApplicationCommandType}
|
||||
*/
|
||||
static resolveApplicationCommandType(key) {
|
||||
@@ -96,9 +129,24 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to an {@link ApplicationCommandOptionType} enum value. Here are the available types:
|
||||
* * SUB_COMMAND
|
||||
* * SUB_COMMAND_GROUP
|
||||
* * STRING
|
||||
* * INTEGER
|
||||
* * BOOLEAN
|
||||
* * USER
|
||||
* * CHANNEL
|
||||
* * ROLE
|
||||
* * NUMBER
|
||||
* * MENTIONABLE
|
||||
* @typedef {string} ApplicationCommandOptionTypeEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link ApplicationCommandOptionType} enum value
|
||||
* @param {string|ApplicationCommandOptionType} key The key to resolve
|
||||
* @param {ApplicationCommandOptionTypeEnumResolvable|ApplicationCommandOptionType} key The key to resolve
|
||||
* @returns {ApplicationCommandOptionType}
|
||||
*/
|
||||
static resolveApplicationCommandOptionType(key) {
|
||||
@@ -128,9 +176,17 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to an {@link ApplicationCommandPermissionType} enum value.
|
||||
* Here are the available types:
|
||||
* * ROLE
|
||||
* * USER
|
||||
* @typedef {string} ApplicationCommandPermissionTypeEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link ApplicationCommandPermissionType} enum value
|
||||
* @param {string|ApplicationCommandPermissionType} key The key to resolve
|
||||
* @param {ApplicationCommandPermissionTypeEnumResolvable|ApplicationCommandPermissionType} key The key to resolve
|
||||
* @returns {ApplicationCommandPermissionType}
|
||||
*/
|
||||
static resolveApplicationCommandPermissionType(key) {
|
||||
@@ -144,9 +200,17 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to a {@link ComponentType} enum value. Here are the available types:
|
||||
* * ACTION_ROW
|
||||
* * BUTTON
|
||||
* * SELECT_MENU
|
||||
* @typedef {string} ComponentTypeEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link ComponentType} enum value
|
||||
* @param {string|ComponentType} key The key to resolve
|
||||
* @param {ComponentTypeEnumResolvable|ComponentType} key The key to resolve
|
||||
* @returns {ComponentType}
|
||||
*/
|
||||
static resolveComponentType(key) {
|
||||
@@ -162,9 +226,19 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to a {@link ButtonStyle} enum value. Here are the available types:
|
||||
* * PRIMARY
|
||||
* * SECONDARY
|
||||
* * SUCCESS
|
||||
* * DANGER
|
||||
* * LINK
|
||||
* @typedef {string} ButtonStyleEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link ButtonStyle} enum value
|
||||
* @param {string|ButtonStyle} key The key to resolve
|
||||
* @param {ButtonStyleEnumResolvable|ButtonStyle} key The key to resolve
|
||||
* @returns {ButtonStyle}
|
||||
*/
|
||||
static resolveButtonStyle(key) {
|
||||
@@ -184,9 +258,37 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to a {@link MessageType} enum value. Here are the available types:
|
||||
* * DEFAULT
|
||||
* * RECIPIENT_ADD
|
||||
* * RECIPIENT_REMOVE
|
||||
* * CALL
|
||||
* * CHANNEL_NAME_CHANGE
|
||||
* * CHANNEL_ICON_CHANGE
|
||||
* * CHANNEL_PINNED_MESSAGE
|
||||
* * GUILD_MEMBER_JOIN
|
||||
* * USER_PREMIUM_GUILD_SUBSCRIPTION
|
||||
* * USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1
|
||||
* * USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2
|
||||
* * USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3
|
||||
* * CHANNEL_FOLLOW_ADD
|
||||
* * GUILD_DISCOVERY_DISQUALIFIED
|
||||
* * GUILD_DISCOVERY_REQUALIFIED
|
||||
* * GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING
|
||||
* * GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING
|
||||
* * THREAD_CREATED
|
||||
* * REPLY
|
||||
* * CHAT_INPUT_COMMAND
|
||||
* * THREAD_STARTER_MESSAGE
|
||||
* * GUILD_INVITE_REMINDER
|
||||
* * CONTEXT_MENU_COMMAND
|
||||
* @typedef {string} MessageTypeEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link MessageType} enum value
|
||||
* @param {string|MessageType} key The key to lookup
|
||||
* @param {MessageTypeEnumResolvable|MessageType} key The key to lookup
|
||||
* @returns {MessageType}
|
||||
*/
|
||||
static resolveMessageType(key) {
|
||||
@@ -242,9 +344,18 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to a {@link GuildNSFWLevel} enum value. Here are the available types:
|
||||
* * DEFAULT
|
||||
* * EXPLICIT
|
||||
* * SAFE
|
||||
* * AGE_RESTRICTED
|
||||
* @typedef {string} GuildNSFWLevelEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link GuildNSFWLevel} enum value
|
||||
* @param {string|GuildNSFWLevel} key The key to lookup
|
||||
* @param {GuildNSFWLevelEnumResolvable|GuildNSFWLevel} key The key to lookup
|
||||
* @returns {GuildNSFWLevel}
|
||||
*/
|
||||
static resolveGuildNSFWLevel(key) {
|
||||
@@ -262,9 +373,19 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to a {@link GuildVerificationLevel} enum value. Here are the available types:
|
||||
* * NONE
|
||||
* * LOW
|
||||
* * MEDIUM
|
||||
* * HIGH
|
||||
* * VERY_HIGH
|
||||
* @typedef {string} GuildVerificationLevelEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link GuildVerificationLevel} enum value
|
||||
* @param {string|GuildVerificationLevel} key The key to lookup
|
||||
* @param {GuildVerificationLevelEnumResolvable|GuildVerificationLevel} key The key to lookup
|
||||
* @returns {GuildVerificationLevel}
|
||||
*/
|
||||
static resolveGuildVerificationLevel(key) {
|
||||
@@ -284,9 +405,17 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to a {@link GuildDefaultMessageNotifications} enum value.
|
||||
* Here are the available types:
|
||||
* * ALL_MESSAGES
|
||||
* * ONLY_MENTIONS
|
||||
* @typedef {string} GuildDefaultMessageNotificationsEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link GuildDefaultMessageNotifications} enum value
|
||||
* @param {string|GuildDefaultMessageNotifications} key The key to lookup
|
||||
* @param {GuildDefaultMessageNotificationsEnumResolvable|GuildDefaultMessageNotifications} key The key to lookup
|
||||
* @returns {GuildDefaultMessageNotifications}
|
||||
*/
|
||||
static resolveGuildDefaultMessageNotifications(key) {
|
||||
@@ -300,9 +429,17 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to a {@link GuildExplicitContentFilter} enum value. Here are the available types:
|
||||
* * DISABLED
|
||||
* * MEMBERS_WITHOUT_ROLES
|
||||
* * ALL_MEMBERS
|
||||
* @typedef {string} GuildExplicitContentFilterEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link GuildExplicitContentFilter} enum value
|
||||
* @param {string|GuildExplicitContentFilter} key The key to lookup
|
||||
* @param {GuildExplicitContentFilterEnumResolvable|GuildExplicitContentFilter} key The key to lookup
|
||||
* @returns {GuildExplicitContentFilter}
|
||||
*/
|
||||
static resolveGuildExplicitContentFilter(key) {
|
||||
@@ -318,9 +455,18 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to a {@link GuildPremiumTier} enum value. Here are the available types:
|
||||
* * NONE
|
||||
* * TIER_1
|
||||
* * TIER_2
|
||||
* * TIER_3
|
||||
* @typedef {string} GuildPremiumTierEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link GuildPremiumTier} enum value
|
||||
* @param {string|GuildPremiumTier} key The key to lookup
|
||||
* @param {GuildPremiumTierEnumResolvable|GuildPremiumTier} key The key to lookup
|
||||
* @returns {GuildPremiumTier}
|
||||
*/
|
||||
static resolveGuildPremiumTier(key) {
|
||||
@@ -338,9 +484,18 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to a {@link GuildScheduledEventStatus} enum value. Here are the available types:
|
||||
* * SCHEDULED
|
||||
* * ACTIVE
|
||||
* * COMPLETED
|
||||
* * CANCELED
|
||||
* @typedef {string} GuildScheduledEventStatusEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link GuildScheduledEventStatus} enum value
|
||||
* @param {string|GuildScheduledEventStatus} key The key to lookup
|
||||
* @param {GuildScheduledEventStatusEnumResolvable|GuildScheduledEventStatus} key The key to lookup
|
||||
* @returns {GuildScheduledEventStatus}
|
||||
*/
|
||||
static resolveGuildScheduledEventStatus(key) {
|
||||
@@ -358,9 +513,16 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to a {@link StageInstancePrivacyLevel} enum value. Here are the available types:
|
||||
* * PUBLIC
|
||||
* * GUILD_ONLY
|
||||
* @typedef {string} StageInstancePrivacyLevelEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link StageInstancePrivacyLevel} enum value
|
||||
* @param {string|StageInstancePrivacyLevel} key The key to lookup
|
||||
* @param {StageInstancePrivacyLevelEnumResolvable|StageInstancePrivacyLevel} key The key to lookup
|
||||
* @returns {StageInstancePrivacyLevel}
|
||||
*/
|
||||
static resolveStageInstancePrivacyLevel(key) {
|
||||
@@ -374,9 +536,16 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to a {@link GuildMFALevel} enum value. Here are the available types:
|
||||
* * NONE
|
||||
* * ELEVATED
|
||||
* @typedef {string} GuildMFALevelEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link GuildMFALevel} enum value
|
||||
* @param {string|GuildMFALevel} key The key to lookup
|
||||
* @param {GuildMFALevelEnumResolvable|GuildMFALevel} key The key to lookup
|
||||
* @returns {GuildMFALevel}
|
||||
*/
|
||||
static resolveGuildMFALevel(key) {
|
||||
@@ -390,9 +559,16 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to a {@link TeamMemberMembershipState} enum value. Here are the available types:
|
||||
* * INVITED
|
||||
* * ACCEPTED
|
||||
* @typedef {string} TeamMemberMembershipStateEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link TeamMemberMembershipState} enum value
|
||||
* @param {string|TeamMemberMembershipState} key The key to lookup
|
||||
* @param {TeamMemberMembershipStateEnumResolvable|TeamMemberMembershipState} key The key to lookup
|
||||
* @returns {TeamMemberMembershipState}
|
||||
*/
|
||||
static resolveTeamMemberMembershipState(key) {
|
||||
@@ -406,9 +582,17 @@ class EnumResolvers extends null {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to a {@link GuildScheduledEventEntityType} enum value. Here are the available types:
|
||||
* * STAGE_INSTANCE
|
||||
* * VOICE
|
||||
* * EXTERNAL
|
||||
* @typedef {string} GuildScheduledEventEntityTypeEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link GuildScheduledEventEntityType} enum value
|
||||
* @param {string|GuildScheduledEventEntityType} key The key to lookup
|
||||
* @param {GuildScheduledEventEntityTypeEnumResolvable|GuildScheduledEventEntityType} key The key to lookup
|
||||
* @returns {GuildScheduledEventEntityType}
|
||||
*/
|
||||
static resolveGuildScheduledEventEntityType(key) {
|
||||
@@ -423,6 +607,29 @@ class EnumResolvers extends null {
|
||||
return unknownKeyStrategy(key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that can be resolved to a {@link IntegrationExpireBehavior} enum value. Here are the available types:
|
||||
* * REMOVE_ROLE
|
||||
* * KICK
|
||||
* @typedef {string} IntegrationExpireBehaviorEnumResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves enum key to {@link IntegrationExpireBehavior} enum value
|
||||
* @param {IntegrationExpireBehaviorEnumResolvable|IntegrationExpireBehavior} key The key to lookup
|
||||
* @returns {IntegrationExpireBehavior}
|
||||
*/
|
||||
static resolveIntegrationExpireBehavior(key) {
|
||||
switch (key) {
|
||||
case 'REMOVE_ROLE':
|
||||
return IntegrationExpireBehavior.RemoveRole;
|
||||
case 'KICK':
|
||||
return IntegrationExpireBehavior.Kick;
|
||||
default:
|
||||
return unknownKeyStrategy(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Precondition logic wrapper
|
||||
|
||||
142
packages/discord.js/typings/index.d.ts
vendored
142
packages/discord.js/typings/index.d.ts
vendored
@@ -77,6 +77,7 @@ import {
|
||||
GuildScheduledEventEntityType,
|
||||
GuildScheduledEventPrivacyLevel,
|
||||
GuildScheduledEventStatus,
|
||||
IntegrationExpireBehavior,
|
||||
} from 'discord-api-types/v9';
|
||||
import { ChildProcess } from 'node:child_process';
|
||||
import { EventEmitter } from 'node:events';
|
||||
@@ -827,32 +828,47 @@ export class DataResolver extends null {
|
||||
|
||||
export class EnumResolvers extends null {
|
||||
private constructor();
|
||||
public static resolveChannelType(key: string | ChannelType): ChannelType;
|
||||
public static resolveInteractionType(key: string | InteractionType): InteractionType;
|
||||
public static resolveApplicationCommandType(key: string | ApplicationCommandType): ApplicationCommandType;
|
||||
public static resolveChannelType(key: ChannelTypeEnumResolvable | ChannelType): ChannelType;
|
||||
public static resolveInteractionType(key: InteractionTypeEnumResolvable | InteractionType): InteractionType;
|
||||
public static resolveApplicationCommandType(
|
||||
key: ApplicationCommandTypeEnumResolvable | ApplicationCommandType,
|
||||
): ApplicationCommandType;
|
||||
public static resolveApplicationCommandOptionType(
|
||||
key: string | ApplicationCommandOptionType,
|
||||
key: ApplicationCommandOptionTypeEnumResolvable | ApplicationCommandOptionType,
|
||||
): ApplicationCommandOptionType;
|
||||
public static resolveApplicationCommandPermissionType(
|
||||
key: string | ApplicationCommandPermissionType,
|
||||
key: ApplicationCommandPermissionTypeEnumResolvable | ApplicationCommandPermissionType,
|
||||
): ApplicationCommandPermissionType;
|
||||
public static resolveComponentType(key: string | ComponentType): ComponentType;
|
||||
public static resolveButtonStyle(key: string | ButtonStyle): ButtonStyle;
|
||||
public static resolveMessageType(key: string | MessageType): MessageType;
|
||||
public static resolveGuildNSFWLevel(key: string | GuildNSFWLevel): GuildNSFWLevel;
|
||||
public static resolveGuildVerificationLevel(key: string | GuildVerificationLevel): GuildVerificationLevel;
|
||||
public static resolveComponentType(key: ComponentTypeEnumResolvable | ComponentType): ComponentType;
|
||||
public static resolveButtonStyle(key: ButtonStyleEnumResolvable | ButtonStyle): ButtonStyle;
|
||||
public static resolveMessageType(key: MessageTypeEnumResolvable | MessageType): MessageType;
|
||||
public static resolveGuildNSFWLevel(key: GuildNSFWLevelEnumResolvable | GuildNSFWLevel): GuildNSFWLevel;
|
||||
public static resolveGuildVerificationLevel(
|
||||
key: GuildVerificationLevelEnumResolvable | GuildVerificationLevel,
|
||||
): GuildVerificationLevel;
|
||||
public static resolveGuildDefaultMessageNotifications(
|
||||
key: string | GuildDefaultMessageNotifications,
|
||||
key: GuildDefaultMessageNotificationsEnumResolvable | 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 resolveGuildExplicitContentFilter(
|
||||
key: GuildExplicitContentFilterEnumResolvable | GuildExplicitContentFilter,
|
||||
): GuildExplicitContentFilter;
|
||||
public static resolveGuildPremiumTier(key: GuildPremiumTierEnumResolvable | GuildPremiumTier): GuildPremiumTier;
|
||||
public static resolveGuildScheduledEventStatus(
|
||||
key: GuildScheduledEventStatusEnumResolvable | GuildScheduledEventStatus,
|
||||
): GuildScheduledEventStatus;
|
||||
public static resolveStageInstancePrivacyLevel(
|
||||
key: StageInstancePrivacyLevelEnumResolvable | StageInstancePrivacyLevel,
|
||||
): StageInstancePrivacyLevel;
|
||||
public static resolveGuildMFALevel(key: GuildMFALevelEnumResolvable | GuildMFALevel): GuildMFALevel;
|
||||
public static resolveTeamMemberMembershipState(
|
||||
key: TeamMemberMembershipStateEnumResolvable | TeamMemberMembershipState,
|
||||
): TeamMemberMembershipState;
|
||||
public static resolveGuildScheduledEventEntityType(
|
||||
key: string | GuildScheduledEventEntityType,
|
||||
key: GuildScheduledEventEntityTypeEnumResolvable | GuildScheduledEventEntityType,
|
||||
): GuildScheduledEventEntityType;
|
||||
public static resolveIntegrationExpireBehavior(
|
||||
key: IntegrationExpireBehaviorEnumResolvable | IntegrationExpireBehavior,
|
||||
): IntegrationExpireBehavior;
|
||||
}
|
||||
|
||||
export class DiscordAPIError extends Error {
|
||||
@@ -1266,7 +1282,7 @@ export class Integration extends Base {
|
||||
public account: IntegrationAccount;
|
||||
public application: IntegrationApplication | null;
|
||||
public enabled: boolean;
|
||||
public expireBehavior: IntegrationExpireBehaviors | null;
|
||||
public expireBehavior: IntegrationExpireBehavior | null;
|
||||
public expireGracePeriod: number | null;
|
||||
public guild: Guild;
|
||||
public id: Snowflake | string;
|
||||
@@ -2662,7 +2678,6 @@ export const Constants: {
|
||||
ThreadChannelTypes: ThreadChannelType[];
|
||||
TextBasedChannelTypes: TextBasedChannelTypes[];
|
||||
VoiceBasedChannelTypes: VoiceBasedChannelTypes[];
|
||||
IntegrationExpireBehaviors: IntegrationExpireBehaviors[];
|
||||
InviteScopes: InviteScope[];
|
||||
MessageTypes: MessageType[];
|
||||
SystemMessageTypes: SystemMessageType[];
|
||||
@@ -3940,6 +3955,91 @@ export type EmojiIdentifierResolvable = string | EmojiResolvable;
|
||||
|
||||
export type EmojiResolvable = Snowflake | GuildEmoji | ReactionEmoji;
|
||||
|
||||
export type ChannelTypeEnumResolvable =
|
||||
| 'GUILD_TEXT'
|
||||
| 'DM'
|
||||
| 'GUILD_VOICE'
|
||||
| 'GROUP_DM'
|
||||
| 'GUILD_CATEGORY'
|
||||
| 'GUILD_NEWS'
|
||||
| 'GUILD_NEWS_THREAD'
|
||||
| 'GUILD_PUBLIC_THREAD'
|
||||
| 'GUILD_PRIVATE_THREAD'
|
||||
| 'GUILD_STAGE_VOICE';
|
||||
|
||||
export type InteractionTypeEnumResolvable =
|
||||
| 'PING'
|
||||
| 'APPLICATION_COMMAND'
|
||||
| 'MESSAGE_COMPONENT'
|
||||
| 'APPLICATION_COMMAND_AUTOCOMPLETE';
|
||||
|
||||
export type ApplicationCommandTypeEnumResolvable = 'CHAT_INPUT' | 'USER' | 'MESSAGE';
|
||||
|
||||
export type ApplicationCommandOptionTypeEnumResolvable =
|
||||
| 'SUB_COMMAND'
|
||||
| 'SUB_COMMAND_GROUP'
|
||||
| 'STRING'
|
||||
| 'INTEGER'
|
||||
| 'BOOLEAN'
|
||||
| 'USER'
|
||||
| 'CHANNEL'
|
||||
| 'ROLE'
|
||||
| 'NUMBER'
|
||||
| 'MENTIONABLE';
|
||||
|
||||
export type ApplicationCommandPermissionTypeEnumResolvable = 'ROLE' | 'USER';
|
||||
|
||||
export type ComponentTypeEnumResolvable = 'ACTION_ROW' | 'BUTTON' | 'SELECT_MENU';
|
||||
|
||||
export type ButtonStyleEnumResolvable = 'PRIMARY' | 'SECONDARY' | 'SUCCESS' | 'DANGER' | 'LINK';
|
||||
|
||||
export type MessageTypeEnumResolvable =
|
||||
| 'DEFAULT'
|
||||
| 'RECIPIENT_ADD'
|
||||
| 'RECIPIENT_REMOVE'
|
||||
| 'CALL'
|
||||
| 'CHANNEL_NAME_CHANGE'
|
||||
| 'CHANNEL_ICON_CHANGE'
|
||||
| 'CHANNEL_PINNED_MESSAGE'
|
||||
| 'GUILD_MEMBER_JOIN'
|
||||
| 'USER_PREMIUM_GUILD_SUBSCRIPTION'
|
||||
| 'USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1'
|
||||
| 'USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2'
|
||||
| 'USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3'
|
||||
| 'CHANNEL_FOLLOW_ADD'
|
||||
| 'GUILD_DISCOVERY_DISQUALIFIED'
|
||||
| 'GUILD_DISCOVERY_REQUALIFIED'
|
||||
| 'GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING'
|
||||
| 'GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING'
|
||||
| 'THREAD_CREATED'
|
||||
| 'REPLY'
|
||||
| 'CHAT_INPUT_COMMAND'
|
||||
| 'THREAD_STARTER_MESSAGE'
|
||||
| 'GUILD_INVITE_REMINDER'
|
||||
| 'CONTEXT_MENU_COMMAND';
|
||||
|
||||
export type GuildNSFWLevelEnumResolvable = 'DEFAULT' | 'EXPLICIT' | 'SAFE' | 'AGE_RESTRICTED';
|
||||
|
||||
export type GuildVerificationLevelEnumResolvable = 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH' | 'VERY_HIGH';
|
||||
|
||||
export type GuildDefaultMessageNotificationsEnumResolvable = 'ALL_MESSAGES' | 'ONLY_MENTIONS';
|
||||
|
||||
export type GuildExplicitContentFilterEnumResolvable = 'DISABLED' | 'MEMBERS_WITHOUT_ROLES' | 'ALL_MEMBERS';
|
||||
|
||||
export type GuildPremiumTierEnumResolvable = 'NONE' | 'TIER_1' | 'TIER_2' | 'TIER_3';
|
||||
|
||||
export type GuildScheduledEventStatusEnumResolvable = 'SCHEDULED' | 'ACTIVE' | 'COMPLETED' | 'CANCELED';
|
||||
|
||||
export type StageInstancePrivacyLevelEnumResolvable = 'PUBLIC' | 'GUILD_ONLY';
|
||||
|
||||
export type GuildMFALevelEnumResolvable = 'NONE' | 'ELEVATED';
|
||||
|
||||
export type TeamMemberMembershipStateEnumResolvable = 'INVITED' | 'ACCEPTED';
|
||||
|
||||
export type GuildScheduledEventEntityTypeEnumResolvable = 'STAGE_INSTANCE' | 'VOICE' | 'EXTERNAL';
|
||||
|
||||
export type IntegrationExpireBehaviorEnumResolvable = 'REMOVE_ROLE' | 'KICK';
|
||||
|
||||
export interface ErrorEvent {
|
||||
error: unknown;
|
||||
message: string;
|
||||
@@ -4545,8 +4645,6 @@ export interface CreateInviteOptions {
|
||||
targetType?: InviteTargetType;
|
||||
}
|
||||
|
||||
export type IntegrationExpireBehaviors = 'REMOVE_ROLE' | 'KICK';
|
||||
|
||||
export type InviteResolvable = string;
|
||||
|
||||
export type InviteScope =
|
||||
|
||||
Reference in New Issue
Block a user