Initial commit of Discord bot
This commit is contained in:
48
node_modules/discord.js/src/errors/DJSError.js
generated
vendored
Normal file
48
node_modules/discord.js/src/errors/DJSError.js
generated
vendored
Normal file
@@ -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),
|
||||
};
|
||||
347
node_modules/discord.js/src/errors/ErrorCodes.js
generated
vendored
Normal file
347
node_modules/discord.js/src/errors/ErrorCodes.js
generated
vendored
Normal file
@@ -0,0 +1,347 @@
|
||||
'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
|
||||
* <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 {'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
|
||||
* <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
|
||||
|
||||
* @property {'VoiceStateNotOwn'} VoiceStateNotOwn
|
||||
* @property {'VoiceStateInvalidType'} VoiceStateInvalidType
|
||||
|
||||
* @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
|
||||
|
||||
* @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
|
||||
* <warn>This property is deprecated.</warn>
|
||||
|
||||
* @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
|
||||
|
||||
* @property {'EntitlementCreateInvalidOwner'} EntitlementCreateInvalidOwner
|
||||
|
||||
* @property {'BulkBanUsersOptionEmpty'} BulkBanUsersOptionEmpty
|
||||
|
||||
* @property {'PollAlreadyExpired'} PollAlreadyExpired
|
||||
*/
|
||||
|
||||
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',
|
||||
'MessageContentType',
|
||||
'MessageNonceRequired',
|
||||
'MessageNonceType',
|
||||
|
||||
'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',
|
||||
|
||||
'EntitlementCreateInvalidOwner',
|
||||
|
||||
'BulkBanUsersOptionEmpty',
|
||||
|
||||
'PollAlreadyExpired',
|
||||
];
|
||||
|
||||
// JSDoc for IntelliSense purposes
|
||||
/**
|
||||
* @type {DiscordjsErrorCodes}
|
||||
* @ignore
|
||||
*/
|
||||
module.exports = Object.fromEntries(keys.map(key => [key, key]));
|
||||
178
node_modules/discord.js/src/errors/Messages.js
generated
vendored
Normal file
178
node_modules/discord.js/src/errors/Messages.js
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
'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]: color => `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.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.",
|
||||
|
||||
[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]: type => `Couldn't resolve the ${type} ownerId to fetch the ${type} 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',
|
||||
|
||||
[DjsErrorCodes.EntitlementCreateInvalidOwner]:
|
||||
'You must provide either a guild or a user to create an entitlement, but not both',
|
||||
|
||||
[DjsErrorCodes.BulkBanUsersOptionEmpty]: 'Option "users" array or collection is empty',
|
||||
|
||||
[DjsErrorCodes.PollAlreadyExpired]: 'This poll has already expired.',
|
||||
};
|
||||
|
||||
module.exports = Messages;
|
||||
5
node_modules/discord.js/src/errors/index.js
generated
vendored
Normal file
5
node_modules/discord.js/src/errors/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./DJSError');
|
||||
module.exports.ErrorCodes = require('./ErrorCodes');
|
||||
module.exports.Messages = require('./Messages');
|
||||
Reference in New Issue
Block a user