diff options
Diffstat (limited to 'node_modules/discord.js/src/errors')
-rw-r--r-- | node_modules/discord.js/src/errors/DJSError.js | 48 | ||||
-rw-r--r-- | node_modules/discord.js/src/errors/ErrorCodes.js | 319 | ||||
-rw-r--r-- | node_modules/discord.js/src/errors/Messages.js | 170 | ||||
-rw-r--r-- | node_modules/discord.js/src/errors/index.js | 5 |
4 files changed, 542 insertions, 0 deletions
diff --git a/node_modules/discord.js/src/errors/DJSError.js b/node_modules/discord.js/src/errors/DJSError.js new file mode 100644 index 0000000..88e0e72 --- /dev/null +++ b/node_modules/discord.js/src/errors/DJSError.js @@ -0,0 +1,48 @@ +'use strict'; + +// Heavily inspired by node's `internal/errors` module +const ErrorCodes = require('./ErrorCodes'); +const Messages = require('./Messages'); + +/** + * Extend an error of some sort into a DiscordjsError. + * @param {Error} Base Base error to extend + * @returns {DiscordjsError} + * @ignore + */ +function makeDiscordjsError(Base) { + return class DiscordjsError extends Base { + constructor(code, ...args) { + super(message(code, args)); + this.code = code; + Error.captureStackTrace?.(this, DiscordjsError); + } + + get name() { + return `${super.name} [${this.code}]`; + } + }; +} + +/** + * Format the message for an error. + * @param {string} code The error code + * @param {Array<*>} args Arguments to pass for util format or as function args + * @returns {string} Formatted string + * @ignore + */ +function message(code, args) { + if (!(code in ErrorCodes)) throw new Error('Error code must be a valid DiscordjsErrorCodes'); + const msg = Messages[code]; + if (!msg) throw new Error(`No message associated with error code: ${code}.`); + if (typeof msg === 'function') return msg(...args); + if (!args?.length) return msg; + args.unshift(msg); + return String(...args); +} + +module.exports = { + DiscordjsError: makeDiscordjsError(Error), + DiscordjsTypeError: makeDiscordjsError(TypeError), + DiscordjsRangeError: makeDiscordjsError(RangeError), +}; diff --git a/node_modules/discord.js/src/errors/ErrorCodes.js b/node_modules/discord.js/src/errors/ErrorCodes.js new file mode 100644 index 0000000..9cd2f4d --- /dev/null +++ b/node_modules/discord.js/src/errors/ErrorCodes.js @@ -0,0 +1,319 @@ +'use strict'; + +/** + * @typedef {Object} DiscordjsErrorCodes + + * @property {'ClientInvalidOption'} ClientInvalidOption + * @property {'ClientInvalidProvidedShards'} ClientInvalidProvidedShards + * @property {'ClientMissingIntents'} ClientMissingIntents + * @property {'ClientNotReady'} ClientNotReady + + * @property {'TokenInvalid'} TokenInvalid + * @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 + + * @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 + * @property {'ShardingShardNotFound'} ShardingShardNotFound + * @property {'ShardingAlreadySpawned'} ShardingAlreadySpawned + * @property {'ShardingProcessExists'} ShardingProcessExists + * @property {'ShardingWorkerExists'} ShardingWorkerExists + * @property {'ShardingReadyTimeout'} ShardingReadyTimeout + * @property {'ShardingReadyDisconnected'} ShardingReadyDisconnected + * @property {'ShardingReadyDied'} ShardingReadyDied + * @property {'ShardingNoChildExists'} ShardingNoChildExists + * @property {'ShardingShardMiscalculation'} ShardingShardMiscalculation + + * @property {'ColorRange'} ColorRange + * @property {'ColorConvert'} ColorConvert + + * @property {'InviteOptionsMissingChannel'} InviteOptionsMissingChannel + + * @property {'ButtonLabel'} ButtonLabel + * @property {'ButtonURL'} ButtonURL + * @property {'ButtonCustomId'} ButtonCustomId + + * @property {'SelectMenuCustomId'} SelectMenuCustomId + * @property {'SelectMenuPlaceholder'} SelectMenuPlaceholder + * @property {'SelectOptionLabel'} SelectOptionLabel + * @property {'SelectOptionValue'} SelectOptionValue + * @property {'SelectOptionDescription'} SelectOptionDescription + + * @property {'InteractionCollectorError'} InteractionCollectorError + + * @property {'FileNotFound'} FileNotFound + + * @property {'UserBannerNotFetched'} UserBannerNotFetched + * @property {'UserNoDMChannel'} UserNoDMChannel + + * @property {'VoiceNotStageChannel'} VoiceNotStageChannel + + * @property {'VoiceStateNotOwn'} VoiceStateNotOwn + * @property {'VoiceStateInvalidType'} VoiceStateInvalidType + + * @property {'ReqResourceType'} ReqResourceType + + * @property {'ImageFormat'} ImageFormat + * @property {'ImageSize'} ImageSize + + * @property {'MessageBulkDeleteType'} MessageBulkDeleteType + * @property {'MessageNonceType'} MessageNonceType + * @property {'MessageContentType'} MessageContentType + + * @property {'SplitMaxLen'} SplitMaxLen + + * @property {'BanResolveId'} BanResolveId + * @property {'FetchBanResolveId'} FetchBanResolveId + + * @property {'PruneDaysType'} PruneDaysType + + * @property {'GuildChannelResolve'} GuildChannelResolve + * @property {'GuildVoiceChannelResolve'} GuildVoiceChannelResolve + * @property {'GuildChannelOrphan'} GuildChannelOrphan + * @property {'GuildChannelUnowned'} GuildChannelUnowned + * @property {'GuildOwned'} GuildOwned + * @property {'GuildMembersTimeout'} GuildMembersTimeout + * @property {'GuildUncachedMe'} GuildUncachedMe + * @property {'ChannelNotCached'} ChannelNotCached + * @property {'StageChannelResolve'} StageChannelResolve + * @property {'GuildScheduledEventResolve'} GuildScheduledEventResolve + * @property {'FetchOwnerId'} FetchOwnerId + + * @property {'InvalidType'} InvalidType + * @property {'InvalidElement'} InvalidElement + + * @property {'MessageThreadParent'} MessageThreadParent + * @property {'MessageExistingThread'} MessageExistingThread + * @property {'ThreadInvitableType'} ThreadInvitableType + + * @property {'WebhookMessage'} WebhookMessage + * @property {'WebhookTokenUnavailable'} WebhookTokenUnavailable + * @property {'WebhookURLInvalid'} WebhookURLInvalid + * @property {'WebhookApplication'} WebhookApplication + * @property {'MessageReferenceMissing'} MessageReferenceMissing + + * @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 + + * @property {'InviteResolveCode'} InviteResolveCode + + * @property {'InviteNotFound'} InviteNotFound + + * @property {'DeleteGroupDMChannel'} DeleteGroupDMChannel + * @property {'FetchGroupDMChannel'} FetchGroupDMChannel + + * @property {'MemberFetchNonceLength'} MemberFetchNonceLength + + * @property {'GlobalCommandPermissions'} GlobalCommandPermissions + * @property {'GuildUncachedEntityResolve'} GuildUncachedEntityResolve + + * @property {'InteractionAlreadyReplied'} InteractionAlreadyReplied + * @property {'InteractionNotReplied'} InteractionNotReplied + * @property {'InteractionEphemeralReplied'} InteractionEphemeralReplied + * <warn>This property is deprecated.</warn> + + * @property {'CommandInteractionOptionNotFound'} CommandInteractionOptionNotFound + * @property {'CommandInteractionOptionType'} CommandInteractionOptionType + * @property {'CommandInteractionOptionEmpty'} CommandInteractionOptionEmpty + * @property {'CommandInteractionOptionNoSubcommand'} CommandInteractionOptionNoSubcommand + * @property {'CommandInteractionOptionNoSubcommandGroup'} CommandInteractionOptionNoSubcommandGroup + * @property {'CommandInteractionOptionInvalidChannelType'} CommandInteractionOptionInvalidChannelType + * @property {'AutocompleteInteractionOptionNoFocusedOption'} AutocompleteInteractionOptionNoFocusedOption + + * @property {'ModalSubmitInteractionFieldNotFound'} ModalSubmitInteractionFieldNotFound + * @property {'ModalSubmitInteractionFieldType'} ModalSubmitInteractionFieldType + + * @property {'InvalidMissingScopes'} InvalidMissingScopes + * @property {'InvalidScopesWithPermissions'} InvalidScopesWithPermissions + + * @property {'NotImplemented'} NotImplemented + + * @property {'GuildForumMessageRequired'} GuildForumMessageRequired + + * @property {'SweepFilterReturn'} SweepFilterReturn + */ + +const keys = [ + 'ClientInvalidOption', + 'ClientInvalidProvidedShards', + 'ClientMissingIntents', + 'ClientNotReady', + + 'TokenInvalid', + 'TokenMissing', + 'ApplicationCommandPermissionsTokenMissing', + + 'WSCloseRequested', + 'WSConnectionExists', + 'WSNotOpen', + 'ManagerDestroyed', + + 'BitFieldInvalid', + + 'ShardingInvalid', + 'ShardingRequired', + 'InvalidIntents', + 'DisallowedIntents', + 'ShardingNoShards', + 'ShardingInProcess', + 'ShardingInvalidEvalBroadcast', + 'ShardingShardNotFound', + 'ShardingAlreadySpawned', + 'ShardingProcessExists', + 'ShardingWorkerExists', + 'ShardingReadyTimeout', + 'ShardingReadyDisconnected', + 'ShardingReadyDied', + 'ShardingNoChildExists', + 'ShardingShardMiscalculation', + + 'ColorRange', + 'ColorConvert', + + 'InviteOptionsMissingChannel', + + 'ButtonLabel', + 'ButtonURL', + 'ButtonCustomId', + + 'SelectMenuCustomId', + 'SelectMenuPlaceholder', + 'SelectOptionLabel', + 'SelectOptionValue', + 'SelectOptionDescription', + + 'InteractionCollectorError', + + 'FileNotFound', + + 'UserBannerNotFetched', + 'UserNoDMChannel', + + 'VoiceNotStageChannel', + + 'VoiceStateNotOwn', + 'VoiceStateInvalidType', + + 'ReqResourceType', + + 'ImageFormat', + 'ImageSize', + + 'MessageBulkDeleteType', + 'MessageNonceType', + 'MessageContentType', + + 'SplitMaxLen', + + 'BanResolveId', + 'FetchBanResolveId', + + 'PruneDaysType', + + 'GuildChannelResolve', + 'GuildVoiceChannelResolve', + 'GuildChannelOrphan', + 'GuildChannelUnowned', + 'GuildOwned', + 'GuildMembersTimeout', + 'GuildUncachedMe', + 'ChannelNotCached', + 'StageChannelResolve', + 'GuildScheduledEventResolve', + 'FetchOwnerId', + + 'InvalidType', + 'InvalidElement', + + 'MessageThreadParent', + 'MessageExistingThread', + 'ThreadInvitableType', + + 'WebhookMessage', + 'WebhookTokenUnavailable', + 'WebhookURLInvalid', + 'WebhookApplication', + 'MessageReferenceMissing', + + 'EmojiType', + 'EmojiManaged', + 'MissingManageGuildExpressionsPermission', + 'MissingManageEmojisAndStickersPermission', + + 'NotGuildSticker', + + 'ReactionResolveUser', + + 'VanityURL', + + 'InviteResolveCode', + + 'InviteNotFound', + + 'DeleteGroupDMChannel', + 'FetchGroupDMChannel', + + 'MemberFetchNonceLength', + + 'GlobalCommandPermissions', + 'GuildUncachedEntityResolve', + + 'InteractionAlreadyReplied', + 'InteractionNotReplied', + 'InteractionEphemeralReplied', + + 'CommandInteractionOptionNotFound', + 'CommandInteractionOptionType', + 'CommandInteractionOptionEmpty', + 'CommandInteractionOptionNoSubcommand', + 'CommandInteractionOptionNoSubcommandGroup', + 'CommandInteractionOptionInvalidChannelType', + 'AutocompleteInteractionOptionNoFocusedOption', + + 'ModalSubmitInteractionFieldNotFound', + 'ModalSubmitInteractionFieldType', + + 'InvalidMissingScopes', + 'InvalidScopesWithPermissions', + + 'NotImplemented', + + 'SweepFilterReturn', + + 'GuildForumMessageRequired', +]; + +// JSDoc for IntelliSense purposes +/** + * @type {DiscordjsErrorCodes} + * @ignore + */ +module.exports = Object.fromEntries(keys.map(key => [key, key])); diff --git a/node_modules/discord.js/src/errors/Messages.js b/node_modules/discord.js/src/errors/Messages.js new file mode 100644 index 0000000..550219f --- /dev/null +++ b/node_modules/discord.js/src/errors/Messages.js @@ -0,0 +1,170 @@ +'use strict'; + +const DjsErrorCodes = require('./ErrorCodes'); + +const Messages = { + [DjsErrorCodes.ClientInvalidOption]: (prop, must) => `The ${prop} option must be ${must}`, + [DjsErrorCodes.ClientInvalidProvidedShards]: 'None of the provided shards were valid.', + [DjsErrorCodes.ClientMissingIntents]: 'Valid intents must be provided for the Client.', + [DjsErrorCodes.ClientNotReady]: action => `The client needs to be logged in to ${action}.`, + + [DjsErrorCodes.TokenInvalid]: 'An invalid token was provided.', + [DjsErrorCodes.TokenMissing]: 'Request to use token, but token was unavailable to the client.', + [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', + [DjsErrorCodes.ShardingShardNotFound]: id => `Shard ${id} could not be found.`, + [DjsErrorCodes.ShardingAlreadySpawned]: count => `Already spawned ${count} shards.`, + [DjsErrorCodes.ShardingProcessExists]: id => `Shard ${id} already has an active process.`, + [DjsErrorCodes.ShardingWorkerExists]: id => `Shard ${id} already has an active worker.`, + [DjsErrorCodes.ShardingReadyTimeout]: id => `Shard ${id}'s Client took too long to become ready.`, + [DjsErrorCodes.ShardingReadyDisconnected]: id => `Shard ${id}'s Client disconnected before becoming ready.`, + [DjsErrorCodes.ShardingReadyDied]: id => `Shard ${id}'s process exited before its Client became ready.`, + [DjsErrorCodes.ShardingNoChildExists]: id => `Shard ${id} has no active process or worker.`, + [DjsErrorCodes.ShardingShardMiscalculation]: (shard, guild, count) => + `Calculated invalid shard ${shard} for guild ${guild} with ${count} shards.`, + + [DjsErrorCodes.ColorRange]: 'Color must be within the range 0 - 16777215 (0xFFFFFF).', + [DjsErrorCodes.ColorConvert]: 'Unable to convert color to a number.', + + [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.', + + [DjsErrorCodes.VoiceStateNotOwn]: + 'You cannot self-deafen/mute/request to speak on VoiceStates that do not belong to the ClientUser.', + [DjsErrorCodes.VoiceStateInvalidType]: name => `${name} must be a boolean.`, + + [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.MessageNonceType]: 'Message nonce must be an integer or a string.', + [DjsErrorCodes.MessageContentType]: 'Message content must be 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.", + + [DjsErrorCodes.PruneDaysType]: 'Days must be a number', + + [DjsErrorCodes.GuildChannelResolve]: 'Could not resolve channel to a guild channel.', + [DjsErrorCodes.GuildVoiceChannelResolve]: 'Could not resolve channel to a guild voice channel.', + [DjsErrorCodes.GuildChannelOrphan]: 'Could not find a parent to this guild channel.', + [DjsErrorCodes.GuildChannelUnowned]: "The fetched channel does not belong to this manager's guild.", + [DjsErrorCodes.GuildOwned]: 'Guild is owned by the client.', + [DjsErrorCodes.GuildMembersTimeout]: "Members didn't arrive in time.", + [DjsErrorCodes.GuildUncachedMe]: 'The client user as a member of this guild is uncached.', + [DjsErrorCodes.ChannelNotCached]: 'Could not find the channel where this message came from in the cache!', + [DjsErrorCodes.StageChannelResolve]: 'Could not resolve channel to a stage channel.', + [DjsErrorCodes.GuildScheduledEventResolve]: 'Could not resolve the guild scheduled event.', + [DjsErrorCodes.FetchOwnerId]: "Couldn't resolve the guild ownerId to fetch the member.", + + [DjsErrorCodes.InvalidType]: (name, expected, an = false) => `Supplied ${name} is not a${an ? 'n' : ''} ${expected}.`, + [DjsErrorCodes.InvalidElement]: (type, name, elem) => `Supplied ${type} ${name} includes an invalid element: ${elem}`, + + [DjsErrorCodes.MessageThreadParent]: 'The message was not sent in a guild text or news channel', + [DjsErrorCodes.MessageExistingThread]: 'The message already has a thread', + [DjsErrorCodes.ThreadInvitableType]: type => `Invitable cannot be edited on ${type}`, + + [DjsErrorCodes.WebhookMessage]: 'The message was not sent by a webhook.', + [DjsErrorCodes.WebhookTokenUnavailable]: 'This action requires a webhook token, but none is available.', + [DjsErrorCodes.WebhookURLInvalid]: 'The provided webhook URL is not valid.', + [DjsErrorCodes.WebhookApplication]: 'This message webhook belongs to an application and cannot be fetched.', + [DjsErrorCodes.MessageReferenceMissing]: 'The message does not reference another message', + + [DjsErrorCodes.EmojiType]: 'Emoji must be a string or GuildEmoji/ReactionEmoji', + [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.', + + [DjsErrorCodes.DeleteGroupDMChannel]: "Bots don't have access to Group DM Channels and cannot delete them", + [DjsErrorCodes.FetchGroupDMChannel]: "Bots don't have access to Group DM Channels and cannot fetch them", + + [DjsErrorCodes.MemberFetchNonceLength]: 'Nonce length must not exceed 32 characters.', + + [DjsErrorCodes.GlobalCommandPermissions]: + 'Permissions for global commands may only be fetched or modified by providing a GuildResolvable ' + + "or from a guild's application command manager.", + [DjsErrorCodes.GuildUncachedEntityResolve]: type => + `Cannot resolve ${type} from an arbitrary guild, provide an id instead`, + + [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) => + `Option "${name}" is of type: ${type}; expected ${expected}.`, + [DjsErrorCodes.CommandInteractionOptionEmpty]: (name, type) => + `Required option "${name}" is of type: ${type}; expected a non-empty value.`, + [DjsErrorCodes.CommandInteractionOptionNoSubcommand]: 'No subcommand specified for interaction.', + [DjsErrorCodes.CommandInteractionOptionNoSubcommandGroup]: 'No subcommand group specified for interaction.', + [DjsErrorCodes.CommandInteractionOptionInvalidChannelType]: (name, type, expected) => + `The type of channel of the option "${name}" is: ${type}; expected ${expected}.`, + [DjsErrorCodes.AutocompleteInteractionOptionNoFocusedOption]: 'No focused option for autocomplete interaction.', + + [DjsErrorCodes.ModalSubmitInteractionFieldNotFound]: customId => + `Required field with custom id "${customId}" not found.`, + [DjsErrorCodes.ModalSubmitInteractionFieldType]: (customId, type, expected) => + `Field with custom id "${customId}" is of type: ${type}; expected ${expected}.`, + + [DjsErrorCodes.InvalidMissingScopes]: 'At least one valid scope must be provided for the invite', + [DjsErrorCodes.InvalidScopesWithPermissions]: 'Permissions cannot be set without the bot scope.', + + [DjsErrorCodes.NotImplemented]: (what, name) => `Method ${what} not implemented on ${name}.`, + + [DjsErrorCodes.SweepFilterReturn]: 'The return value of the sweepFilter function was not false or a Function', + + [DjsErrorCodes.GuildForumMessageRequired]: 'You must provide a message to create a guild forum thread', +}; + +module.exports = Messages; diff --git a/node_modules/discord.js/src/errors/index.js b/node_modules/discord.js/src/errors/index.js new file mode 100644 index 0000000..78dc5c6 --- /dev/null +++ b/node_modules/discord.js/src/errors/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./DJSError'); +module.exports.ErrorCodes = require('./ErrorCodes'); +module.exports.Messages = require('./Messages'); |