mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
chore!: remove all deprecated features/props (#10421)
BREAKING CHANGE: Removed `Client#fetchPremiumStickerPacks` method BREAKING CHANGE: Removed `Client#webhookUpdate` event BREAKING CHANGE: Removed various error codes BREAKING CHANGE: Removed `Formatters` namespace BREAKING CHANGE: Removed `InviteStageInstance` class BREAKING CHANGE: Removed `Invite#stageInstance` property BREAKING CHANGE: Removed `StageInstance#discoverable_disabled` property BREAKING CHANGE: Removed `SelectMenuBuilder` alias BREAKING CHANGE: Removed `SelectMenuComponent` alias BREAKING CHANGE: Removed `SelectMenuInteraction` alias BREAKING CHANGE: Removed `SelectMenuOptionBuilder` alias BREAKING CHANGE: Removed `BaseInteraction#isSelectMenu` alias BREAKING CHANGE: Removed `deleteMessageDays` option from `GuildBanManager#create` BREAKING CHANGE: Removed `ActionRow#from` method BREAKING CHANGE: Removed `Emoji#url` getter BREAKING CHANGE: Removed `TeamMember#permissions` property BREAKING CHANGE: Removed `User#avatarDecoration` property BREAKING CHANGE: Removed `InteractionResponses#sendPremiumRequired` method BREAKING CHANGE: Removed `DeletableMessageTypes` constant
This commit is contained in:
@@ -31,8 +31,6 @@ const PermissionsBitField = require('../util/PermissionsBitField');
|
||||
const Status = require('../util/Status');
|
||||
const Sweepers = require('../util/Sweepers');
|
||||
|
||||
let deprecationEmittedForPremiumStickerPacks = false;
|
||||
|
||||
/**
|
||||
* The main hub for interacting with the Discord API, and the starting point for any bot.
|
||||
* @extends {BaseClient}
|
||||
@@ -372,24 +370,6 @@ class Client extends BaseClient {
|
||||
return new Collection(data.sticker_packs.map(stickerPack => [stickerPack.id, new StickerPack(this, stickerPack)]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the list of available sticker packs.
|
||||
* @returns {Promise<Collection<Snowflake, StickerPack>>}
|
||||
* @deprecated Use {@link Client#fetchStickerPacks} instead.
|
||||
*/
|
||||
fetchPremiumStickerPacks() {
|
||||
if (!deprecationEmittedForPremiumStickerPacks) {
|
||||
process.emitWarning(
|
||||
'The Client#fetchPremiumStickerPacks() method is deprecated. Use Client#fetchStickerPacks() instead.',
|
||||
'DeprecationWarning',
|
||||
);
|
||||
|
||||
deprecationEmittedForPremiumStickerPacks = true;
|
||||
}
|
||||
|
||||
return this.fetchStickerPacks();
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains a guild preview from Discord, available for all guilds the bot is in and all Discoverable guilds.
|
||||
* @param {GuildResolvable} guild The guild to fetch the preview for
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const process = require('node:process');
|
||||
const Action = require('./Action');
|
||||
|
||||
let deprecationEmitted = false;
|
||||
const Events = require('../../util/Events');
|
||||
|
||||
class WebhooksUpdate extends Action {
|
||||
handle(data) {
|
||||
@@ -11,26 +9,13 @@ class WebhooksUpdate extends Action {
|
||||
const channel = client.channels.cache.get(data.channel_id);
|
||||
if (!channel) return;
|
||||
|
||||
// TODO: change to Events.WebhooksUpdate in the next major version
|
||||
/**
|
||||
* Emitted whenever a channel has its webhooks changed.
|
||||
* @event Client#webhooksUpdate
|
||||
* @param {TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel} channel
|
||||
* The channel that had a webhook update
|
||||
*/
|
||||
client.emit('webhooksUpdate', channel);
|
||||
|
||||
/**
|
||||
* Emitted whenever a channel has its webhooks changed.
|
||||
* @event Client#webhookUpdate
|
||||
* @param {TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel} channel
|
||||
* The channel that had a webhook update
|
||||
* @deprecated Use {@link Client#event:webhooksUpdate} instead.
|
||||
*/
|
||||
if (client.emit('webhookUpdate', channel) && !deprecationEmitted) {
|
||||
deprecationEmitted = true;
|
||||
process.emitWarning('The webhookUpdate event is deprecated. Use webhooksUpdate instead.', 'DeprecationWarning');
|
||||
}
|
||||
client.emit(Events.WebhooksUpdate, channel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,25 +12,8 @@
|
||||
* @property {'TokenMissing'} TokenMissing
|
||||
* @property {'ApplicationCommandPermissionsTokenMissing'} ApplicationCommandPermissionsTokenMissing
|
||||
|
||||
* @property {'WSCloseRequested'} WSCloseRequested
|
||||
* <warn>This property is deprecated.</warn>
|
||||
* @property {'WSConnectionExists'} WSConnectionExists
|
||||
* <warn>This property is deprecated.</warn>
|
||||
* @property {'WSNotOpen'} WSNotOpen
|
||||
* <warn>This property is deprecated.</warn>
|
||||
* @property {'ManagerDestroyed'} ManagerDestroyed
|
||||
* <warn>This property is deprecated.</warn>
|
||||
* @property {'BitFieldInvalid'} BitFieldInvalid
|
||||
|
||||
* @property {'BitFieldInvalid'} BitFieldInvalid
|
||||
|
||||
* @property {'ShardingInvalid'} ShardingInvalid
|
||||
* <warn>This property is deprecated.</warn>
|
||||
* @property {'ShardingRequired'} ShardingRequired
|
||||
* <warn>This property is deprecated.</warn>
|
||||
* @property {'InvalidIntents'} InvalidIntents
|
||||
* <warn>This property is deprecated.</warn>
|
||||
* @property {'DisallowedIntents'} DisallowedIntents
|
||||
* <warn>This property is deprecated.</warn>
|
||||
* @property {'ShardingNoShards'} ShardingNoShards
|
||||
* @property {'ShardingInProcess'} ShardingInProcess
|
||||
* @property {'ShardingInvalidEvalBroadcast'} ShardingInvalidEvalBroadcast
|
||||
@@ -49,30 +32,10 @@
|
||||
|
||||
* @property {'InviteOptionsMissingChannel'} InviteOptionsMissingChannel
|
||||
|
||||
* @property {'ButtonLabel'} ButtonLabel
|
||||
* <warn>This property is deprecated.</warn>
|
||||
* @property {'ButtonURL'} ButtonURL
|
||||
* <warn>This property is deprecated.</warn>
|
||||
* @property {'ButtonCustomId'} ButtonCustomId
|
||||
* <warn>This property is deprecated.</warn>
|
||||
|
||||
* @property {'SelectMenuCustomId'} SelectMenuCustomId
|
||||
* <warn>This property is deprecated.</warn>
|
||||
* @property {'SelectMenuPlaceholder'} SelectMenuPlaceholder
|
||||
* <warn>This property is deprecated.</warn>
|
||||
* @property {'SelectOptionLabel'} SelectOptionLabel
|
||||
* <warn>This property is deprecated.</warn>
|
||||
* @property {'SelectOptionValue'} SelectOptionValue
|
||||
* <warn>This property is deprecated.</warn>
|
||||
* @property {'SelectOptionDescription'} SelectOptionDescription
|
||||
* <warn>This property is deprecated.</warn>
|
||||
|
||||
* @property {'InteractionCollectorError'} InteractionCollectorError
|
||||
|
||||
* @property {'FileNotFound'} FileNotFound
|
||||
|
||||
* @property {'UserBannerNotFetched'} UserBannerNotFetched
|
||||
* <warn>This property is deprecated.</warn>
|
||||
* @property {'UserNoDMChannel'} UserNoDMChannel
|
||||
|
||||
* @property {'VoiceNotStageChannel'} VoiceNotStageChannel
|
||||
@@ -82,19 +45,11 @@
|
||||
|
||||
* @property {'ReqResourceType'} ReqResourceType
|
||||
|
||||
* @property {'ImageFormat'} ImageFormat
|
||||
* <warn>This property is deprecated.</warn>
|
||||
* @property {'ImageSize'} ImageSize
|
||||
* <warn>This property is deprecated.</warn>
|
||||
|
||||
* @property {'MessageBulkDeleteType'} MessageBulkDeleteType
|
||||
* @property {'MessageContentType'} MessageContentType
|
||||
* @property {'MessageNonceRequired'} MessageNonceRequired
|
||||
* @property {'MessageNonceType'} MessageNonceType
|
||||
|
||||
* @property {'SplitMaxLen'} SplitMaxLen
|
||||
* <warn>This property is deprecated.</warn>
|
||||
|
||||
* @property {'BanResolveId'} BanResolveId
|
||||
* @property {'FetchBanResolveId'} FetchBanResolveId
|
||||
|
||||
@@ -128,16 +83,11 @@
|
||||
* @property {'EmojiType'} EmojiType
|
||||
* @property {'EmojiManaged'} EmojiManaged
|
||||
* @property {'MissingManageGuildExpressionsPermission'} MissingManageGuildExpressionsPermission
|
||||
* @property {'MissingManageEmojisAndStickersPermission'} MissingManageEmojisAndStickersPermission
|
||||
* <warn>This property is deprecated. Use `MissingManageGuildExpressionsPermission` instead.</warn>
|
||||
*
|
||||
* @property {'NotGuildSticker'} NotGuildSticker
|
||||
|
||||
* @property {'ReactionResolveUser'} ReactionResolveUser
|
||||
|
||||
* @property {'VanityURL'} VanityURL
|
||||
* <warn>This property is deprecated.</warn>
|
||||
|
||||
* @property {'InviteResolveCode'} InviteResolveCode
|
||||
|
||||
* @property {'InviteNotFound'} InviteNotFound
|
||||
@@ -152,8 +102,6 @@
|
||||
|
||||
* @property {'InteractionAlreadyReplied'} InteractionAlreadyReplied
|
||||
* @property {'InteractionNotReplied'} InteractionNotReplied
|
||||
* @property {'InteractionEphemeralReplied'} InteractionEphemeralReplied
|
||||
* <warn>This property is deprecated.</warn>
|
||||
|
||||
* @property {'CommandInteractionOptionNotFound'} CommandInteractionOptionNotFound
|
||||
* @property {'CommandInteractionOptionType'} CommandInteractionOptionType
|
||||
@@ -192,17 +140,8 @@ const keys = [
|
||||
'TokenMissing',
|
||||
'ApplicationCommandPermissionsTokenMissing',
|
||||
|
||||
'WSCloseRequested',
|
||||
'WSConnectionExists',
|
||||
'WSNotOpen',
|
||||
'ManagerDestroyed',
|
||||
|
||||
'BitFieldInvalid',
|
||||
|
||||
'ShardingInvalid',
|
||||
'ShardingRequired',
|
||||
'InvalidIntents',
|
||||
'DisallowedIntents',
|
||||
'ShardingNoShards',
|
||||
'ShardingInProcess',
|
||||
'ShardingInvalidEvalBroadcast',
|
||||
@@ -221,21 +160,10 @@ const keys = [
|
||||
|
||||
'InviteOptionsMissingChannel',
|
||||
|
||||
'ButtonLabel',
|
||||
'ButtonURL',
|
||||
'ButtonCustomId',
|
||||
|
||||
'SelectMenuCustomId',
|
||||
'SelectMenuPlaceholder',
|
||||
'SelectOptionLabel',
|
||||
'SelectOptionValue',
|
||||
'SelectOptionDescription',
|
||||
|
||||
'InteractionCollectorError',
|
||||
|
||||
'FileNotFound',
|
||||
|
||||
'UserBannerNotFetched',
|
||||
'UserNoDMChannel',
|
||||
|
||||
'VoiceNotStageChannel',
|
||||
@@ -245,16 +173,11 @@ const keys = [
|
||||
|
||||
'ReqResourceType',
|
||||
|
||||
'ImageFormat',
|
||||
'ImageSize',
|
||||
|
||||
'MessageBulkDeleteType',
|
||||
'MessageContentType',
|
||||
'MessageNonceRequired',
|
||||
'MessageNonceType',
|
||||
|
||||
'SplitMaxLen',
|
||||
|
||||
'BanResolveId',
|
||||
'FetchBanResolveId',
|
||||
|
||||
@@ -288,14 +211,11 @@ const keys = [
|
||||
'EmojiType',
|
||||
'EmojiManaged',
|
||||
'MissingManageGuildExpressionsPermission',
|
||||
'MissingManageEmojisAndStickersPermission',
|
||||
|
||||
'NotGuildSticker',
|
||||
|
||||
'ReactionResolveUser',
|
||||
|
||||
'VanityURL',
|
||||
|
||||
'InviteResolveCode',
|
||||
|
||||
'InviteNotFound',
|
||||
@@ -310,7 +230,6 @@ const keys = [
|
||||
|
||||
'InteractionAlreadyReplied',
|
||||
'InteractionNotReplied',
|
||||
'InteractionEphemeralReplied',
|
||||
|
||||
'CommandInteractionOptionNotFound',
|
||||
'CommandInteractionOptionType',
|
||||
|
||||
@@ -13,17 +13,8 @@ const Messages = {
|
||||
[DjsErrorCodes.ApplicationCommandPermissionsTokenMissing]:
|
||||
'Editing application command permissions requires an OAuth2 bearer token, but none was provided.',
|
||||
|
||||
[DjsErrorCodes.WSCloseRequested]: 'WebSocket closed due to user request.',
|
||||
[DjsErrorCodes.WSConnectionExists]: 'There is already an existing WebSocket connection.',
|
||||
[DjsErrorCodes.WSNotOpen]: (data = 'data') => `WebSocket not open to send ${data}`,
|
||||
[DjsErrorCodes.ManagerDestroyed]: 'Manager was destroyed.',
|
||||
|
||||
[DjsErrorCodes.BitFieldInvalid]: bit => `Invalid bitfield flag or number: ${bit}.`,
|
||||
|
||||
[DjsErrorCodes.ShardingInvalid]: 'Invalid shard settings were provided.',
|
||||
[DjsErrorCodes.ShardingRequired]: 'This session would have handled too many guilds - Sharding is required.',
|
||||
[DjsErrorCodes.InvalidIntents]: 'Invalid intent provided for WebSocket intents.',
|
||||
[DjsErrorCodes.DisallowedIntents]: 'Privileged intent provided is not enabled or whitelisted.',
|
||||
[DjsErrorCodes.ShardingNoShards]: 'No shards have been spawned.',
|
||||
[DjsErrorCodes.ShardingInProcess]: 'Shards are still being spawned.',
|
||||
[DjsErrorCodes.ShardingInvalidEvalBroadcast]: 'Script to evaluate must be a function',
|
||||
@@ -44,22 +35,11 @@ const Messages = {
|
||||
[DjsErrorCodes.InviteOptionsMissingChannel]:
|
||||
'A valid guild channel must be provided when GuildScheduledEvent is EXTERNAL.',
|
||||
|
||||
[DjsErrorCodes.ButtonLabel]: 'MessageButton label must be a string',
|
||||
[DjsErrorCodes.ButtonURL]: 'MessageButton URL must be a string',
|
||||
[DjsErrorCodes.ButtonCustomId]: 'MessageButton customId must be a string',
|
||||
|
||||
[DjsErrorCodes.SelectMenuCustomId]: 'MessageSelectMenu customId must be a string',
|
||||
[DjsErrorCodes.SelectMenuPlaceholder]: 'MessageSelectMenu placeholder must be a string',
|
||||
[DjsErrorCodes.SelectOptionLabel]: 'MessageSelectOption label must be a string',
|
||||
[DjsErrorCodes.SelectOptionValue]: 'MessageSelectOption value must be a string',
|
||||
[DjsErrorCodes.SelectOptionDescription]: 'MessageSelectOption description must be a string',
|
||||
|
||||
[DjsErrorCodes.InteractionCollectorError]: reason =>
|
||||
`Collector received no interactions before ending with reason: ${reason}`,
|
||||
|
||||
[DjsErrorCodes.FileNotFound]: file => `File could not be found: ${file}`,
|
||||
|
||||
[DjsErrorCodes.UserBannerNotFetched]: "You must fetch this user's banner before trying to generate its URL!",
|
||||
[DjsErrorCodes.UserNoDMChannel]: 'No DM Channel exists!',
|
||||
|
||||
[DjsErrorCodes.VoiceNotStageChannel]: 'You are only allowed to do this in stage channels.',
|
||||
@@ -70,16 +50,11 @@ const Messages = {
|
||||
|
||||
[DjsErrorCodes.ReqResourceType]: 'The resource must be a string, Buffer or a valid file stream.',
|
||||
|
||||
[DjsErrorCodes.ImageFormat]: format => `Invalid image format: ${format}`,
|
||||
[DjsErrorCodes.ImageSize]: size => `Invalid image size: ${size}`,
|
||||
|
||||
[DjsErrorCodes.MessageBulkDeleteType]: 'The messages must be an Array, Collection, or number.',
|
||||
[DjsErrorCodes.MessageContentType]: 'Message content must be a string.',
|
||||
[DjsErrorCodes.MessageNonceRequired]: 'Message nonce is required when enforceNonce is true.',
|
||||
[DjsErrorCodes.MessageNonceType]: 'Message nonce must be an integer or a string.',
|
||||
|
||||
[DjsErrorCodes.SplitMaxLen]: 'Chunk exceeds the max length and contains no split characters.',
|
||||
|
||||
[DjsErrorCodes.BanResolveId]: (ban = false) => `Couldn't resolve the user id to ${ban ? 'ban' : 'unban'}.`,
|
||||
[DjsErrorCodes.FetchBanResolveId]: "Couldn't resolve the user id to fetch the ban.",
|
||||
|
||||
@@ -114,15 +89,11 @@ const Messages = {
|
||||
[DjsErrorCodes.EmojiManaged]: 'Emoji is managed and has no Author.',
|
||||
[DjsErrorCodes.MissingManageGuildExpressionsPermission]: guild =>
|
||||
`Client must have Manage Guild Expressions permission in guild ${guild} to see emoji authors.`,
|
||||
[DjsErrorCodes.MissingManageEmojisAndStickersPermission]: guild =>
|
||||
`Client must have Manage Emojis and Stickers permission in guild ${guild} to see emoji authors.`,
|
||||
|
||||
[DjsErrorCodes.NotGuildSticker]: 'Sticker is a standard (non-guild) sticker and has no author.',
|
||||
|
||||
[DjsErrorCodes.ReactionResolveUser]: "Couldn't resolve the user id to remove from the reaction.",
|
||||
|
||||
[DjsErrorCodes.VanityURL]: 'This guild does not have the vanity URL feature enabled.',
|
||||
|
||||
[DjsErrorCodes.InviteResolveCode]: 'Could not resolve the code to fetch the invite.',
|
||||
|
||||
[DjsErrorCodes.InviteNotFound]: 'Could not find the requested invite.',
|
||||
@@ -140,7 +111,6 @@ const Messages = {
|
||||
|
||||
[DjsErrorCodes.InteractionAlreadyReplied]: 'The reply to this interaction has already been sent or deferred.',
|
||||
[DjsErrorCodes.InteractionNotReplied]: 'The reply to this interaction has not been sent or deferred.',
|
||||
[DjsErrorCodes.InteractionEphemeralReplied]: 'Ephemeral responses cannot be deleted.',
|
||||
|
||||
[DjsErrorCodes.CommandInteractionOptionNotFound]: name => `Required option "${name}" not found.`,
|
||||
[DjsErrorCodes.CommandInteractionOptionType]: (name, type, expected) =>
|
||||
|
||||
@@ -31,7 +31,6 @@ exports.Constants = require('./util/Constants');
|
||||
exports.Colors = require('./util/Colors');
|
||||
__exportStar(require('./util/DataResolver.js'), exports);
|
||||
exports.Events = require('./util/Events');
|
||||
exports.Formatters = require('./util/Formatters');
|
||||
exports.GuildMemberFlagsBitField = require('./util/GuildMemberFlagsBitField').GuildMemberFlagsBitField;
|
||||
exports.IntentsBitField = require('./util/IntentsBitField');
|
||||
exports.LimitedCollection = require('./util/LimitedCollection');
|
||||
@@ -151,7 +150,6 @@ exports.InteractionCollector = require('./structures/InteractionCollector');
|
||||
exports.InteractionResponse = require('./structures/InteractionResponse');
|
||||
exports.InteractionWebhook = require('./structures/InteractionWebhook');
|
||||
exports.Invite = require('./structures/Invite');
|
||||
exports.InviteStageInstance = require('./structures/InviteStageInstance');
|
||||
exports.InviteGuild = require('./structures/InviteGuild');
|
||||
exports.Message = require('./structures/Message').Message;
|
||||
exports.Attachment = require('./structures/Attachment');
|
||||
@@ -177,27 +175,23 @@ exports.ReactionCollector = require('./structures/ReactionCollector');
|
||||
exports.ReactionEmoji = require('./structures/ReactionEmoji');
|
||||
exports.RichPresenceAssets = require('./structures/Presence').RichPresenceAssets;
|
||||
exports.Role = require('./structures/Role').Role;
|
||||
exports.SelectMenuBuilder = require('./structures/SelectMenuBuilder');
|
||||
exports.ChannelSelectMenuBuilder = require('./structures/ChannelSelectMenuBuilder');
|
||||
exports.MentionableSelectMenuBuilder = require('./structures/MentionableSelectMenuBuilder');
|
||||
exports.RoleSelectMenuBuilder = require('./structures/RoleSelectMenuBuilder');
|
||||
exports.StringSelectMenuBuilder = require('./structures/StringSelectMenuBuilder');
|
||||
exports.UserSelectMenuBuilder = require('./structures/UserSelectMenuBuilder');
|
||||
exports.BaseSelectMenuComponent = require('./structures/BaseSelectMenuComponent');
|
||||
exports.SelectMenuComponent = require('./structures/SelectMenuComponent');
|
||||
exports.ChannelSelectMenuComponent = require('./structures/ChannelSelectMenuComponent');
|
||||
exports.MentionableSelectMenuComponent = require('./structures/MentionableSelectMenuComponent');
|
||||
exports.RoleSelectMenuComponent = require('./structures/RoleSelectMenuComponent');
|
||||
exports.StringSelectMenuComponent = require('./structures/StringSelectMenuComponent');
|
||||
exports.UserSelectMenuComponent = require('./structures/UserSelectMenuComponent');
|
||||
exports.SelectMenuInteraction = require('./structures/SelectMenuInteraction');
|
||||
exports.ChannelSelectMenuInteraction = require('./structures/ChannelSelectMenuInteraction');
|
||||
exports.MentionableSelectMenuInteraction = require('./structures/MentionableSelectMenuInteraction');
|
||||
exports.MentionableSelectMenuInteraction = require('./structures/MentionableSelectMenuInteraction');
|
||||
exports.RoleSelectMenuInteraction = require('./structures/RoleSelectMenuInteraction');
|
||||
exports.StringSelectMenuInteraction = require('./structures/StringSelectMenuInteraction');
|
||||
exports.UserSelectMenuInteraction = require('./structures/UserSelectMenuInteraction');
|
||||
exports.SelectMenuOptionBuilder = require('./structures/SelectMenuOptionBuilder');
|
||||
exports.SKU = require('./structures/SKU').SKU;
|
||||
exports.StringSelectMenuOptionBuilder = require('./structures/StringSelectMenuOptionBuilder');
|
||||
exports.StageChannel = require('./structures/StageChannel');
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const process = require('node:process');
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const { makeURLSearchParams } = require('@discordjs/rest');
|
||||
const { Routes } = require('discord-api-types/v10');
|
||||
@@ -9,8 +8,6 @@ const { DiscordjsTypeError, DiscordjsError, ErrorCodes } = require('../errors');
|
||||
const GuildBan = require('../structures/GuildBan');
|
||||
const { GuildMember } = require('../structures/GuildMember');
|
||||
|
||||
let deprecationEmittedForDeleteMessageDays = false;
|
||||
|
||||
/**
|
||||
* Manages API methods for guild bans and stores their cache.
|
||||
* @extends {CachedManager}
|
||||
@@ -131,8 +128,6 @@ class GuildBanManager extends CachedManager {
|
||||
/**
|
||||
* Options used to ban a user from a guild.
|
||||
* @typedef {Object} BanOptions
|
||||
* @property {number} [deleteMessageDays] Number of days of messages to delete, must be between 0 and 7, inclusive
|
||||
* <warn>This property is deprecated. Use `deleteMessageSeconds` instead.</warn>
|
||||
* @property {number} [deleteMessageSeconds] Number of seconds of messages to delete,
|
||||
* must be between 0 and 604800 (7 days), inclusive
|
||||
* @property {string} [reason] The reason for the ban
|
||||
@@ -156,21 +151,9 @@ class GuildBanManager extends CachedManager {
|
||||
const id = this.client.users.resolveId(user);
|
||||
if (!id) throw new DiscordjsError(ErrorCodes.BanResolveId, true);
|
||||
|
||||
if (options.deleteMessageDays !== undefined && !deprecationEmittedForDeleteMessageDays) {
|
||||
process.emitWarning(
|
||||
// eslint-disable-next-line max-len
|
||||
'The deleteMessageDays option for GuildBanManager#create() is deprecated. Use the deleteMessageSeconds option instead.',
|
||||
'DeprecationWarning',
|
||||
);
|
||||
|
||||
deprecationEmittedForDeleteMessageDays = true;
|
||||
}
|
||||
|
||||
await this.client.rest.put(Routes.guildBan(this.guild.id, id), {
|
||||
body: {
|
||||
delete_message_seconds:
|
||||
options.deleteMessageSeconds ??
|
||||
(options.deleteMessageDays ? options.deleteMessageDays * 24 * 60 * 60 : undefined),
|
||||
delete_message_seconds: options.deleteMessageSeconds,
|
||||
},
|
||||
reason: options.reason,
|
||||
});
|
||||
@@ -200,14 +183,6 @@ class GuildBanManager extends CachedManager {
|
||||
return this.client.users.resolve(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options used for bulk banning users from a guild.
|
||||
* @typedef {Object} BulkBanOptions
|
||||
* @property {number} [deleteMessageSeconds] Number of seconds of messages to delete,
|
||||
* must be between 0 and 604800 (7 days), inclusive
|
||||
* @property {string} [reason] The reason for the bans
|
||||
*/
|
||||
|
||||
/**
|
||||
* Result of bulk banning users from a guild.
|
||||
* @typedef {Object} BulkBanResult
|
||||
@@ -218,7 +193,7 @@ class GuildBanManager extends CachedManager {
|
||||
/**
|
||||
* Bulk ban users from a guild, and optionally delete previous messages sent by them.
|
||||
* @param {Collection<Snowflake, UserResolvable>|UserResolvable[]} users The users to ban
|
||||
* @param {BulkBanOptions} [options] The options for bulk banning users
|
||||
* @param {BanOptions} [options] The options for bulk banning users
|
||||
* @returns {Promise<BulkBanResult>} Returns an object with `bannedUsers` key containing the IDs of the banned users
|
||||
* and the key `failedUsers` with the IDs that could not be banned or were already banned.
|
||||
* @example
|
||||
|
||||
@@ -504,7 +504,7 @@ class GuildMemberManager extends CachedManager {
|
||||
/**
|
||||
* Bulk ban users from a guild, and optionally delete previous messages sent by them.
|
||||
* @param {Collection<Snowflake, UserResolvable>|UserResolvable[]} users The users to ban
|
||||
* @param {BulkBanOptions} [options] The options for bulk banning users
|
||||
* @param {BanOptions} [options] The options for bulk banning users
|
||||
* @returns {Promise<BulkBanResult>} Returns an object with `bannedUsers` key containing the IDs of the banned users
|
||||
* and the key `failedUsers` with the IDs that could not be banned or were already banned.
|
||||
* Internally calls the GuildBanManager#bulkCreate method.
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
const process = require('node:process');
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const { DiscordAPIError } = require('@discordjs/rest');
|
||||
const { RESTJSONErrorCodes, Routes } = require('discord-api-types/v10');
|
||||
const { Routes } = require('discord-api-types/v10');
|
||||
const CachedManager = require('./CachedManager');
|
||||
const { DiscordjsTypeError, ErrorCodes } = require('../errors');
|
||||
const { Role } = require('../structures/Role');
|
||||
@@ -74,17 +73,8 @@ class RoleManager extends CachedManager {
|
||||
if (existing) return existing;
|
||||
}
|
||||
|
||||
try {
|
||||
const data = await this.client.rest.get(Routes.guildRole(this.guild.id, id));
|
||||
return this._add(data, cache);
|
||||
} catch (error) {
|
||||
// TODO: Remove this catch in the next major version
|
||||
if (error instanceof DiscordAPIError && error.code === RESTJSONErrorCodes.UnknownRole) {
|
||||
return null;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
const data = await this.client.rest.get(Routes.guildRole(this.guild.id, id));
|
||||
return this._add(data, cache);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const { deprecate } = require('node:util');
|
||||
const { isJSONEncodable } = require('@discordjs/util');
|
||||
const Component = require('./Component');
|
||||
const { createComponent } = require('../util/Components');
|
||||
|
||||
@@ -21,19 +19,6 @@ class ActionRow extends Component {
|
||||
this.components = components.map(component => createComponent(component));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new action row builder from JSON data
|
||||
* @method from
|
||||
* @memberof ActionRow
|
||||
* @param {ActionRowBuilder|ActionRow|APIActionRowComponent} other The other data
|
||||
* @returns {ActionRowBuilder}
|
||||
* @deprecated Use {@link ActionRowBuilder.from | ActionRowBuilder#from} instead.
|
||||
*/
|
||||
static from = deprecate(
|
||||
other => new this(isJSONEncodable(other) ? other.toJSON() : other),
|
||||
'ActionRow.from() is deprecated. Use ActionRowBuilder.from() instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the API-compatible JSON for this component
|
||||
* @returns {APIActionRowComponent}
|
||||
|
||||
@@ -62,14 +62,4 @@ class BaseGuildEmoji extends Emoji {
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns a URL for the emoji.
|
||||
* @name url
|
||||
* @memberof BaseGuildEmoji
|
||||
* @instance
|
||||
* @type {string}
|
||||
* @readonly
|
||||
* @deprecated Use {@link BaseGuildEmoji#imageURL} instead.
|
||||
*/
|
||||
|
||||
module.exports = BaseGuildEmoji;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const { deprecate } = require('node:util');
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const { DiscordSnowflake } = require('@sapphire/snowflake');
|
||||
const { InteractionType, ApplicationCommandType, ComponentType } = require('discord-api-types/v10');
|
||||
@@ -259,15 +258,6 @@ class BaseInteraction extends Base {
|
||||
return this.type === InteractionType.MessageComponent && this.componentType === ComponentType.Button;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this interaction is a {@link StringSelectMenuInteraction}.
|
||||
* @returns {boolean}
|
||||
* @deprecated Use {@link BaseInteraction#isStringSelectMenu} instead.
|
||||
*/
|
||||
isSelectMenu() {
|
||||
return this.isStringSelectMenu();
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this interaction is a select menu of any known type.
|
||||
* @returns {boolean}
|
||||
@@ -325,9 +315,4 @@ class BaseInteraction extends Base {
|
||||
}
|
||||
}
|
||||
|
||||
BaseInteraction.prototype.isSelectMenu = deprecate(
|
||||
BaseInteraction.prototype.isSelectMenu,
|
||||
'BaseInteraction#isSelectMenu() is deprecated. Use BaseInteraction#isStringSelectMenu() instead.',
|
||||
);
|
||||
|
||||
module.exports = BaseInteraction;
|
||||
|
||||
@@ -153,7 +153,6 @@ class CommandInteraction extends BaseInteraction {
|
||||
deleteReply() {}
|
||||
followUp() {}
|
||||
showModal() {}
|
||||
sendPremiumRequired() {}
|
||||
awaitModalSubmit() {}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
const process = require('node:process');
|
||||
const { formatEmoji } = require('@discordjs/formatters');
|
||||
const { DiscordSnowflake } = require('@sapphire/snowflake');
|
||||
const Base = require('./Base');
|
||||
|
||||
let deprecationEmittedForURL = false;
|
||||
|
||||
/**
|
||||
* Represents an emoji, see {@link ApplicationEmoji}, {@link GuildEmoji} and {@link ReactionEmoji}.
|
||||
* @extends {Base}
|
||||
@@ -52,21 +49,6 @@ class Emoji extends Base {
|
||||
return this.id && this.client.rest.cdn.emoji(this.id, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a URL for the emoji or `null` if this is not a custom emoji.
|
||||
* @type {?string}
|
||||
* @readonly
|
||||
* @deprecated Use {@link Emoji#imageURL} instead.
|
||||
*/
|
||||
get url() {
|
||||
if (!deprecationEmittedForURL) {
|
||||
process.emitWarning('The Emoji#url getter is deprecated. Use Emoji#imageURL() instead.', 'DeprecationWarning');
|
||||
deprecationEmittedForURL = true;
|
||||
}
|
||||
|
||||
return this.imageURL({ extension: this.animated ? 'gif' : 'png' });
|
||||
}
|
||||
|
||||
/**
|
||||
* The timestamp the emoji was created at, or null if unicode
|
||||
* @type {?number}
|
||||
|
||||
@@ -4,7 +4,6 @@ const { RouteBases, Routes, PermissionFlagsBits } = require('discord-api-types/v
|
||||
const Base = require('./Base');
|
||||
const { GuildScheduledEvent } = require('./GuildScheduledEvent');
|
||||
const IntegrationApplication = require('./IntegrationApplication');
|
||||
const InviteStageInstance = require('./InviteStageInstance');
|
||||
const { DiscordjsError, ErrorCodes } = require('../errors');
|
||||
|
||||
/**
|
||||
@@ -202,17 +201,6 @@ class Invite extends Base {
|
||||
this._expiresTimestamp ??= null;
|
||||
}
|
||||
|
||||
if ('stage_instance' in data) {
|
||||
/**
|
||||
* The stage instance data if there is a public {@link StageInstance} in the stage channel this invite is for
|
||||
* @type {?InviteStageInstance}
|
||||
* @deprecated
|
||||
*/
|
||||
this.stageInstance = new InviteStageInstance(this.client, data.stage_instance, this.channel.id, this.guild.id);
|
||||
} else {
|
||||
this.stageInstance ??= null;
|
||||
}
|
||||
|
||||
if ('guild_scheduled_event' in data) {
|
||||
/**
|
||||
* The guild scheduled event data if there is a {@link GuildScheduledEvent} in the channel this invite is for
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const Base = require('./Base');
|
||||
|
||||
/**
|
||||
* Represents the data about a public {@link StageInstance} in an {@link Invite}.
|
||||
* @extends {Base}
|
||||
* @deprecated
|
||||
*/
|
||||
class InviteStageInstance extends Base {
|
||||
constructor(client, data, channelId, guildId) {
|
||||
super(client);
|
||||
|
||||
/**
|
||||
* The id of the stage channel this invite is for
|
||||
* @type {Snowflake}
|
||||
*/
|
||||
this.channelId = channelId;
|
||||
|
||||
/**
|
||||
* The stage channel's guild id
|
||||
* @type {Snowflake}
|
||||
*/
|
||||
this.guildId = guildId;
|
||||
|
||||
/**
|
||||
* The members speaking in the stage channel
|
||||
* @type {Collection<Snowflake, GuildMember>}
|
||||
*/
|
||||
this.members = new Collection();
|
||||
|
||||
this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
if ('topic' in data) {
|
||||
/**
|
||||
* The topic of the stage instance
|
||||
* @type {string}
|
||||
*/
|
||||
this.topic = data.topic;
|
||||
}
|
||||
|
||||
if ('participant_count' in data) {
|
||||
/**
|
||||
* The number of users in the stage channel
|
||||
* @type {number}
|
||||
*/
|
||||
this.participantCount = data.participant_count;
|
||||
}
|
||||
|
||||
if ('speaker_count' in data) {
|
||||
/**
|
||||
* The number of users speaking in the stage channel
|
||||
* @type {number}
|
||||
*/
|
||||
this.speakerCount = data.speaker_count;
|
||||
}
|
||||
|
||||
this.members.clear();
|
||||
for (const rawMember of data.members) {
|
||||
const member = this.guild.members._add(rawMember);
|
||||
this.members.set(member.id, member);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The stage channel this invite is for
|
||||
* @type {?StageChannel}
|
||||
* @readonly
|
||||
*/
|
||||
get channel() {
|
||||
return this.client.channels.resolve(this.channelId);
|
||||
}
|
||||
|
||||
/**
|
||||
* The guild of the stage channel this invite is for
|
||||
* @type {?Guild}
|
||||
* @readonly
|
||||
*/
|
||||
get guild() {
|
||||
return this.client.guilds.resolve(this.guildId);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = InviteStageInstance;
|
||||
@@ -99,7 +99,6 @@ class MessageComponentInteraction extends BaseInteraction {
|
||||
deferUpdate() {}
|
||||
update() {}
|
||||
showModal() {}
|
||||
sendPremiumRequired() {}
|
||||
awaitModalSubmit() {}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,6 @@ class ModalSubmitInteraction extends BaseInteraction {
|
||||
followUp() {}
|
||||
deferUpdate() {}
|
||||
update() {}
|
||||
sendPremiumRequired() {}
|
||||
}
|
||||
|
||||
InteractionResponses.applyToClass(ModalSubmitInteraction, 'showModal');
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const process = require('node:process');
|
||||
const StringSelectMenuBuilder = require('./StringSelectMenuBuilder');
|
||||
|
||||
let deprecationEmitted = false;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link StringSelectMenuBuilder} instead.
|
||||
* @extends {StringSelectMenuBuilder}
|
||||
*/
|
||||
class SelectMenuBuilder extends StringSelectMenuBuilder {
|
||||
constructor(...params) {
|
||||
super(...params);
|
||||
|
||||
if (!deprecationEmitted) {
|
||||
process.emitWarning(
|
||||
'The SelectMenuBuilder class is deprecated. Use StringSelectMenuBuilder instead.',
|
||||
'DeprecationWarning',
|
||||
);
|
||||
deprecationEmitted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SelectMenuBuilder;
|
||||
@@ -1,26 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const process = require('node:process');
|
||||
const StringSelectMenuComponent = require('./StringSelectMenuComponent');
|
||||
|
||||
let deprecationEmitted = false;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link StringSelectMenuComponent} instead.
|
||||
* @extends {StringSelectMenuComponent}
|
||||
*/
|
||||
class SelectMenuComponent extends StringSelectMenuComponent {
|
||||
constructor(...params) {
|
||||
super(...params);
|
||||
|
||||
if (!deprecationEmitted) {
|
||||
process.emitWarning(
|
||||
'The SelectMenuComponent class is deprecated. Use StringSelectMenuComponent instead.',
|
||||
'DeprecationWarning',
|
||||
);
|
||||
deprecationEmitted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SelectMenuComponent;
|
||||
@@ -1,26 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const process = require('node:process');
|
||||
const StringSelectMenuInteraction = require('./StringSelectMenuInteraction');
|
||||
|
||||
let deprecationEmitted = false;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link StringSelectMenuInteraction} instead.
|
||||
* @extends {StringSelectMenuInteraction}
|
||||
*/
|
||||
class SelectMenuInteraction extends StringSelectMenuInteraction {
|
||||
constructor(...params) {
|
||||
super(...params);
|
||||
|
||||
if (!deprecationEmitted) {
|
||||
process.emitWarning(
|
||||
'The SelectMenuInteraction class is deprecated. Use StringSelectMenuInteraction instead.',
|
||||
'DeprecationWarning',
|
||||
);
|
||||
deprecationEmitted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SelectMenuInteraction;
|
||||
@@ -1,26 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const process = require('node:process');
|
||||
const StringSelectMenuOptionBuilder = require('./StringSelectMenuOptionBuilder');
|
||||
|
||||
let deprecationEmitted = false;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link StringSelectMenuOptionBuilder} instead.
|
||||
* @extends {StringSelectMenuOptionBuilder}
|
||||
*/
|
||||
class SelectMenuOptionBuilder extends StringSelectMenuOptionBuilder {
|
||||
constructor(...params) {
|
||||
super(...params);
|
||||
|
||||
if (!deprecationEmitted) {
|
||||
process.emitWarning(
|
||||
'The SelectMenuOptionBuilder class is deprecated. Use StringSelectMenuOptionBuilder instead.',
|
||||
'DeprecationWarning',
|
||||
);
|
||||
deprecationEmitted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SelectMenuOptionBuilder;
|
||||
@@ -53,17 +53,6 @@ class StageInstance extends Base {
|
||||
this.privacyLevel = data.privacy_level;
|
||||
}
|
||||
|
||||
if ('discoverable_disabled' in data) {
|
||||
/**
|
||||
* Whether or not stage discovery is disabled
|
||||
* @type {?boolean}
|
||||
* @deprecated See https://github.com/discord/discord-api-docs/pull/4296 for more information
|
||||
*/
|
||||
this.discoverableDisabled = data.discoverable_disabled;
|
||||
} else {
|
||||
this.discoverableDisabled ??= null;
|
||||
}
|
||||
|
||||
if ('guild_scheduled_event_id' in data) {
|
||||
/**
|
||||
* The associated guild scheduled event id of this stage instance
|
||||
|
||||
@@ -24,8 +24,8 @@ class StringSelectMenuBuilder extends BuildersSelectMenu {
|
||||
|
||||
/**
|
||||
* Normalizes a select menu option emoji
|
||||
* @param {SelectMenuOptionData|APISelectMenuOption} selectMenuOption The option to normalize
|
||||
* @returns {SelectMenuOptionBuilder|APISelectMenuOption}
|
||||
* @param {SelectMenuComponentOptionData|APISelectMenuOption} selectMenuOption The option to normalize
|
||||
* @returns {StringSelectMenuOptionBuilder|APISelectMenuOption}
|
||||
* @private
|
||||
*/
|
||||
static normalizeEmoji(selectMenuOption) {
|
||||
|
||||
@@ -20,15 +20,6 @@ class TeamMember extends Base {
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
if ('permissions' in data) {
|
||||
/**
|
||||
* The permissions this Team Member has with regard to the team
|
||||
* @type {string[]}
|
||||
* @deprecated Use {@link TeamMember#role} instead.
|
||||
*/
|
||||
this.permissions = data.permissions;
|
||||
}
|
||||
|
||||
if ('membership_state' in data) {
|
||||
/**
|
||||
* The permissions this Team Member has with regard to the team
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const { DiscordAPIError } = require('@discordjs/rest');
|
||||
const { lazy } = require('@discordjs/util');
|
||||
const { RESTJSONErrorCodes, ChannelFlags, ChannelType, PermissionFlagsBits, Routes } = require('discord-api-types/v10');
|
||||
const { ChannelFlags, ChannelType, PermissionFlagsBits, Routes } = require('discord-api-types/v10');
|
||||
const { BaseChannel } = require('./BaseChannel');
|
||||
const getThreadOnlyChannel = lazy(() => require('./ThreadOnlyChannel'));
|
||||
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
||||
@@ -299,15 +298,7 @@ class ThreadChannel extends BaseChannel {
|
||||
throw new DiscordjsError(ErrorCodes.FetchOwnerId, 'thread');
|
||||
}
|
||||
|
||||
// TODO: Remove that catch in the next major version
|
||||
const member = await this.members._fetchSingle({ ...options, member: this.ownerId }).catch(error => {
|
||||
if (error instanceof DiscordAPIError && error.code === RESTJSONErrorCodes.UnknownMember) {
|
||||
return null;
|
||||
}
|
||||
|
||||
throw error;
|
||||
});
|
||||
|
||||
const member = await this.members._fetchSingle({ ...options, member: this.ownerId });
|
||||
return member;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,17 +123,6 @@ class User extends Base {
|
||||
this.flags = new UserFlagsBitField(data.public_flags);
|
||||
}
|
||||
|
||||
if ('avatar_decoration' in data) {
|
||||
/**
|
||||
* The user avatar decoration's hash
|
||||
* @type {?string}
|
||||
* @deprecated Use `avatarDecorationData` instead
|
||||
*/
|
||||
this.avatarDecoration = data.avatar_decoration;
|
||||
} else {
|
||||
this.avatarDecoration ??= null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} AvatarDecorationData
|
||||
* @property {string} asset The avatar decoration hash
|
||||
@@ -192,15 +181,10 @@ class User extends Base {
|
||||
|
||||
/**
|
||||
* A link to the user's avatar decoration.
|
||||
* @param {BaseImageURLOptions} [options={}] Options for the image URL
|
||||
* @returns {?string}
|
||||
*/
|
||||
avatarDecorationURL(options = {}) {
|
||||
if (this.avatarDecorationData) {
|
||||
return this.client.rest.cdn.avatarDecoration(this.avatarDecorationData.asset);
|
||||
}
|
||||
|
||||
return this.avatarDecoration && this.client.rest.cdn.avatarDecoration(this.id, this.avatarDecoration, options);
|
||||
avatarDecorationURL() {
|
||||
return this.avatarDecorationData ? this.client.rest.cdn.avatarDecoration(this.avatarDecorationData.asset) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -311,7 +295,6 @@ class User extends Base {
|
||||
this.flags?.bitfield === user.flags?.bitfield &&
|
||||
this.banner === user.banner &&
|
||||
this.accentColor === user.accentColor &&
|
||||
this.avatarDecoration === user.avatarDecoration &&
|
||||
this.avatarDecorationData?.asset === user.avatarDecorationData?.asset &&
|
||||
this.avatarDecorationData?.skuId === user.avatarDecorationData?.skuId
|
||||
);
|
||||
@@ -334,7 +317,6 @@ class User extends Base {
|
||||
this.flags?.bitfield === user.public_flags &&
|
||||
('banner' in user ? this.banner === user.banner : true) &&
|
||||
('accent_color' in user ? this.accentColor === user.accent_color : true) &&
|
||||
('avatar_decoration' in user ? this.avatarDecoration === user.avatar_decoration : true) &&
|
||||
('avatar_decoration_data' in user
|
||||
? this.avatarDecorationData?.asset === user.avatar_decoration_data?.asset &&
|
||||
this.avatarDecorationData?.skuId === user.avatar_decoration_data?.sku_id
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const { deprecate } = require('node:util');
|
||||
const { isJSONEncodable } = require('@discordjs/util');
|
||||
const { InteractionResponseType, MessageFlags, Routes, InteractionType } = require('discord-api-types/v10');
|
||||
const { DiscordjsError, ErrorCodes } = require('../../errors');
|
||||
@@ -264,23 +263,6 @@ class InteractionResponses {
|
||||
this.replied = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Responds to the interaction with an upgrade button.
|
||||
* <info>Only available for applications with monetization enabled.</info>
|
||||
* @deprecated Sending a premium-style button is the new Discord behaviour.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async sendPremiumRequired() {
|
||||
if (this.deferred || this.replied) throw new DiscordjsError(ErrorCodes.InteractionAlreadyReplied);
|
||||
await this.client.rest.post(Routes.interactionCallback(this.id, this.token), {
|
||||
body: {
|
||||
type: InteractionResponseType.PremiumRequired,
|
||||
},
|
||||
auth: false,
|
||||
});
|
||||
this.replied = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* An object containing the same properties as {@link CollectorOptions}, but a few less:
|
||||
* @typedef {Object} AwaitModalSubmitOptions
|
||||
@@ -324,7 +306,6 @@ class InteractionResponses {
|
||||
'deferUpdate',
|
||||
'update',
|
||||
'showModal',
|
||||
'sendPremiumRequired',
|
||||
'awaitModalSubmit',
|
||||
];
|
||||
|
||||
@@ -339,10 +320,4 @@ class InteractionResponses {
|
||||
}
|
||||
}
|
||||
|
||||
InteractionResponses.prototype.sendPremiumRequired = deprecate(
|
||||
InteractionResponses.prototype.sendPremiumRequired,
|
||||
// eslint-disable-next-line max-len
|
||||
'InteractionResponses#sendPremiumRequired() is deprecated. Sending a premium-style button is the new Discord behaviour.',
|
||||
);
|
||||
|
||||
module.exports = InteractionResponses;
|
||||
|
||||
@@ -189,56 +189,6 @@ exports.UndeletableMessageTypes = [
|
||||
MessageType.ThreadStarterMessage,
|
||||
];
|
||||
|
||||
/**
|
||||
* The types of messages that can be deleted. The available types are:
|
||||
* * {@link MessageType.AutoModerationAction}
|
||||
* * {@link MessageType.ChannelFollowAdd}
|
||||
* * {@link MessageType.ChannelPinnedMessage}
|
||||
* * {@link MessageType.ChatInputCommand}
|
||||
* * {@link MessageType.ContextMenuCommand}
|
||||
* * {@link MessageType.Default}
|
||||
* * {@link MessageType.GuildBoost}
|
||||
* * {@link MessageType.GuildBoostTier1}
|
||||
* * {@link MessageType.GuildBoostTier2}
|
||||
* * {@link MessageType.GuildBoostTier3}
|
||||
* * {@link MessageType.GuildInviteReminder}
|
||||
* * {@link MessageType.InteractionPremiumUpsell}
|
||||
* * {@link MessageType.Reply}
|
||||
* * {@link MessageType.RoleSubscriptionPurchase}
|
||||
* * {@link MessageType.StageEnd}
|
||||
* * {@link MessageType.StageRaiseHand}
|
||||
* * {@link MessageType.StageSpeaker}
|
||||
* * {@link MessageType.StageStart}
|
||||
* * {@link MessageType.StageTopic}
|
||||
* * {@link MessageType.ThreadCreated}
|
||||
* * {@link MessageType.UserJoin}
|
||||
* @typedef {MessageType[]} DeletableMessageTypes
|
||||
* @deprecated This list will no longer be updated. Use {@link UndeletableMessageTypes} instead.
|
||||
*/
|
||||
exports.DeletableMessageTypes = [
|
||||
MessageType.AutoModerationAction,
|
||||
MessageType.ChannelFollowAdd,
|
||||
MessageType.ChannelPinnedMessage,
|
||||
MessageType.ChatInputCommand,
|
||||
MessageType.ContextMenuCommand,
|
||||
MessageType.Default,
|
||||
MessageType.GuildBoost,
|
||||
MessageType.GuildBoostTier1,
|
||||
MessageType.GuildBoostTier2,
|
||||
MessageType.GuildBoostTier3,
|
||||
MessageType.GuildInviteReminder,
|
||||
MessageType.InteractionPremiumUpsell,
|
||||
MessageType.Reply,
|
||||
MessageType.RoleSubscriptionPurchase,
|
||||
MessageType.StageEnd,
|
||||
MessageType.StageRaiseHand,
|
||||
MessageType.StageSpeaker,
|
||||
MessageType.StageStart,
|
||||
MessageType.StageTopic,
|
||||
MessageType.ThreadCreated,
|
||||
MessageType.UserJoin,
|
||||
];
|
||||
|
||||
/**
|
||||
* A mapping between sticker formats and their respective image formats.
|
||||
* * {@link StickerFormatType.PNG} -> {@link ImageFormat.PNG}
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
* @property {string} VoiceServerUpdate voiceServerUpdate
|
||||
* @property {string} VoiceStateUpdate voiceStateUpdate
|
||||
* @property {string} Warn warn
|
||||
* @property {string} WebhooksUpdate webhookUpdate
|
||||
* @property {string} WebhooksUpdate webhooksUpdate
|
||||
*/
|
||||
|
||||
// JSDoc for IntelliSense purposes
|
||||
@@ -168,5 +168,5 @@ module.exports = {
|
||||
VoiceServerUpdate: 'voiceServerUpdate',
|
||||
VoiceStateUpdate: 'voiceStateUpdate',
|
||||
Warn: 'warn',
|
||||
WebhooksUpdate: 'webhookUpdate',
|
||||
WebhooksUpdate: 'webhooksUpdate',
|
||||
};
|
||||
|
||||
@@ -1,413 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const { deprecate } = require('node:util');
|
||||
const {
|
||||
blockQuote,
|
||||
bold,
|
||||
channelMention,
|
||||
codeBlock,
|
||||
formatEmoji,
|
||||
hideLinkEmbed,
|
||||
hyperlink,
|
||||
inlineCode,
|
||||
italic,
|
||||
quote,
|
||||
roleMention,
|
||||
spoiler,
|
||||
strikethrough,
|
||||
time,
|
||||
TimestampStyles,
|
||||
underscore,
|
||||
userMention,
|
||||
} = require('@discordjs/formatters');
|
||||
|
||||
/**
|
||||
* Formats an application command name and id into an application command mention.
|
||||
* @method chatInputApplicationCommandMention
|
||||
* @param {string} commandName The name of the application command
|
||||
* @param {string|Snowflake} subcommandGroupOrSubOrId
|
||||
* The subcommand group name, subcommand name, or application command id
|
||||
* @param {string|Snowflake} [subcommandNameOrId] The subcommand name or application command id
|
||||
* @param {string} [commandId] The id of the application command
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wraps the content inside a code block with an optional language.
|
||||
* @method codeBlock
|
||||
* @param {string} contentOrLanguage The language to use or content if a second parameter isn't provided
|
||||
* @param {string} [content] The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wraps the content inside \`backticks\`, which formats it as inline code.
|
||||
* @method inlineCode
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats the content into italic text.
|
||||
* @method italic
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats the content into bold text.
|
||||
* @method bold
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats the content into underscored text.
|
||||
* @method underscore
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats the content into strike-through text.
|
||||
* @method strikethrough
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats the content into a quote.
|
||||
* <info>This needs to be at the start of the line for Discord to format it.</info>
|
||||
* @method quote
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats the content into a block quote.
|
||||
* <info>This needs to be at the start of the line for Discord to format it.</info>
|
||||
* @method blockQuote
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wraps the URL into `<>`, which stops it from embedding.
|
||||
* @method hideLinkEmbed
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats the content and the URL into a masked URL with an optional title.
|
||||
* @method hyperlink
|
||||
* @param {string} content The content to display
|
||||
* @param {string} url The URL the content links to
|
||||
* @param {string} [title] The title shown when hovering on the masked link
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats the content into spoiler text.
|
||||
* @method spoiler
|
||||
* @param {string} content The content to spoiler
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats a user id into a user mention.
|
||||
* @method userMention
|
||||
* @param {Snowflake} userId The user id to format
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats a channel id into a channel mention.
|
||||
* @method channelMention
|
||||
* @param {Snowflake} channelId The channel id to format
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats a role id into a role mention.
|
||||
* @method roleMention
|
||||
* @param {Snowflake} roleId The role id to format
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats an emoji id into a fully qualified emoji identifier.
|
||||
* @method formatEmoji
|
||||
* @param {Snowflake} emojiId The emoji id to format
|
||||
* @param {boolean} [animated=false] Whether the emoji is animated
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats a channel link for a channel.
|
||||
* @method channelLink
|
||||
* @param {Snowflake} channelId The id of the channel
|
||||
* @param {Snowflake} [guildId] The id of the guild
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats a message link for a channel.
|
||||
* @method messageLink
|
||||
* @param {Snowflake} channelId The id of the channel
|
||||
* @param {Snowflake} messageId The id of the message
|
||||
* @param {Snowflake} [guildId] The id of the guild
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* A message formatting timestamp style, as defined in
|
||||
* [here](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles).
|
||||
* * `t` Short time format, consisting of hours and minutes, e.g. 16:20.
|
||||
* * `T` Long time format, consisting of hours, minutes, and seconds, e.g. 16:20:30.
|
||||
* * `d` Short date format, consisting of day, month, and year, e.g. 20/04/2021.
|
||||
* * `D` Long date format, consisting of day, month, and year, e.g. 20 April 2021.
|
||||
* * `f` Short date-time format, consisting of short date and short time formats, e.g. 20 April 2021 16:20.
|
||||
* * `F` Long date-time format, consisting of long date and short time formats, e.g. Tuesday, 20 April 2021 16:20.
|
||||
* * `R` Relative time format, consisting of a relative duration format, e.g. 2 months ago.
|
||||
* @typedef {string} TimestampStylesString
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats a date into a short date-time string.
|
||||
* @method time
|
||||
* @param {number|Date} [date] The date to format
|
||||
* @param {TimestampStylesString} [style] The style to use
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains various Discord-specific functions for formatting messages.
|
||||
* @deprecated This class is redundant as all methods of the class can be imported from discord.js directly.
|
||||
*/
|
||||
class Formatters extends null {
|
||||
/**
|
||||
* Formats the content into a block quote.
|
||||
* <info>This needs to be at the start of the line for Discord to format it.</info>
|
||||
* @method blockQuote
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static blockQuote = deprecate(
|
||||
blockQuote,
|
||||
'Formatters.blockQuote() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats the content into bold text.
|
||||
* @method bold
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static bold = deprecate(
|
||||
bold,
|
||||
'Formatters.bold() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats a channel id into a channel mention.
|
||||
* @method channelMention
|
||||
* @memberof Formatters
|
||||
* @param {Snowflake} channelId The channel id to format
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static channelMention = deprecate(
|
||||
channelMention,
|
||||
'Formatters.channelMention() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Wraps the content inside a code block with an optional language.
|
||||
* @method codeBlock
|
||||
* @memberof Formatters
|
||||
* @param {string} contentOrLanguage The language to use or content if a second parameter isn't provided
|
||||
* @param {string} [content] The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static codeBlock = deprecate(
|
||||
codeBlock,
|
||||
'Formatters.codeBlock() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats an emoji id into a fully qualified emoji identifier.
|
||||
* @method formatEmoji
|
||||
* @memberof Formatters
|
||||
* @param {string} emojiId The emoji id to format
|
||||
* @param {boolean} [animated=false] Whether the emoji is animated
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static formatEmoji = deprecate(
|
||||
formatEmoji,
|
||||
'Formatters.formatEmoji() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Wraps the URL into `<>`, which stops it from embedding.
|
||||
* @method hideLinkEmbed
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static hideLinkEmbed = deprecate(
|
||||
hideLinkEmbed,
|
||||
'Formatters.hideLinkEmbed() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats the content and the URL into a masked URL with an optional title.
|
||||
* @method hyperlink
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to display
|
||||
* @param {string} url The URL the content links to
|
||||
* @param {string} [title] The title shown when hovering on the masked link
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static hyperlink = deprecate(
|
||||
hyperlink,
|
||||
'Formatters.hyperlink() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Wraps the content inside \`backticks\`, which formats it as inline code.
|
||||
* @method inlineCode
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static inlineCode = deprecate(
|
||||
inlineCode,
|
||||
'Formatters.inlineCode() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats the content into italic text.
|
||||
* @method italic
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static italic = deprecate(
|
||||
italic,
|
||||
'Formatters.italic() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats the content into a quote. This needs to be at the start of the line for Discord to format it.
|
||||
* @method quote
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static quote = deprecate(
|
||||
quote,
|
||||
'Formatters.quote() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats a role id into a role mention.
|
||||
* @method roleMention
|
||||
* @memberof Formatters
|
||||
* @param {Snowflake} roleId The role id to format
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static roleMention = deprecate(
|
||||
roleMention,
|
||||
'Formatters.roleMention() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats the content into spoiler text.
|
||||
* @method spoiler
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to spoiler
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static spoiler = deprecate(
|
||||
spoiler,
|
||||
'Formatters.spoiler() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats the content into strike-through text.
|
||||
* @method strikethrough
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static strikethrough = deprecate(
|
||||
strikethrough,
|
||||
'Formatters.strikethrough() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats a date into a short date-time string.
|
||||
* @method time
|
||||
* @memberof Formatters
|
||||
* @param {number|Date} [date] The date to format
|
||||
* @param {TimestampStylesString} [style] The style to use
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static time = deprecate(
|
||||
time,
|
||||
'Formatters.time() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* The message formatting timestamp
|
||||
* [styles](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles) supported by Discord.
|
||||
* @type {Object<string, TimestampStylesString>}
|
||||
* @memberof Formatters
|
||||
* @deprecated Import this property directly from discord.js instead.
|
||||
*/
|
||||
static TimestampStyles = TimestampStyles;
|
||||
|
||||
/**
|
||||
* Formats the content into underscored text.
|
||||
* @method underscore
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static underscore = deprecate(
|
||||
underscore,
|
||||
'Formatters.underscore() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats a user id into a user mention.
|
||||
* @method userMention
|
||||
* @memberof Formatters
|
||||
* @param {Snowflake} userId The user id to format
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static userMention = deprecate(
|
||||
userMention,
|
||||
'Formatters.userMention() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = Formatters;
|
||||
@@ -1,7 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
const { token, owner } = require('./auth.js');
|
||||
const { Client, Events, codeBlock, GatewayIntentBits } = require('../src');
|
||||
const { token, owner, skuId } = require('./auth.js');
|
||||
const { Client, Events, codeBlock, GatewayIntentBits, ActionRowBuilder, ButtonBuilder } = require('../src');
|
||||
const { ButtonStyle } = require('discord-api-types/v10');
|
||||
|
||||
const client = new Client({ intents: GatewayIntentBits.Guilds | GatewayIntentBits.GuildMessages });
|
||||
|
||||
@@ -35,7 +36,14 @@ client.on(Events.InteractionCreate, async interaction => {
|
||||
console.log('interaction.entitlements', interaction.entitlements);
|
||||
|
||||
if (interaction.commandName === 'test') {
|
||||
await interaction.sendPremiumRequired();
|
||||
await interaction.reply({
|
||||
content: ':3:3:3',
|
||||
components: [
|
||||
new ActionRowBuilder().setComponents(
|
||||
new ButtonBuilder().setCustomId('test').setLabel('test').setStyle(ButtonStyle.Premium).setSKUId(skuId),
|
||||
),
|
||||
],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
const process = require('node:process');
|
||||
const { GatewayIntentBits } = require('discord-api-types/v10');
|
||||
const { token, prefix, owner } = require('./auth.js');
|
||||
const { Client, Options, Formatters } = require('../src');
|
||||
const { Client, Options, codeBlock } = require('../src');
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
const log = (...args) => console.log(process.uptime().toFixed(3), ...args);
|
||||
@@ -44,7 +44,7 @@ const commands = {
|
||||
console.error(err.stack);
|
||||
res = err.message;
|
||||
}
|
||||
message.channel.send(Formatters.codeBlock(res));
|
||||
message.channel.send(codeBlock(res));
|
||||
},
|
||||
ping: message => message.channel.send('pong'),
|
||||
};
|
||||
|
||||
203
packages/discord.js/typings/index.d.ts
vendored
203
packages/discord.js/typings/index.d.ts
vendored
@@ -17,25 +17,6 @@ import {
|
||||
type RestOrArray,
|
||||
ApplicationCommandOptionAllowedChannelTypes,
|
||||
} from '@discordjs/builders';
|
||||
import {
|
||||
blockQuote,
|
||||
bold,
|
||||
channelMention,
|
||||
codeBlock,
|
||||
formatEmoji,
|
||||
hideLinkEmbed,
|
||||
hyperlink,
|
||||
inlineCode,
|
||||
italic,
|
||||
quote,
|
||||
roleMention,
|
||||
spoiler,
|
||||
strikethrough,
|
||||
time,
|
||||
TimestampStyles,
|
||||
underscore,
|
||||
userMention,
|
||||
} from '@discordjs/formatters';
|
||||
import { Awaitable, JSONEncodable } from '@discordjs/util';
|
||||
import { Collection, ReadonlyCollection } from '@discordjs/collection';
|
||||
import { BaseImageURLOptions, ImageURLOptions, RawFile, REST, RESTOptions } from '@discordjs/rest';
|
||||
@@ -220,7 +201,6 @@ import {
|
||||
RawInteractionData,
|
||||
RawInviteData,
|
||||
RawInviteGuildData,
|
||||
RawInviteStageInstance,
|
||||
RawMessageButtonInteractionData,
|
||||
RawMessageComponentInteractionData,
|
||||
RawMessageData,
|
||||
@@ -602,8 +582,6 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
|
||||
| ModalComponentData
|
||||
| APIModalInteractionResponseCallbackData,
|
||||
): Promise<void>;
|
||||
/** @deprecated Sending a premium-style button is the new Discord behaviour. */
|
||||
public sendPremiumRequired(): Promise<void>;
|
||||
public awaitModalSubmit(
|
||||
options: AwaitModalSubmitOptions<ModalSubmitInteraction>,
|
||||
): Promise<ModalSubmitInteraction<Cached>>;
|
||||
@@ -784,13 +762,6 @@ export class StringSelectMenuBuilder extends BuilderStringSelectMenuComponent {
|
||||
): StringSelectMenuBuilder;
|
||||
}
|
||||
|
||||
export {
|
||||
/** @deprecated Use {@link StringSelectMenuBuilder} instead */
|
||||
StringSelectMenuBuilder as SelectMenuBuilder,
|
||||
/** @deprecated Use {@link StringSelectMenuOptionBuilder} instead */
|
||||
StringSelectMenuOptionBuilder as SelectMenuOptionBuilder,
|
||||
};
|
||||
|
||||
export class UserSelectMenuBuilder extends BuilderUserSelectMenuComponent {
|
||||
public constructor(data?: Partial<UserSelectMenuComponentData | APIUserSelectComponent>);
|
||||
public static from(other: JSONEncodable<APIUserSelectComponent> | APIUserSelectComponent): UserSelectMenuBuilder;
|
||||
@@ -851,11 +822,6 @@ export class StringSelectMenuComponent extends BaseSelectMenuComponent<APIString
|
||||
public get options(): APISelectMenuOption[];
|
||||
}
|
||||
|
||||
export {
|
||||
/** @deprecated Use {@link StringSelectMenuComponent} instead */
|
||||
StringSelectMenuComponent as SelectMenuComponent,
|
||||
};
|
||||
|
||||
export class UserSelectMenuComponent extends BaseSelectMenuComponent<APIUserSelectComponent> {}
|
||||
|
||||
export class RoleSelectMenuComponent extends BaseSelectMenuComponent<APIRoleSelectComponent> {}
|
||||
@@ -1033,8 +999,6 @@ export class Client<Ready extends boolean = boolean> extends BaseClient {
|
||||
public fetchSticker(id: Snowflake): Promise<Sticker>;
|
||||
public fetchStickerPacks(options: { packId: Snowflake }): Promise<StickerPack>;
|
||||
public fetchStickerPacks(options?: StickerPackFetchOptions): Promise<Collection<Snowflake, StickerPack>>;
|
||||
/** @deprecated Use {@link Client.fetchStickerPacks} instead. */
|
||||
public fetchPremiumStickerPacks(): ReturnType<Client['fetchStickerPacks']>;
|
||||
public fetchWebhook(id: Snowflake, token?: string): Promise<Webhook>;
|
||||
public fetchGuildWidget(guild: GuildResolvable): Promise<Widget>;
|
||||
public generateInvite(options?: InviteGenerationOptions): string;
|
||||
@@ -1932,7 +1896,7 @@ export type Interaction<Cached extends CacheType = CacheType> =
|
||||
| ChatInputCommandInteraction<Cached>
|
||||
| MessageContextMenuCommandInteraction<Cached>
|
||||
| UserContextMenuCommandInteraction<Cached>
|
||||
| AnySelectMenuInteraction<Cached>
|
||||
| SelectMenuInteraction<Cached>
|
||||
| ButtonInteraction<Cached>
|
||||
| AutocompleteInteraction<Cached>
|
||||
| ModalSubmitInteraction<Cached>;
|
||||
@@ -1984,9 +1948,7 @@ export class BaseInteraction<Cached extends CacheType = CacheType> extends Base
|
||||
public isMessageContextMenuCommand(): this is MessageContextMenuCommandInteraction<Cached>;
|
||||
public isModalSubmit(): this is ModalSubmitInteraction<Cached>;
|
||||
public isUserContextMenuCommand(): this is UserContextMenuCommandInteraction<Cached>;
|
||||
/** @deprecated Use {@link BaseInteraction.isStringSelectMenu} instead. */
|
||||
public isSelectMenu(): this is StringSelectMenuInteraction<Cached>;
|
||||
public isAnySelectMenu(): this is AnySelectMenuInteraction<Cached>;
|
||||
public isAnySelectMenu(): this is SelectMenuInteraction<Cached>;
|
||||
public isStringSelectMenu(): this is StringSelectMenuInteraction<Cached>;
|
||||
public isUserSelectMenu(): this is UserSelectMenuInteraction<Cached>;
|
||||
public isRoleSelectMenu(): this is RoleSelectMenuInteraction<Cached>;
|
||||
@@ -2075,24 +2037,9 @@ export class Invite extends Base {
|
||||
public toJSON(): unknown;
|
||||
public toString(): string;
|
||||
public static InvitesPattern: RegExp;
|
||||
/** @deprecated Public Stage Instances don't exist anymore */
|
||||
public stageInstance: InviteStageInstance | null;
|
||||
public guildScheduledEvent: GuildScheduledEvent | null;
|
||||
}
|
||||
|
||||
/** @deprecated Public Stage Instances don't exist anymore */
|
||||
export class InviteStageInstance extends Base {
|
||||
private constructor(client: Client<true>, data: RawInviteStageInstance, channelId: Snowflake, guildId: Snowflake);
|
||||
public channelId: Snowflake;
|
||||
public guildId: Snowflake;
|
||||
public members: Collection<Snowflake, GuildMember>;
|
||||
public topic: string;
|
||||
public participantCount: number;
|
||||
public speakerCount: number;
|
||||
public get channel(): StageChannel | null;
|
||||
public get guild(): Guild | null;
|
||||
}
|
||||
|
||||
export class InviteGuild extends AnonymousGuild {
|
||||
private constructor(client: Client<true>, data: RawInviteGuildData);
|
||||
public welcomeScreen: WelcomeScreen | null;
|
||||
@@ -2352,8 +2299,6 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
|
||||
| ModalComponentData
|
||||
| APIModalInteractionResponseCallbackData,
|
||||
): Promise<void>;
|
||||
/** @deprecated Sending a premium-style button is the new Discord behaviour. */
|
||||
public sendPremiumRequired(): Promise<void>;
|
||||
public awaitModalSubmit(
|
||||
options: AwaitModalSubmitOptions<ModalSubmitInteraction>,
|
||||
): Promise<ModalSubmitInteraction<Cached>>;
|
||||
@@ -2559,8 +2504,6 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
|
||||
options: InteractionDeferUpdateOptions & { fetchReply: true },
|
||||
): Promise<Message<BooleanCache<Cached>>>;
|
||||
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<InteractionResponse<BooleanCache<Cached>>>;
|
||||
/** @deprecated Sending a premium-style button is the new Discord behaviour. */
|
||||
public sendPremiumRequired(): Promise<void>;
|
||||
public inGuild(): this is ModalSubmitInteraction<'raw' | 'cached'>;
|
||||
public inCachedGuild(): this is ModalSubmitInteraction<'cached'>;
|
||||
public inRawGuild(): this is ModalSubmitInteraction<'raw'>;
|
||||
@@ -2861,11 +2804,6 @@ export class StringSelectMenuInteraction<
|
||||
public inRawGuild(): this is StringSelectMenuInteraction<'raw'>;
|
||||
}
|
||||
|
||||
export {
|
||||
/** @deprecated Use {@link StringSelectMenuInteraction} instead */
|
||||
StringSelectMenuInteraction as SelectMenuInteraction,
|
||||
};
|
||||
|
||||
export class UserSelectMenuInteraction<
|
||||
Cached extends CacheType = CacheType,
|
||||
> extends MessageComponentInteraction<Cached> {
|
||||
@@ -2956,8 +2894,7 @@ export class ChannelSelectMenuInteraction<
|
||||
|
||||
// Ideally this should be named SelectMenuInteraction, but that's the name of the "old" StringSelectMenuInteraction, meaning
|
||||
// the type name is reserved as a re-export to prevent a breaking change from being made, as such:
|
||||
// TODO: Rename this to SelectMenuInteraction in the next major
|
||||
export type AnySelectMenuInteraction<Cached extends CacheType = CacheType> =
|
||||
export type SelectMenuInteraction<Cached extends CacheType = CacheType> =
|
||||
| StringSelectMenuInteraction<Cached>
|
||||
| UserSelectMenuInteraction<Cached>
|
||||
| RoleSelectMenuInteraction<Cached>
|
||||
@@ -3142,8 +3079,6 @@ export class StageInstance extends Base {
|
||||
public channelId: Snowflake;
|
||||
public topic: string;
|
||||
public privacyLevel: StageInstancePrivacyLevel;
|
||||
/** @deprecated See https://github.com/discord/discord-api-docs/pull/4296 for more information */
|
||||
public discoverableDisabled: boolean | null;
|
||||
public guildScheduledEventId?: Snowflake;
|
||||
public get channel(): StageChannel | null;
|
||||
public get guild(): Guild | null;
|
||||
@@ -3296,8 +3231,6 @@ export class TeamMember extends Base {
|
||||
private constructor(team: Team, data: RawTeamMemberData);
|
||||
public team: Team;
|
||||
public get id(): Snowflake;
|
||||
/** @deprecated Use {@link TeamMember.role} instead. */
|
||||
public permissions: string[];
|
||||
public membershipState: TeamMemberMembershipState;
|
||||
public user: User;
|
||||
public role: TeamMemberRole;
|
||||
@@ -3433,8 +3366,6 @@ export class User extends Base {
|
||||
|
||||
public accentColor: number | null | undefined;
|
||||
public avatar: string | null;
|
||||
/** @deprecated Use {@link User.avatarDecorationData} instead */
|
||||
public avatarDecoration: string | null;
|
||||
public avatarDecorationData: AvatarDecorationData | null;
|
||||
public banner: string | null | undefined;
|
||||
public bot: boolean;
|
||||
@@ -3588,44 +3519,6 @@ export function createComponentBuilder<Type extends keyof MappedComponentBuilder
|
||||
export function createComponentBuilder<Data extends ComponentBuilder>(data: Data): Data;
|
||||
export function createComponentBuilder(data: APIMessageComponent | ComponentBuilder): ComponentBuilder;
|
||||
|
||||
/** @deprecated This class is redundant as all methods of the class can be imported from discord.js directly. */
|
||||
export class Formatters extends null {
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static blockQuote: typeof blockQuote;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static bold: typeof bold;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static channelMention: typeof channelMention;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static codeBlock: typeof codeBlock;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static formatEmoji: typeof formatEmoji;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static hideLinkEmbed: typeof hideLinkEmbed;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static hyperlink: typeof hyperlink;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static inlineCode: typeof inlineCode;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static italic: typeof italic;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static quote: typeof quote;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static roleMention: typeof roleMention;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static spoiler: typeof spoiler;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static strikethrough: typeof strikethrough;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static time: typeof time;
|
||||
/** @deprecated Import this property directly from discord.js instead. */
|
||||
public static TimestampStyles: typeof TimestampStyles;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static underscore: typeof underscore;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static userMention: typeof userMention;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function resolveBase64(data: Base64Resolvable): string;
|
||||
/** @internal */
|
||||
@@ -3869,30 +3762,6 @@ export type UndeletableMessageType =
|
||||
| MessageType.ChannelIconChange
|
||||
| MessageType.ThreadStarterMessage;
|
||||
|
||||
/** @deprecated This type will no longer be updated. Use {@link UndeletableMessageType} instead. */
|
||||
export type DeletableMessageType =
|
||||
| MessageType.AutoModerationAction
|
||||
| MessageType.ChannelFollowAdd
|
||||
| MessageType.ChannelPinnedMessage
|
||||
| MessageType.ChatInputCommand
|
||||
| MessageType.ContextMenuCommand
|
||||
| MessageType.Default
|
||||
| MessageType.GuildBoost
|
||||
| MessageType.GuildBoostTier1
|
||||
| MessageType.GuildBoostTier2
|
||||
| MessageType.GuildBoostTier3
|
||||
| MessageType.GuildInviteReminder
|
||||
| MessageType.InteractionPremiumUpsell
|
||||
| MessageType.Reply
|
||||
| MessageType.RoleSubscriptionPurchase
|
||||
| MessageType.StageEnd
|
||||
| MessageType.StageRaiseHand
|
||||
| MessageType.StageSpeaker
|
||||
| MessageType.StageStart
|
||||
| MessageType.StageTopic
|
||||
| MessageType.ThreadCreated
|
||||
| MessageType.UserJoin;
|
||||
|
||||
export const Constants: {
|
||||
MaxBulkDeletableMessageAge: 1_209_600_000;
|
||||
SweeperKeys: SweeperKey[];
|
||||
@@ -3904,8 +3773,6 @@ export const Constants: {
|
||||
VoiceBasedChannelTypes: VoiceBasedChannelTypes[];
|
||||
SelectMenuTypes: SelectMenuType[];
|
||||
UndeletableMessageTypes: UndeletableMessageType[];
|
||||
/** @deprecated This list will no longer be updated. Use {@link Constants.UndeletableMessageTypes} instead. */
|
||||
DeletableMessageTypes: DeletableMessageType[];
|
||||
StickerFormatExtensionMap: Record<StickerFormatType, ImageFormat>;
|
||||
};
|
||||
|
||||
@@ -3924,25 +3791,8 @@ export enum DiscordjsErrorCodes {
|
||||
TokenMissing = 'TokenMissing',
|
||||
ApplicationCommandPermissionsTokenMissing = 'ApplicationCommandPermissionsTokenMissing',
|
||||
|
||||
/** @deprecated WebSocket errors are now handled in `@discordjs/ws` */
|
||||
WSCloseRequested = 'WSCloseRequested',
|
||||
/** @deprecated WebSocket errors are now handled in `@discordjs/ws` */
|
||||
WSConnectionExists = 'WSConnectionExists',
|
||||
/** @deprecated WebSocket errors are now handled in `@discordjs/ws` */
|
||||
WSNotOpen = 'WSNotOpen',
|
||||
/** @deprecated No longer in use */
|
||||
ManagerDestroyed = 'ManagerDestroyed',
|
||||
|
||||
BitFieldInvalid = 'BitFieldInvalid',
|
||||
|
||||
/** @deprecated This error is now handled in `@discordjs/ws` */
|
||||
ShardingInvalid = 'ShardingInvalid',
|
||||
/** @deprecated This error is now handled in `@discordjs/ws` */
|
||||
ShardingRequired = 'ShardingRequired',
|
||||
/** @deprecated This error is now handled in `@discordjs/ws` */
|
||||
InvalidIntents = 'InvalidIntents',
|
||||
/** @deprecated This error is now handled in `@discordjs/ws` */
|
||||
DisallowedIntents = 'DisallowedIntents',
|
||||
ShardingNoShards = 'ShardingNoShards',
|
||||
ShardingInProcess = 'ShardingInProcess',
|
||||
ShardingInvalidEvalBroadcast = 'ShardingInvalidEvalBroadcast',
|
||||
@@ -3961,30 +3811,10 @@ export enum DiscordjsErrorCodes {
|
||||
|
||||
InviteOptionsMissingChannel = 'InviteOptionsMissingChannel',
|
||||
|
||||
/** @deprecated Button validation errors are now handled in `@discordjs/builders` */
|
||||
ButtonLabel = 'ButtonLabel',
|
||||
/** @deprecated Button validation errors are now handled in `@discordjs/builders` */
|
||||
ButtonURL = 'ButtonURL',
|
||||
/** @deprecated Button validation errors are now handled in `@discordjs/builders` */
|
||||
ButtonCustomId = 'ButtonCustomId',
|
||||
|
||||
/** @deprecated Select Menu validation errors are now handled in `@discordjs/builders` */
|
||||
SelectMenuCustomId = 'SelectMenuCustomId',
|
||||
/** @deprecated Select Menu validation errors are now handled in `@discordjs/builders` */
|
||||
SelectMenuPlaceholder = 'SelectMenuPlaceholder',
|
||||
/** @deprecated Select Menu validation errors are now handled in `@discordjs/builders` */
|
||||
SelectOptionLabel = 'SelectOptionLabel',
|
||||
/** @deprecated Select Menu validation errors are now handled in `@discordjs/builders` */
|
||||
SelectOptionValue = 'SelectOptionValue',
|
||||
/** @deprecated Select Menu validation errors are now handled in `@discordjs/builders` */
|
||||
SelectOptionDescription = 'SelectOptionDescription',
|
||||
|
||||
InteractionCollectorError = 'InteractionCollectorError',
|
||||
|
||||
FileNotFound = 'FileNotFound',
|
||||
|
||||
/** @deprecated No longer in use */
|
||||
UserBannerNotFetched = 'UserBannerNotFetched',
|
||||
UserNoDMChannel = 'UserNoDMChannel',
|
||||
|
||||
VoiceNotStageChannel = 'VoiceNotStageChannel',
|
||||
@@ -3994,19 +3824,11 @@ export enum DiscordjsErrorCodes {
|
||||
|
||||
ReqResourceType = 'ReqResourceType',
|
||||
|
||||
/** @deprecated This error is now handled in `@discordjs/rest` */
|
||||
ImageFormat = 'ImageFormat',
|
||||
/** @deprecated This error is now handled in `@discordjs/rest` */
|
||||
ImageSize = 'ImageSize',
|
||||
|
||||
MessageBulkDeleteType = 'MessageBulkDeleteType',
|
||||
MessageContentType = 'MessageContentType',
|
||||
MessageNonceRequired = 'MessageNonceRequired',
|
||||
MessageNonceType = 'MessageNonceType',
|
||||
|
||||
/** @deprecated No longer in use */
|
||||
SplitMaxLen = 'SplitMaxLen',
|
||||
|
||||
BanResolveId = 'BanResolveId',
|
||||
FetchBanResolveId = 'FetchBanResolveId',
|
||||
|
||||
@@ -4040,16 +3862,11 @@ export enum DiscordjsErrorCodes {
|
||||
EmojiType = 'EmojiType',
|
||||
EmojiManaged = 'EmojiManaged',
|
||||
MissingManageGuildExpressionsPermission = 'MissingManageGuildExpressionsPermission',
|
||||
/** @deprecated Use {@link DiscordjsErrorCodes.MissingManageGuildExpressionsPermission} instead. */
|
||||
MissingManageEmojisAndStickersPermission = 'MissingManageEmojisAndStickersPermission',
|
||||
|
||||
NotGuildSticker = 'NotGuildSticker',
|
||||
|
||||
ReactionResolveUser = 'ReactionResolveUser',
|
||||
|
||||
/** @deprecated Not used anymore since the introduction of `GUILD_WEB_PAGE_VANITY_URL` feature */
|
||||
VanityURL = 'VanityURL',
|
||||
|
||||
InviteResolveCode = 'InviteResolveCode',
|
||||
|
||||
InviteNotFound = 'InviteNotFound',
|
||||
@@ -4064,8 +3881,6 @@ export enum DiscordjsErrorCodes {
|
||||
|
||||
InteractionAlreadyReplied = 'InteractionAlreadyReplied',
|
||||
InteractionNotReplied = 'InteractionNotReplied',
|
||||
/** @deprecated Not used anymore since ephemeral replies can now be deleted */
|
||||
InteractionEphemeralReplied = 'InteractionEphemeralReplied',
|
||||
|
||||
CommandInteractionOptionNotFound = 'CommandInteractionOptionNotFound',
|
||||
CommandInteractionOptionType = 'CommandInteractionOptionType',
|
||||
@@ -4417,7 +4232,7 @@ export class GuildMemberManager extends CachedManager<Snowflake, GuildMember, Gu
|
||||
public ban(user: UserResolvable, options?: BanOptions): Promise<GuildMember | User | Snowflake>;
|
||||
public bulkBan(
|
||||
users: ReadonlyCollection<Snowflake, UserResolvable> | readonly UserResolvable[],
|
||||
options?: BulkBanOptions,
|
||||
options?: BanOptions,
|
||||
): Promise<BulkBanResult>;
|
||||
public edit(user: UserResolvable, options: GuildMemberEditOptions): Promise<GuildMember>;
|
||||
public fetch(
|
||||
@@ -4444,7 +4259,7 @@ export class GuildBanManager extends CachedManager<Snowflake, GuildBan, GuildBan
|
||||
public remove(user: UserResolvable, reason?: string): Promise<User | null>;
|
||||
public bulkCreate(
|
||||
users: ReadonlyCollection<Snowflake, UserResolvable> | readonly UserResolvable[],
|
||||
options?: BulkBanOptions,
|
||||
options?: BanOptions,
|
||||
): Promise<BulkBanResult>;
|
||||
}
|
||||
|
||||
@@ -5147,14 +4962,10 @@ export interface AwaitReactionsOptions extends ReactionCollectorOptions {
|
||||
}
|
||||
|
||||
export interface BanOptions {
|
||||
/** @deprecated Use {@link BanOptions.deleteMessageSeconds} instead. */
|
||||
deleteMessageDays?: number;
|
||||
deleteMessageSeconds?: number;
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
export interface BulkBanOptions extends Omit<BanOptions, 'deleteMessageDays'> {}
|
||||
|
||||
export interface BulkBanResult {
|
||||
bannedUsers: readonly Snowflake[];
|
||||
failedUsers: readonly Snowflake[];
|
||||
@@ -5390,8 +5201,6 @@ export interface ClientEvents {
|
||||
typingStart: [typing: Typing];
|
||||
userUpdate: [oldUser: User | PartialUser, newUser: User];
|
||||
voiceStateUpdate: [oldState: VoiceState, newState: VoiceState];
|
||||
/** @deprecated Use {@link ClientEvents.webhooksUpdate} instead. */
|
||||
webhookUpdate: ClientEvents['webhooksUpdate'];
|
||||
webhooksUpdate: [channel: TextChannel | NewsChannel | VoiceChannel | ForumChannel | MediaChannel];
|
||||
interactionCreate: [interaction: Interaction];
|
||||
shardDisconnect: [closeEvent: CloseEvent, shardId: number];
|
||||
@@ -5603,7 +5412,7 @@ export enum Events {
|
||||
VoiceServerUpdate = 'voiceServerUpdate',
|
||||
VoiceStateUpdate = 'voiceStateUpdate',
|
||||
TypingStart = 'typingStart',
|
||||
WebhooksUpdate = 'webhookUpdate',
|
||||
WebhooksUpdate = 'webhooksUpdate',
|
||||
InteractionCreate = 'interactionCreate',
|
||||
Error = 'error',
|
||||
Warn = 'warn',
|
||||
|
||||
@@ -108,7 +108,7 @@ import {
|
||||
StageInstance,
|
||||
ActionRowBuilder,
|
||||
ButtonComponent,
|
||||
SelectMenuComponent,
|
||||
StringSelectMenuComponent,
|
||||
RepliableInteraction,
|
||||
ThreadChannelType,
|
||||
Events,
|
||||
@@ -152,9 +152,8 @@ import {
|
||||
ChannelFlagsBitField,
|
||||
GuildForumThreadManager,
|
||||
GuildTextThreadManager,
|
||||
AnySelectMenuInteraction,
|
||||
SelectMenuInteraction,
|
||||
StringSelectMenuInteraction,
|
||||
StringSelectMenuComponent,
|
||||
UserSelectMenuInteraction,
|
||||
RoleSelectMenuInteraction,
|
||||
ChannelSelectMenuInteraction,
|
||||
@@ -213,7 +212,7 @@ import {
|
||||
SendableChannels,
|
||||
PollData,
|
||||
} from '.';
|
||||
import { expectAssignable, expectDeprecated, expectNotAssignable, expectNotType, expectType } from 'tsd';
|
||||
import { expectAssignable, expectNotAssignable, expectNotType, expectType } from 'tsd';
|
||||
import type { ContextMenuCommandBuilder, SlashCommandBuilder } from '@discordjs/builders';
|
||||
import { ReadonlyCollection } from '@discordjs/collection';
|
||||
|
||||
@@ -1780,10 +1779,9 @@ if (interaction.inGuild()) {
|
||||
|
||||
client.on('interactionCreate', async interaction => {
|
||||
if (interaction.type === InteractionType.MessageComponent) {
|
||||
expectType<AnySelectMenuInteraction | ButtonInteraction>(interaction);
|
||||
expectType<SelectMenuInteraction | ButtonInteraction>(interaction);
|
||||
expectType<MessageActionRowComponent | APIButtonComponent | APISelectMenuComponent>(interaction.component);
|
||||
expectType<Message>(interaction.message);
|
||||
expectDeprecated(interaction.sendPremiumRequired());
|
||||
if (interaction.inCachedGuild()) {
|
||||
expectAssignable<MessageComponentInteraction>(interaction);
|
||||
expectType<MessageActionRowComponent>(interaction.component);
|
||||
@@ -1948,7 +1946,7 @@ client.on('interactionCreate', async interaction => {
|
||||
expectType<Message>(interaction.message);
|
||||
if (interaction.inCachedGuild()) {
|
||||
expectAssignable<StringSelectMenuInteraction>(interaction);
|
||||
expectType<SelectMenuComponent>(interaction.component);
|
||||
expectType<StringSelectMenuComponent>(interaction.component);
|
||||
expectType<Message<true>>(interaction.message);
|
||||
expectType<Guild>(interaction.guild);
|
||||
expectType<Promise<Message<true>>>(interaction.reply({ fetchReply: true }));
|
||||
@@ -1960,7 +1958,7 @@ client.on('interactionCreate', async interaction => {
|
||||
expectType<Promise<Message<false>>>(interaction.reply({ fetchReply: true }));
|
||||
} else if (interaction.inGuild()) {
|
||||
expectAssignable<StringSelectMenuInteraction>(interaction);
|
||||
expectType<SelectMenuComponent | APIStringSelectComponent>(interaction.component);
|
||||
expectType<StringSelectMenuComponent | APIStringSelectComponent>(interaction.component);
|
||||
expectType<Message>(interaction.message);
|
||||
expectType<Guild | null>(interaction.guild);
|
||||
expectType<Promise<Message>>(interaction.reply({ fetchReply: true }));
|
||||
@@ -1971,7 +1969,6 @@ client.on('interactionCreate', async interaction => {
|
||||
interaction.type === InteractionType.ApplicationCommand &&
|
||||
interaction.commandType === ApplicationCommandType.ChatInput
|
||||
) {
|
||||
expectDeprecated(interaction.sendPremiumRequired());
|
||||
if (interaction.inRawGuild()) {
|
||||
expectNotAssignable<Interaction<'cached'>>(interaction);
|
||||
expectAssignable<ChatInputCommandInteraction>(interaction);
|
||||
@@ -2095,10 +2092,6 @@ client.on('interactionCreate', async interaction => {
|
||||
expectType<Promise<Message>>(interaction.followUp({ content: 'a' }));
|
||||
}
|
||||
}
|
||||
|
||||
if (interaction.isModalSubmit()) {
|
||||
expectDeprecated(interaction.sendPremiumRequired());
|
||||
}
|
||||
});
|
||||
|
||||
declare const shard: Shard;
|
||||
@@ -2422,10 +2415,10 @@ expectType<null>(partialGroupDMChannel.flags);
|
||||
|
||||
// Select menu type narrowing
|
||||
if (interaction.isAnySelectMenu()) {
|
||||
expectType<AnySelectMenuInteraction>(interaction);
|
||||
expectType<SelectMenuInteraction>(interaction);
|
||||
}
|
||||
|
||||
declare const anySelectMenu: AnySelectMenuInteraction;
|
||||
declare const anySelectMenu: SelectMenuInteraction;
|
||||
|
||||
if (anySelectMenu.isStringSelectMenu()) {
|
||||
expectType<StringSelectMenuInteraction>(anySelectMenu);
|
||||
@@ -2559,10 +2552,6 @@ declare const sku: SKU;
|
||||
|
||||
client.on(Events.InteractionCreate, async interaction => {
|
||||
expectType<Collection<Snowflake, Entitlement>>(interaction.entitlements);
|
||||
|
||||
if (interaction.isRepliable()) {
|
||||
await interaction.sendPremiumRequired();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import {
|
||||
APIInteractionDataResolvedGuildMember,
|
||||
APIInteractionGuildMember,
|
||||
APIInvite,
|
||||
APIInviteStageInstance,
|
||||
APIMessage,
|
||||
APIMessageButtonInteractionData,
|
||||
APIMessageComponentInteraction,
|
||||
@@ -148,8 +147,6 @@ export type RawInviteData =
|
||||
| (GatewayInviteCreateDispatchData & { channel: GuildChannel; guild: Guild })
|
||||
| (GatewayInviteDeleteDispatchData & { channel: GuildChannel; guild: Guild });
|
||||
|
||||
export type RawInviteStageInstance = APIInviteStageInstance;
|
||||
|
||||
export type RawMessageData = APIMessage;
|
||||
export type RawPartialMessageData = GatewayMessageUpdateDispatchData;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user