Skip to content

Commit

Permalink
chore!: remove all deprecated features/props (#10421)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
didinele authored Oct 4, 2024
1 parent c1b849f commit 12e5106
Show file tree
Hide file tree
Showing 35 changed files with 45 additions and 1,228 deletions.
20 changes: 0 additions & 20 deletions packages/discord.js/src/client/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand Down
19 changes: 2 additions & 17 deletions packages/discord.js/src/client/actions/WebhooksUpdate.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
'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) {
const client = this.client;
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);
}
}

Expand Down
85 changes: 2 additions & 83 deletions packages/discord.js/src/errors/ErrorCodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {'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 {'BitFieldInvalid'} BitFieldInvalid
* @property {'ShardingNoShards'} ShardingNoShards
* @property {'ShardingInProcess'} ShardingInProcess
* @property {'ShardingInvalidEvalBroadcast'} ShardingInvalidEvalBroadcast
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -192,17 +140,8 @@ const keys = [
'TokenMissing',
'ApplicationCommandPermissionsTokenMissing',

'WSCloseRequested',
'WSConnectionExists',
'WSNotOpen',
'ManagerDestroyed',

'BitFieldInvalid',

'ShardingInvalid',
'ShardingRequired',
'InvalidIntents',
'DisallowedIntents',
'ShardingNoShards',
'ShardingInProcess',
'ShardingInvalidEvalBroadcast',
Expand All @@ -221,21 +160,10 @@ const keys = [

'InviteOptionsMissingChannel',

'ButtonLabel',
'ButtonURL',
'ButtonCustomId',

'SelectMenuCustomId',
'SelectMenuPlaceholder',
'SelectOptionLabel',
'SelectOptionValue',
'SelectOptionDescription',

'InteractionCollectorError',

'FileNotFound',

'UserBannerNotFetched',
'UserNoDMChannel',

'VoiceNotStageChannel',
Expand All @@ -245,16 +173,11 @@ const keys = [

'ReqResourceType',

'ImageFormat',
'ImageSize',

'MessageBulkDeleteType',
'MessageContentType',
'MessageNonceRequired',
'MessageNonceType',

'SplitMaxLen',

'BanResolveId',
'FetchBanResolveId',

Expand Down Expand Up @@ -288,14 +211,11 @@ const keys = [
'EmojiType',
'EmojiManaged',
'MissingManageGuildExpressionsPermission',
'MissingManageEmojisAndStickersPermission',

'NotGuildSticker',

'ReactionResolveUser',

'VanityURL',

'InviteResolveCode',

'InviteNotFound',
Expand All @@ -310,7 +230,6 @@ const keys = [

'InteractionAlreadyReplied',
'InteractionNotReplied',
'InteractionEphemeralReplied',

'CommandInteractionOptionNotFound',
'CommandInteractionOptionType',
Expand Down
30 changes: 0 additions & 30 deletions packages/discord.js/src/errors/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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.',
Expand All @@ -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.",

Expand Down Expand Up @@ -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.',
Expand All @@ -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) =>
Expand Down
6 changes: 0 additions & 6 deletions packages/discord.js/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand All @@ -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');
Expand Down
Loading

0 comments on commit 12e5106

Please sign in to comment.