@seedcord/errors 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -11
- package/dist/SeedcordError-Cce9qKW3.d.mts +583 -0
- package/dist/SeedcordError-D9SmwpVL.mjs +676 -0
- package/dist/SeedcordError-D9SmwpVL.mjs.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/internal.index.d.mts +20 -6
- package/dist/internal.index.mjs +44 -18
- package/dist/internal.index.mjs.map +1 -1
- package/package.json +5 -5
- package/dist/SeedcordError-CJfXnVTd.d.mts +0 -526
- package/dist/SeedcordError-UFUYeAQ_.mjs +0 -561
- package/dist/SeedcordError-UFUYeAQ_.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeedcordError-D9SmwpVL.mjs","names":[],"sources":["../src/ErrorCodes.ts","../src/displayPath.ts","../src/palette.ts","../src/messageText.ts","../src/ErrorMessages.ts","../src/SeedcordError.ts"],"sourcesContent":["/* eslint-disable no-magic-numbers */\n\n/**\n * All Seedcord error codes.\n */\nexport enum SeedcordErrorCode {\n /** Two or more configured emojis failed to resolve at startup. */\n ConfigEmojiUnresolved = 1001,\n /** A configured emoji is neither a name nor a `[name, guildId]` pair. */\n ConfigEmojiInvalid = 1002,\n /** The application or guild a configured emoji points at has no emoji with that name. */\n ConfigEmojiNotFound = 1003,\n /** Reading the emojis of the application or guild a configured emoji points at failed. */\n ConfigEmojiSourceUnreadable = 1004,\n /** Discord has no webhook at a configured URL, because it was deleted or the id or token is wrong. */\n ConfigWebhookNotFound = 1005,\n /** A required environment variable is unset. */\n ConfigMissingEnv = 1006,\n /** An environment variable is set to a value seedcord cannot use. */\n ConfigInvalidEnv = 1007,\n /** A command that runs in guilds is registered without the `Guilds` intent, so discord.js caches no guild. */\n MissingGuildsIntent = 1008,\n /** The running Node or Bun is older than the range seedcord declares in `engines`. */\n UnsupportedRuntimeVersion = 1009,\n /** An edge config sets a REST sweeper interval. */\n ConfigEdgeRestSweeper = 1010,\n /** Another process already listens on the port seedcord tries to listen on. */\n PortInUse = 1011,\n\n /** A startup task was added or removed while startup ran, or added after it finished. */\n LifecycleTaskChangeRejected = 1101,\n /** A lifecycle call got a phase that is not a member of `StartupPhase` or `ShutdownPhase`. */\n LifecycleUnknownPhase = 1102,\n /** One or more tasks failed during a startup phase. */\n LifecyclePhaseFailures = 1103,\n /** A lifecycle task ran past its timeout. */\n LifecycleTaskTimeout = 1104,\n /** A host whose startup failed was started again. */\n LifecycleRestartAfterFailure = 1105,\n /** A shutdown deadline or a plugin's lifecycle timeout is zero, negative, or not finite. */\n LifecycleInvalidTimeout = 1106,\n\n /** A second Seedcord instance was constructed while one already exists. */\n CoreSingletonViolation = 1201,\n /** A plugin was attached after the bot started. */\n CorePluginAfterInit = 1202,\n /** A plugin was attached under a key another plugin already uses. */\n CorePluginKeyExists = 1203,\n /** The bot's own role is missing from the guild's role cache. */\n CoreBotRoleMissing = 1204,\n /** A bot controller was constructed without the folder that holds its handlers. */\n CoreControllerPathMissing = 1205,\n /** seedcord could not import a file in the bot or in the CLI. */\n CoreImportFailed = 1206,\n /** A file or folder that seedcord reads could not be read. */\n CorePathUnreadable = 1207,\n /** A plugin was attached under a key that the framework logs on. */\n CorePluginReservedChannel = 1208,\n /** The application id was read before startup resolved it. */\n CoreApplicationUnavailable = 1209,\n /** A generated accessor like `Emojis` or `Commands` was read for a key that has no value yet. */\n CoreAccessorUnresolved = 1210,\n /** A shutdown task was added on an edge bot. Cloudflare stops an isolate without a shutdown hook. */\n CoreLifecycleUnavailable = 1211,\n /** `emit` was called on the bus. It calls the listeners and skips every subscriber. */\n CoreBusEmitUnavailable = 1212,\n /** A command registers to the `'config'` guilds while `commands.guilds` is empty. */\n CoreCommandGuildsEmpty = 1213,\n /** Discord refused the command deploy for one guild. */\n CoreCommandGuildDeployFailed = 1214,\n /** A plugin was attached under a group name the bot already uses. */\n CorePluginGroupTaken = 1215,\n /** A plugin was attached at a name that holds a group of plugins. */\n CorePluginKeyHoldsGroup = 1216,\n /** A plugin key is empty, has an empty part, or has more than one dot. */\n CorePluginKeyMalformed = 1217,\n /** An attached plugin extends the `Plugin` class of a different copy of `@seedcord/core`. */\n CorePluginFromOtherCore = 1218,\n /** A folder or the `build.start` file is outside `root`. */\n CorePathOutsideRoot = 1219,\n /** A plugin declares a transport or runtime the bot doesn't use. */\n CorePluginScopeMismatch = 1220,\n /** A node http bot got a request through `fetch` before `start()` was called. */\n CoreFetchBeforeStart = 1221,\n /** An edge worker got a POST without the ids that `seedcord build` writes into it. */\n CoreEdgeUnbuilt = 1222,\n /** A relative folder was read in a process that never got the bot's `root`. */\n CoreDirectoryRootUnknown = 1223,\n /** Discord refused the global command deploy. */\n CoreCommandGlobalDeployFailed = 1224,\n /** A built bot read a folder that did not exist under `root` when `seedcord build` ran. */\n CoreDirectoryNotBuilt = 1225,\n /** A webhook sender was constructed with a URL that is not a Discord webhook URL. */\n CoreWebhookUrlInvalid = 1226,\n /** Reading from Discord with `DISCORD_BOT_TOKEN` failed, like the application, its public key, or its commands. */\n CoreDiscordReadFailed = 1227,\n /** Two routes, commands, migrations, or customId fields have the same name, or two code files build to the same file. */\n CoreDuplicateName = 1228,\n /** A Vite plugin from `vitePlugins` threw while Vite started or loaded a file, or failed when seedcord called `vitePlugins`. */\n CoreVitePluginThrew = 1229,\n /** `readFiles` read a folder that `files` in `seedcord.config.ts` leaves out. */\n CoreDirectoryNotListed = 1230,\n /** A folder is inside one that `seedcord build` skips, like a dot-folder, `node_modules`, `outDir` or the logs folder. */\n CoreDirectorySkipped = 1231,\n\n /** A command class carries `@RegisterCommand` twice. */\n DecoratorCommandAlreadyRegistered = 1301,\n /** `@RegisterCommand('global')` was given guild ids. */\n DecoratorCommandGlobalWithGuilds = 1302,\n /** `@RegisterCommand('guild')` was given no guild ids. */\n DecoratorCommandGuildWithoutGuilds = 1303,\n /** A middleware decorator sets a priority that is not a finite number. */\n DecoratorInvalidMiddlewarePriority = 1304,\n /** A `WebhookLog` subclass is missing its `@WebhookUrl` decorator. */\n DecoratorWebhookUrlMissing = 1305,\n /** A middleware decorator got an empty filter array. */\n DecoratorEmptyMiddlewareFilter = 1306,\n\n /** A reply method was called in an ack state where Discord rejects it. */\n ReplyIllegalAckState = 1501,\n /** A reply component threw while seedcord serialized it. */\n ReplyComponentSerialization = 1502,\n /** `edit()` got a message that the interaction did not send. */\n ReplyForeignEditTarget = 1503,\n /** `update()` or `deferUpdate()` was called on a modal that has no source message. */\n ReplyUpdateWithoutSource = 1504,\n /** Discord's response to a `withResponse` callback has no message in it. */\n ReplyCallbackMissingMessage = 1505,\n\n /** A customId prefix is empty, or holds a colon or a control character. */\n CustomIdInvalidPrefix = 1601,\n /** A customId field name looks like an integer. JS reorders integer keys. */\n CustomIdReservedFieldName = 1602,\n /** A `oneOf()` or `someOf()` field was declared with no choices. */\n CustomIdEmptyChoices = 1603,\n /** An `int()` field was declared with a min greater than its max. */\n CustomIdInvalidBounds = 1604,\n /** `encode()` got a value that doesn't fit its field. */\n CustomIdValueRejected = 1605,\n /** An encoded customId is longer than the 100 characters Discord allows. */\n CustomIdWireTooLong = 1606,\n /** A component handler is missing the route decorator that matches its base. */\n CustomIdHandlerRouteMissing = 1607,\n /** A handler's `match()` has no arm for the route, field, event, or command that fired. */\n MatchArmMissing = 1608,\n /** An event handler or middleware read the fired event's name but was constructed without one. */\n EventNameUnavailable = 1609,\n /** Discord sent an autocomplete payload with no focused option. */\n AutocompleteNoFocusedOption = 1610,\n /** The submitted modal has no field with the requested custom id. */\n ModalFieldNotFound = 1611,\n /** A modal field getter was called on a field of another kind. */\n ModalFieldWrongKind = 1612,\n /** A modal field read as required has nothing picked. */\n ModalFieldEmpty = 1613,\n /** A channel select returned a channel whose type the `getSelectedChannels()` call excludes. */\n ModalFieldChannelType = 1614,\n /** A customId was encoded under an older shape of the same definition. */\n CustomIdWireStale = 1615,\n /** A customId is corrupt, truncated, or was encoded by a different definition. */\n CustomIdWireInvalid = 1616,\n /** `dispatch.require()` was called for a key that nothing set on this dispatch. */\n DispatchStateMissing = 1617,\n\n /** A `Cooldown` gate got a duration that doesn't parse, or one of zero or less. */\n GateInvalidCooldownDuration = 1701,\n\n /** A paginator got a `perPage` that is not a positive integer. */\n PaginationInvalidPerPage = 1801,\n /** A control row has no controls, or more than the five buttons Discord allows. */\n PaginationControlCount = 1802,\n /** A control row lists the same control twice. Its two buttons would share a custom_id. */\n PaginationDuplicateControls = 1803,\n\n /** A color value doesn't resolve to a Discord color integer. */\n ColorUnresolvable = 1901,\n /** A resolved color is outside Discord's range of 0x000000 to 0xffffff. */\n ColorOutOfRange = 1902,\n\n /** `renderTable` got a `maxWidth` or `padding` outside the values it accepts. */\n UtilTableOptionInvalid = 1951,\n /** `assertNever` ran with a value that its types ruled out. */\n UtilUnhandledUnionMember = 1952,\n\n /** `WinstonFileSink` got a `filename` with a folder in it. File logs always go in the logs folder. */\n LoggerFileNameHasFolder = 1971,\n\n /** A plugin's constructor called `rejectOptions` on the options it got. */\n PluginOptionsRejected = 2001,\n /** Two or more plugins threw while disposing. */\n PluginDisposeFailures = 2002,\n /** A plugin service class is missing the decorator that registers it. */\n PluginServiceDecoratorMissing = 2003,\n /** A plugin's `services` was read before the plugin finished `init()`. */\n PluginServicesNotReady = 2004,\n /** A plugin could not connect to the service it wraps. */\n PluginConnectionFailed = 2005,\n /** A plugin could not close its connection cleanly during shutdown. */\n PluginDisconnectFailed = 2006,\n\n /** Mongoose threw while building a model, usually for a duplicate model name or a missing schema. */\n PluginMongooseModelCreationFailed = 2101,\n /** A mongoose service was registered with an empty model name. */\n PluginMongooseModelNameMissing = 2102,\n\n /** A kysely service class has no table. */\n PluginKyselyServiceTableMissing = 2201,\n /** A migration run got a step count that is not a non-negative integer. */\n PluginKyselyInvalidStepCount = 2202,\n /** A migration run got a direction other than `up` or `down`. */\n PluginKyselyUnknownDirection = 2203,\n /** A file in the migrations folder has no `up` function. */\n PluginKyselyInvalidMigrationModule = 2204,\n /** A migration failed with a thrown value that is not an `Error`. */\n PluginKyselyNonErrorFailure = 2205,\n /** Creating the target Postgres database failed. */\n PluginKyselyBootstrapFailed = 2206,\n\n /** Someone pressed Ctrl-C at a prompt in `seedcord` or `create-seedcord`. */\n CliCancelled = 3001,\n\n /** The seedcord config file's default export is not an object. */\n CliConfigInvalidExport = 3101,\n /** No seedcord config file exists in the folder the CLI searched. */\n CliConfigNotFound = 3102,\n /** The file that `instance` or `build.start` in the seedcord config points at does not exist. */\n CliFileNotFound = 3103,\n /** The instance file's default export is not a constructed `Seedcord`. */\n CliInstanceInvalid = 3104,\n /** The bot threw during startup. */\n CliStartFailed = 3105,\n /** `build.tsconfig` points at a missing file, or it is unset and the config's folder has no `tsconfig.json`. */\n CliTsconfigNotFound = 3106,\n /** `seedcord build` found type errors. */\n CliBuildFailed = 3107,\n /** `commands clean` or `commands purge` ran without a flag that picks where it deletes. */\n CliNoScopeGiven = 3108,\n /** cloudflared never reported a quick tunnel hostname. */\n CliTunnelUrlUnavailable = 3109,\n /** Discord rejected the tunnel URL as an interactions endpoint. */\n CliTunnelNotVerified = 3110,\n /** The tunnel URL never answered its health probe. */\n CliTunnelUnreachable = 3111,\n /** A field in the seedcord config is missing or has the wrong shape. */\n CliConfigInvalidField = 3112,\n /** A class carrying `@RegisterCommand` threw while seedcord constructed it. */\n CliCommandConstructorThrew = 3113,\n /** Vite threw while bundling the bot. */\n CliBundleFailed = 3114,\n /** `build.outDir` is `root` or a folder that contains it. */\n CliConfigOutDirDeletesRoot = 3115,\n /** The project is missing a dev dependency the CLI runs, like `typescript` or `@cloudflare/vite-plugin`. */\n CliDependencyMissing = 3116,\n /** `build.outDir` already has other files in it. */\n CliBuildOutDirNotEmpty = 3117,\n /** One CLI step found two or more problems. Each one is in the error's `errors`. */\n CliProblems = 3118,\n /** `seedcord codegen --check` found the committed augmentations out of date. */\n CliCodegenOutOfDate = 3119,\n /** A file or folder in the project has a `#` in its path. */\n CliPathHasHash = 3120,\n /** An edge bot's tsconfig is missing the `workerd` condition. */\n CliEdgeWithoutWorkerdCondition = 3121,\n /** A bot with no `cloudflare.config.ts` sets the `workerd` condition in its tsconfig. */\n CliWorkerdConditionWithoutCloudflareConfig = 3122,\n /** TypeScript could not read the project's tsconfig, or Cloudflare's config loader could not read `cloudflare.config.ts`. */\n CliConfigFileUnreadable = 3123,\n /** The CLI could not start the TypeScript compiler. */\n CliTypescriptNotStarted = 3124,\n /** A config file sets a field this bot can't set, like `entrypoint` in an edge bot's `cloudflare.config.ts`. */\n CliConfigFieldUnused = 3125,\n /** An edge bot's `compatibilityDate` is older than Cloudflare's Node compat default, and no flag turns it on. */\n CliEdgeCompatDateTooOld = 3126,\n /** An edge bot sets `no_nodejs_compat`. */\n CliEdgeNodeCompatOff = 3127,\n /** The build could not start the edge worker in workerd. */\n CliEdgeBootFailed = 3128,\n /** An edge bot's `root` holds its seedcord config. */\n CliEdgeRootHoldsConfig = 3129,\n /** An edge build found commands in code that have no deployed id on Discord. */\n CliEdgeCommandsNotDeployed = 3130,\n /** Something called the dev runtime before `start()` finished or after `stop()`. This is a bug in seedcord. */\n CliDevRuntimeNotRunning = 3131,\n /** `seedcord commands deploy` ran on a bot whose `commands.path` is `null`. */\n CliDeployNoCommandsFolder = 3132,\n /** `seedcord commands deploy` ran without `--yes` where it cannot ask first. */\n CliDeployNeedsYes = 3133,\n /** A class carrying `@RegisterCommand` builds a component that is not a command or a context menu. */\n CliCommandNotACommand = 3134,\n /** `seedcord commands clean` or `purge` could not delete some of the commands it picked. */\n CliCommandsNotDeleted = 3135,\n /** The CLI ran on Bun for an edge bot. */\n CliEdgeOnBun = 3136,\n /** An edge bot's `cloudflare.config.ts` sets no `worker`. */\n CliEdgeNoWorker = 3137,\n /** The running `seedcord` is a different install from the project's own. */\n CliNotProjectInstall = 3138,\n /** Vite's environments leave out the one seedcord runs the bot in. */\n CliViteEnvironmentMissing = 3139,\n /** A folder that `files` in `seedcord.config.ts` lists is missing or is a file. */\n CliListedFolderUnusable = 3140,\n /** Another `seedcord dev` already runs a bot on the same Discord application. */\n CliDevAlreadyRunning = 3141,\n /** The folder that holds the dev session locks belongs to another user. */\n CliDevLockFolderNotOwned = 3142,\n\n /** A flag answers a question that the earlier answers skip. */\n CreateFlagNotApplicable = 3201,\n /** A flag has a value its question rejects. */\n CreateInvalidAnswer = 3202,\n /** The command line did not parse. */\n CreateBadUsage = 3203,\n /** The target path already has files in it. */\n CreateTargetNotEmpty = 3204,\n /** A command that create-seedcord ran exited non-zero. */\n CreateStepFailed = 3205\n}\n","interface DisplayPathOptions {\n // without one, the working directory itself prints as ./\n prefix?: string;\n}\n\n// the edge build of this package can't import node:path\nexport function displayPath(rawPath: string, { prefix }: DisplayPathOptions = {}): string {\n const path = forwardSlashes(rawPath.length > 1 ? rawPath.replace(/[/\\\\]+$/, '') : rawPath);\n if (typeof process === 'undefined' || typeof process.cwd !== 'function') return path;\n\n const cwd = forwardSlashes(process.cwd());\n\n if (path === cwd) return prefix ?? './';\n return path.startsWith(`${cwd}/`) ? `${prefix ?? ''}${path.slice(cwd.length + 1)}` : path;\n}\n\nfunction forwardSlashes(path: string): string {\n return path.replaceAll('\\\\', '/');\n}\n","import chalk from 'chalk';\n\nimport { displayPath } from './displayPath';\n\nimport type { ColorSupportLevel } from 'chalk';\n\n// @seedcord/ui carries the same three for the web\nexport const BRAND = {\n flesh: '#f04e36',\n rind: '#6fab49',\n pith: '#f8f6e8'\n} as const;\n\n// chalk turns color on only for a chromium user agent outside node\nexport function setColorLevel(level: ColorSupportLevel): void {\n chalk.level = level;\n}\n\nconst SKY = '#8fc7ff';\n\n// truecolor because a terminal theme remaps chalk's 16-color names (blue turns orange in monokai)\n// chalk.hex reads the color level once, when it runs. a getter picks up a level set later, like the edge worker's\nexport const paint = {\n // what the line is about, one per line\n get sky() {\n return chalk.hex(SKY);\n },\n path: (path: string) => chalk.hex(SKY)(displayPath(path)),\n // a count\n get iris() {\n return chalk.hex('#e29bff');\n },\n // success\n get mint() {\n return chalk.hex('#66d98a');\n },\n // go do something about this\n get amber() {\n return chalk.hex('#ffc061');\n },\n // failure\n get coral() {\n return chalk.hex('#ff6b85');\n },\n // brand marks\n get flesh() {\n return chalk.hex(BRAND.flesh);\n },\n get rind() {\n return chalk.hex(BRAND.rind);\n },\n get pith() {\n return chalk.hex(BRAND.pith);\n },\n // context around the subject\n mute: chalk.dim,\n\n check: '✔︎', // U+FE0E to prevent emoji font\n cross: '✘',\n\n // weight and shape\n bold: chalk.bold,\n italic: chalk.italic,\n underline: chalk.underline\n} as const;\n\nexport const WORDMARK = `${paint.flesh.bold('seed')}${paint.rind.bold('cord')}`;\n","import { paint } from './palette';\n\n// a reason from a caught error may or may not end in a period\nexport function sentence(text: string): string {\n // a multi-line reason usually ends in a code frame\n if (text.includes('\\n')) return text;\n return /[.!?]$/.test(text) ? text : `${text}.`;\n}\n\nexport function reasonThen(reason: string, next: string): string {\n return `${sentence(reason)}${reason.includes('\\n') ? '\\n' : ' '}${next}`;\n}\n\n// @seedcord/utils depends on this package, so its pluralize is out of reach here\nconst plurals = new Intl.PluralRules('en');\nexport const allOf = new Intl.ListFormat('en', { type: 'conjunction' });\nexport const oneOf = new Intl.ListFormat('en', { type: 'disjunction' });\n\nexport function isOne(count: number): boolean {\n return plurals.select(count) === 'one';\n}\n\nexport function counted(count: number, one: string, many: string): string {\n return `${count} ${isOne(count) ? one : many}`;\n}\n\nexport const quoted = (value: string): string => paint.sky(JSON.stringify(value));\n","import { SeedcordErrorCode } from './ErrorCodes';\nimport { allOf, counted, isOne, oneOf, quoted, reasonThen, sentence } from './messageText';\nimport { paint } from './palette';\n\nexport interface VitePluginPlace {\n hook?: string | undefined;\n // only load and transform run on a module\n loading?: { kind: 'file'; path: string } | { kind: 'virtual'; id: string } | undefined;\n}\n\nfunction placeText(hook: string, loading: VitePluginPlace['loading']): string {\n const inHook = `in its ${paint.bold(hook)} hook`;\n if (loading === undefined) return inHook;\n const shown = loading.kind === 'file' ? paint.path(loading.path) : paint.bold(loading.id);\n return `${inHook} while loading ${shown}`;\n}\n\nfunction vitePluginFix({ loading }: VitePluginPlace): string {\n if (loading?.kind !== 'file') return 'Check the options you pass the plugin.';\n return `Fix ${paint.path(loading.path)}, or check the options you pass the plugin if that file looks right.`;\n}\n\nconst listedFolderProblems = {\n missing: `which does not exist. Create it, or take it out of ${paint.bold('files')}.`,\n file: `which is a file. ${paint.bold('files')} takes folders. List the folder that holds it.`,\n outsideProject: `which is outside the folder that holds seedcord.config.ts. Move it into that folder and list its new path.`\n};\n\n// the edge worker sets chalk's color level after this module loads\nconst token = (): string => paint.bold('DISCORD_BOT_TOKEN');\n\nconst BAD_REQUEST = 400;\nconst UNAUTHORIZED = 401;\n\nfunction deployFix(status: number | undefined, otherwise: string): string {\n if (status === UNAUTHORIZED) return `Check that ${token()} is still valid.`;\n if (status === BAD_REQUEST) return \"Check that each command's name, description and options are valid.\";\n return otherwise;\n}\n\n/** @internal */\nconst messages = {\n [SeedcordErrorCode.ConfigEmojiUnresolved]: (count: number) =>\n `${paint.iris(count)} configured emojis could not be resolved. Each one is listed below.`,\n [SeedcordErrorCode.ConfigEmojiInvalid]: (key: string) =>\n `The emoji ${paint.sky(key)} in ${paint.bold('bot.emojis')} has a value seedcord cannot read. Set it to the emoji's name, or to a ${paint.bold('[name, guildId]')} pair for a guild emoji.`,\n [SeedcordErrorCode.ConfigEmojiNotFound]: (key: string, name: string, where: string) =>\n `The emoji ${paint.sky(key)} points at ${paint.bold(name)}, but ${where} has no emoji with that name. Check the spelling, or upload the emoji there.`,\n [SeedcordErrorCode.ConfigEmojiSourceUnreadable]: (\n key: string,\n name: string,\n where: string,\n reason: string,\n fix: string\n ) =>\n `Could not read the emojis in ${where} to resolve ${paint.sky(key)} (${paint.bold(name)}). ${reasonThen(reason, fix)}`,\n [SeedcordErrorCode.ConfigWebhookNotFound]: (envKey: string) =>\n `Discord has no webhook at the URL in ${paint.bold(envKey)}. Someone deleted it, or the id or token in the URL is wrong. Create a webhook and copy its URL.`,\n [SeedcordErrorCode.ConfigMissingEnv]: (name: string) =>\n `${paint.bold(name)} is not set. Add it to your environment or your .env file.`,\n [SeedcordErrorCode.ConfigInvalidEnv]: (name: string, expected: string, why?: string) =>\n `${paint.bold(name)} has a value seedcord cannot use.${why ? ` ${why}` : ''} Set it to ${expected}.`,\n [SeedcordErrorCode.MissingGuildsIntent]: (commands: readonly string[]) =>\n `Add GatewayIntentBits.Guilds to clientOptions.intents. Without it discord.js doesn't cache any guild, so interaction.guild is null inside the ${isOne(commands.length) ? 'command' : 'commands'} ${allOf.format(commands.map((name) => paint.sky(name)))}.`,\n [SeedcordErrorCode.UnsupportedRuntimeVersion]: (runtime: string, required: string, running: string) =>\n `seedcord requires ${runtime} ${required}, but this process runs ${running}. Upgrade ${runtime} before starting the bot.`,\n [SeedcordErrorCode.ConfigEdgeRestSweeper]: (key: string) =>\n `Remove ${paint.sky(`bot.restOptions.${key}`)} from your edge config. A sweeper interval starts a timer at the worker's global scope, where workerd throws.`,\n [SeedcordErrorCode.PortInUse]: (port: number, setting: string, configFile?: string) =>\n `Another process already listens on port ${port}. Stop it, or set ${paint.bold(setting)} in ${configFile ? paint.path(configFile) : 'your Seedcord config'} to a free port.`,\n\n [SeedcordErrorCode.LifecycleTaskChangeRejected]: (action: 'add' | 'remove', startup: 'running' | 'finished') =>\n `${startup === 'running' ? 'Startup is running, so its tasks cannot change.' : 'Startup already finished, so this task would never run.'} ${action === 'add' ? 'Add' : 'Remove'} startup tasks before you call ${paint.bold('start()')}.`,\n [SeedcordErrorCode.LifecycleUnknownPhase]: (phase: unknown) =>\n `${paint.sky(String(phase))} is not a lifecycle phase. Pass a member of ${paint.bold('StartupPhase')} or ${paint.bold('ShutdownPhase')}.`,\n [SeedcordErrorCode.LifecyclePhaseFailures]: (phase: string, failures: number) =>\n `${counted(failures, 'task', 'tasks')} failed in the ${phase} phase. Each one is listed below.`,\n [SeedcordErrorCode.LifecycleTaskTimeout]: (taskName: string, timeout: number) =>\n `Task \"${taskName}\" timed out after ${timeout}ms. Check what it waits on, or give it a longer timeout.`,\n [SeedcordErrorCode.LifecycleRestartAfterFailure]: () =>\n 'Startup failed, so this host cannot start again. Construct a new instance.',\n [SeedcordErrorCode.LifecycleInvalidTimeout]: (setting: string, value: number) =>\n `${paint.bold(setting)} is ${value}. Pass a positive number of milliseconds, or leave it out for the default.`,\n\n [SeedcordErrorCode.CoreSingletonViolation]: () =>\n 'Seedcord can only be constructed once per process. Use the instance you already have.',\n [SeedcordErrorCode.CorePluginAfterInit]: () =>\n 'Cannot attach a plugin once the bot has started. Attach every plugin before start(), or before the first request on an edge bot.',\n [SeedcordErrorCode.CorePluginKeyExists]: (key: string) =>\n `A plugin is already attached at ${paint.sky(key)}. Attach this one under another key.`,\n [SeedcordErrorCode.CoreBotRoleMissing]: (guildId?: string) =>\n `The role cache of ${guildId ? `guild ${paint.sky(guildId)}` : 'this guild'} has no role for the bot. discord.js fills that cache through the Guilds intent, so check that clientOptions.intents includes GatewayIntentBits.Guilds.`,\n [SeedcordErrorCode.CoreControllerPathMissing]: (controllerName: string, pathKind: string) =>\n `${paint.sky(controllerName)} was constructed without a ${pathKind} path. This is a bug in seedcord.`,\n [SeedcordErrorCode.CoreImportFailed]: (file: string, reason: string) =>\n `Could not import ${paint.path(file)}. ${sentence(reason)}`,\n [SeedcordErrorCode.CoreVitePluginThrew]: (\n plugin: string,\n place: VitePluginPlace,\n configFile: string,\n reason: string\n ) =>\n place.hook === undefined\n ? `${paint.sky(plugin)} in ${paint.path(configFile)} failed when seedcord called ${paint.bold('vitePlugins')}. ${reasonThen(reason, 'Check that the package is installed and that its import resolves.')}`\n : `The Vite plugin ${paint.sky(plugin)} from ${paint.bold('vitePlugins')} in ${paint.path(configFile)} threw ${placeText(place.hook, place.loading)}. ${reasonThen(reason, vitePluginFix(place))}`,\n [SeedcordErrorCode.CorePathUnreadable]: (path: string, reason: string) =>\n `Could not read ${paint.path(path)}. ${reasonThen(reason, 'Check that it exists and that this process can read it.')}`,\n [SeedcordErrorCode.CorePathOutsideRoot]: (path: string, root: string) =>\n `${paint.path(path)} is outside ${paint.bold('root')} (${paint.path(root)}). ${paint.bold('seedcord build')} bundles only the files under ${paint.bold('root')}. Move it under ${paint.bold('root')}, or set ${paint.bold('root')} in seedcord.config.ts to a folder that holds it.`,\n [SeedcordErrorCode.CoreDirectoryRootUnknown]: (dir: string) =>\n `${paint.path(dir)} is relative to ${paint.bold('root')}, but nothing set ${paint.bold('root')} in this process. ${paint.bold('seedcord codegen')}, ${paint.bold('build')}, and ${paint.bold('commands')} import bot.ts without starting it, so read the folder in a startup task or a plugin's init(). In a test or a script, pass an absolute path like ${paint.sky(`resolve(import.meta.dirname, '${dir}')`)}.`,\n [SeedcordErrorCode.CoreDirectoryNotBuilt]: (dir: string, root: string) =>\n `${paint.path(dir)} was not a folder under ${paint.bold('root')} (${paint.path(root)}) or in ${paint.bold('files')} when ${paint.bold('seedcord build')} ran, so the build holds none of its files. Create the folder, then build again.`,\n [SeedcordErrorCode.CoreDirectoryNotListed]: (dir: string) =>\n `${paint.bold('readFiles')} was called on ${paint.path(dir)}, which is outside every folder in ${paint.bold('files')} in seedcord.config.ts. ${paint.bold('seedcord build')} bundles non-code files from only those folders. Add it to ${paint.bold('files')}, like ${paint.sky(\"files: ['./locales']\")}.`,\n [SeedcordErrorCode.CoreDirectorySkipped]: (dir: string) =>\n `${paint.path(dir)} is in a folder ${paint.bold('seedcord build')} skips, so a built bot holds none of its files. The build skips dot-folders, node_modules, outDir, the logs folder beside seedcord.config.ts and project files like package.json. Move the files to a folder outside those.`,\n [SeedcordErrorCode.CorePluginGroupTaken]: (head: string, key: string) =>\n `${paint.bold(head)} is already taken on this bot, so ${paint.sky(key)} cannot nest under it. Pick another group name.`,\n [SeedcordErrorCode.CorePluginKeyMalformed]: (key: string, reason: string) =>\n `${paint.sky(key)} ${reason} Write a group and a plugin name around one dot, like 'services.users'.`,\n [SeedcordErrorCode.CorePluginFromOtherCore]: (plugin: string) =>\n `${paint.sky(plugin)} doesn't extend the ${paint.bold('Plugin')} class your bot uses. That usually means two copies of ${paint.bold('@seedcord/core')} are installed. Update the plugin and your ${paint.bold('@seedcord')} packages to versions that need the same ${paint.bold('@seedcord/core')}. Your package manager can list each installed copy and the package that pulled it in.`,\n [SeedcordErrorCode.CorePluginScopeMismatch]: (plugin: string, axis: string, declared: string, host: string) =>\n `${paint.sky(plugin)} only runs on the ${paint.bold(declared)} ${axis}, but this bot uses the ${paint.bold(host)} ${axis}. Remove the ${paint.bold('attach')} call, or move the bot to the ${paint.bold(declared)} ${axis}.`,\n [SeedcordErrorCode.CorePluginKeyHoldsGroup]: (key: string) =>\n `${paint.sky(key)} already holds a group of plugins. Attach this one under a name of its own.`,\n [SeedcordErrorCode.CorePluginReservedChannel]: (key: string) =>\n `${paint.sky(key)} is a channel the framework logs on. Attach the plugin under another key.`,\n [SeedcordErrorCode.CoreApplicationUnavailable]: () =>\n \"The bot's application id resolves during startup. You read it before that. Read it inside a handler, inside a plugin's ready(), or after start() resolves. An edge bot resolves it on its first request.\",\n [SeedcordErrorCode.CoreEdgeUnbuilt]: () =>\n `This worker has no public key or command ids. ${paint.bold('seedcord build')} reads them from Discord and writes them into the worker it builds. Deploy that build.`,\n [SeedcordErrorCode.CoreFetchBeforeStart]: () =>\n `${paint.bold('fetch()')} ran before ${paint.bold('start()')}. Call ${paint.bold('await seedcord.start()')} before your server passes requests to ${paint.bold('fetch()')}.`,\n [SeedcordErrorCode.CoreAccessorUnresolved]: (accessor: string, key: string) =>\n `${paint.sky(`${accessor}.${key}`)} has no value yet. ${accessor} fills during startup, but a read at the top of a file runs before that. Read it inside a handler, or after start() resolves.`,\n [SeedcordErrorCode.CoreLifecycleUnavailable]: () =>\n `core.shutdown.addTask() does not work on an edge bot. Cloudflare stops an isolate with no shutdown hook, so a shutdown task would never run. To use shutdown tasks, run the bot on node with new Seedcord(config).start().`,\n [SeedcordErrorCode.CoreBusEmitUnavailable]: (event: string) =>\n `core.bus.emit('${event}') would reach your on() listeners but skip every Subscriber class. Call core.bus.publish('${event}', data) to run both.`,\n [SeedcordErrorCode.CoreCommandGuildsEmpty]: (commandName: string) =>\n `${paint.sky(commandName)} registers to the 'config' guilds while commands.guilds is empty.\\nList the ids under commands.guilds, or pass them to @RegisterCommand('guild', [...]).`,\n [SeedcordErrorCode.CoreCommandGuildDeployFailed]: (guildId: string, reason: string, status?: number) =>\n `Discord refused the command deploy for guild ${paint.sky(guildId)}. ${reasonThen(reason, deployFix(status, 'Check that the id is right, and that your bot is in that server.'))}`,\n [SeedcordErrorCode.CoreCommandGlobalDeployFailed]: (reason: string, status?: number) =>\n `Discord refused the global command deploy. ${reasonThen(reason, deployFix(status, 'Try again, and check discordstatus.com if it keeps failing.'))}`,\n [SeedcordErrorCode.CoreWebhookUrlInvalid]: (className: string) =>\n `${paint.sky(className)} was given a URL that is not a Discord webhook URL. Pass the URL from the channel's Integrations settings, which looks like ${paint.bold('https://discord.com/api/webhooks/<id>/<token>')}.`,\n [SeedcordErrorCode.CoreDiscordReadFailed]: (what: string, reason: string, fix?: string) =>\n `Could not read ${what} from Discord (${reason}). ${fix ?? `Check that ${token()} is still valid.`}`,\n [SeedcordErrorCode.CoreDuplicateName]: (\n kind: string,\n name: string,\n sources: readonly string[] = [],\n note?: string\n ) =>\n `${sources.length > 0 ? `${allOf.format(sources)} define the ${kind} ${quoted(name)}.` : `The ${kind} ${quoted(name)} is defined twice.`}${note ? ` ${note}` : ''} Rename one.`,\n\n [SeedcordErrorCode.DecoratorCommandAlreadyRegistered]: (\n commandName: string,\n existingCall: string,\n requestedCall: string\n ) =>\n `${paint.sky(commandName)} is registered twice, first with ${existingCall}, then with ${requestedCall}. Keep one.`,\n [SeedcordErrorCode.DecoratorCommandGlobalWithGuilds]: (className: string) =>\n `${paint.sky(className)} passes guild ids to ${paint.bold(\"@RegisterCommand('global')\")}. Remove them, or register it with ${paint.bold(\"@RegisterCommand('guild', [...])\")}.`,\n [SeedcordErrorCode.DecoratorCommandGuildWithoutGuilds]: (className: string) =>\n `${paint.sky(className)} uses ${paint.bold(\"@RegisterCommand('guild')\")} with an empty guild list. Pass the guild ids as the second argument.`,\n [SeedcordErrorCode.DecoratorInvalidMiddlewarePriority]: (className: string, priority: string) =>\n `${paint.sky(className)} sets its middleware priority to ${priority}. Pass a finite number.`,\n [SeedcordErrorCode.DecoratorWebhookUrlMissing]: (className: string) =>\n `${paint.sky(className)} extends WebhookLog without a ${paint.bold('@WebhookUrl')} decorator. Add one with the name of the env var that holds the webhook URL.`,\n [SeedcordErrorCode.DecoratorEmptyMiddlewareFilter]: (className: string, key: string) =>\n `${paint.sky(className)} passes an empty array as ${paint.bold(key)}. Remove the key to run the middleware on everything.`,\n\n [SeedcordErrorCode.ReplyIllegalAckState]: (method: string, reason: string, alternative: string, routeId: string) =>\n `${paint.sky(`${method}()`)} was called when ${reason}.\\n${alternative} (route ${paint.mute(routeId)})`,\n [SeedcordErrorCode.ReplyComponentSerialization]: (\n componentClass: string,\n index: number,\n detail: string,\n routeId: string\n ) =>\n `${paint.sky(componentClass)} at components[${index}] failed to serialize: ${detail.replace(/\\.$/, '')}. (route ${paint.mute(routeId)})`,\n [SeedcordErrorCode.ReplyForeignEditTarget]: (method: string, targetId: string, routeId: string) =>\n `${paint.sky(`${method}()`)} was passed message ${targetId}, which this interaction did not send.\\nPass a message this interaction sent, returned by reply(), followUp(), edit(), or update(). (route ${paint.mute(routeId)})`,\n [SeedcordErrorCode.ReplyUpdateWithoutSource]: (method: string, routeId: string) =>\n `${paint.sky(`${method}()`)} was called on a modal opened from a command, which has no source message.\\nUse reply() or defer(). (route ${paint.mute(routeId)})`,\n [SeedcordErrorCode.ReplyCallbackMissingMessage]: (method: string, routeId: string) =>\n `Discord's interaction callback for ${paint.sky(`${method}()`)} returned no message. (route ${paint.mute(routeId)})`,\n\n [SeedcordErrorCode.CustomIdInvalidPrefix]: (prefix: string) =>\n `The customId prefix ${quoted(prefix)} is empty or holds a colon or a control character. Pick a prefix without them.`,\n [SeedcordErrorCode.CustomIdReservedFieldName]: (field: string) =>\n `The customId field name ${quoted(field)} looks like an integer. JS reorders integer keys, which would scramble the field order. Give it a name that is not a number.`,\n [SeedcordErrorCode.CustomIdEmptyChoices]: (field: string, method: string) =>\n `The customId field ${quoted(field)} uses ${method}() with no choices. Give it at least one choice, or make the field nullable.`,\n [SeedcordErrorCode.CustomIdInvalidBounds]: (field: string, min: number, max: number) =>\n `The customId field ${quoted(field)} has min ${min}, which is greater than max ${max}. Swap them, or fix the one that is wrong.`,\n [SeedcordErrorCode.CustomIdValueRejected]: (field: string, expected: string, value: string) =>\n `The customId field ${quoted(field)} expects ${expected}, but encode() got ${value}.`,\n [SeedcordErrorCode.CustomIdWireTooLong]: (prefix: string, length: number) =>\n `A customId encoded by ${quoted(prefix)} is ${length} characters, but Discord allows at most 100. Shorten the prefix, or move a field out of the customId.`,\n [SeedcordErrorCode.CustomIdHandlerRouteMissing]: (className: string) =>\n `${paint.sky(className)} is missing its route decorator. Add the one that matches its base, for example ${paint.bold('@ButtonRoute')} or ${paint.bold('@UserMenuRoute')}.`,\n [SeedcordErrorCode.MatchArmMissing]: (handler: string, kind: string, value: string) =>\n `${paint.bold(handler)}'s match() has no arm for the ${kind} ${quoted(value)}. Add one to the object you pass to match().`,\n [SeedcordErrorCode.EventNameUnavailable]: (handler: string, read: string) =>\n `${paint.sky(handler)} read ${paint.bold(read)}, but it was constructed without the name of the event that fired. The event controller passes that name. A handler or middleware you construct yourself takes it as the fourth constructor argument.`,\n [SeedcordErrorCode.AutocompleteNoFocusedOption]: () =>\n 'Discord sent an autocomplete payload with no focused option.',\n [SeedcordErrorCode.ModalFieldNotFound]: (customId: string) =>\n `The submitted modal carries no field with the custom id ${quoted(customId)}. Check it against the id you gave the component when you built the modal.`,\n [SeedcordErrorCode.ModalFieldWrongKind]: (customId: string, kind: string, getter?: string) =>\n getter\n ? `The modal field ${quoted(customId)} holds ${kind}. Read it with ${paint.bold(`${getter}()`)}.`\n : `The modal field ${quoted(customId)} holds ${kind}, but none of the getters read that kind.`,\n [SeedcordErrorCode.ModalFieldEmpty]: (customId: string) =>\n `The modal field ${quoted(customId)} has nothing picked. Build the component as required, or read it without the required argument.`,\n [SeedcordErrorCode.ModalFieldChannelType]: (customId: string, picked: string, allowed: readonly string[]) =>\n `The modal field ${quoted(customId)} picked a ${picked} channel, but this read allows ${oneOf.format(allowed)}. Give the channel select the same channel types.`,\n [SeedcordErrorCode.CustomIdWireStale]: (prefix: string) =>\n `The customId ${quoted(prefix)} was encoded under an older shape of this definition. Adding, removing, changing, or moving a field changes the layout hash.`,\n [SeedcordErrorCode.CustomIdWireInvalid]: (detail: string) =>\n `The customId could not be decoded. ${sentence(detail)}`,\n [SeedcordErrorCode.DispatchStateMissing]: (key: string) =>\n `Nothing set ${paint.sky(key)} on this dispatch. Check that the middleware writing it is registered and that its filter covers this dispatch.`,\n\n [SeedcordErrorCode.GateInvalidCooldownDuration]: (input: string) =>\n `The cooldown duration ${quoted(input)} is not valid. Pass a positive number of seconds, or a duration string like '30m', '24h', or '500ms'.`,\n\n [SeedcordErrorCode.PaginationInvalidPerPage]: (perPage: number) =>\n `perPage is ${perPage}. Pass a positive integer.`,\n [SeedcordErrorCode.PaginationControlCount]: (count: number, max: number) =>\n `This control row has ${counted(count, 'button', 'buttons')}. Pass 1 to ${max}, the most Discord allows in one row.`,\n [SeedcordErrorCode.PaginationDuplicateControls]: (key: string) =>\n `This control row repeats the ${paint.sky(key)} control. Each control can appear once in a row.`,\n\n [SeedcordErrorCode.ColorUnresolvable]: (value: string) =>\n `Cannot convert ${value} into a color. Pass a hex string like '#5865f2', a number, an [r, g, b] tuple, or a color name from the palette.`,\n [SeedcordErrorCode.ColorOutOfRange]: (value: number) =>\n `${value} is outside Discord's color range, 0 to 16777215 (0xffffff).`,\n\n [SeedcordErrorCode.UtilTableOptionInvalid]: (option: string, expected: string, value: number) =>\n `renderTable's ${paint.bold(option)} is ${value}. Pass ${expected}.`,\n [SeedcordErrorCode.UtilUnhandledUnionMember]: (value: string) =>\n `assertNever() ran with ${value}, which its types ruled out. Something passed a value outside the union.`,\n [SeedcordErrorCode.LoggerFileNameHasFolder]: (filename: string, logsFolder: string) =>\n `${paint.bold('WinstonFileSink')} got ${paint.path(filename)} as its ${paint.bold('filename')}, which has a folder in it. File logs always go in ${paint.path(logsFolder)}. Pass only the file name, like ${paint.sky(\"'bot-{date}.log'\")}.`,\n\n [SeedcordErrorCode.PluginOptionsRejected]: (pluginName: string, reason: string) =>\n `${paint.sky(pluginName)} rejected its options. ${sentence(reason.charAt(0).toUpperCase() + reason.slice(1))}`,\n [SeedcordErrorCode.PluginDisposeFailures]: (count: number) =>\n `${paint.iris(count)} plugins failed to dispose. Each one is listed below.`,\n [SeedcordErrorCode.PluginServiceDecoratorMissing]: (decorator: string, className: string) =>\n `${paint.sky(className)} is missing ${paint.bold(decorator)}. Add it to the class to register the service.`,\n [SeedcordErrorCode.PluginServicesNotReady]: (pluginName: string) =>\n `${paint.sky(`${pluginName}.services`)} was read before the plugin finished ${paint.bold('init()')}. Read it inside a handler, or after start() resolves.`,\n [SeedcordErrorCode.PluginConnectionFailed]: (service: string, target?: string) =>\n `Could not connect to ${paint.bold(service)}${target ? ` (${paint.sky(target)})` : ''}. Check that it is running and that the connection string is right.`,\n [SeedcordErrorCode.PluginDisconnectFailed]: (service: string) =>\n `Could not close the ${paint.bold(service)} connection cleanly during shutdown.`,\n\n [SeedcordErrorCode.PluginMongooseModelCreationFailed]: (modelName: string, className: string) =>\n `Could not build the mongoose model ${paint.sky(modelName)} for ${paint.bold(className)}. Check for another model with that name, and that the class has a schema.`,\n [SeedcordErrorCode.PluginMongooseModelNameMissing]: (className: string) =>\n `${paint.sky(className)} passes an empty model name to ${paint.bold('@RegisterMongooseService()')}. Pass a non-empty modelName.`,\n\n [SeedcordErrorCode.PluginKyselyServiceTableMissing]: (className: string) =>\n `${paint.sky(className)} has no table. Pass one to ${paint.bold('@RegisterKyselyService()')}.`,\n [SeedcordErrorCode.PluginKyselyInvalidStepCount]: (steps: number) =>\n `The migration step count is ${steps}. Pass zero or a positive integer.`,\n [SeedcordErrorCode.PluginKyselyUnknownDirection]: (direction: unknown) =>\n `${paint.sky(String(direction))} is not a migration direction. Pass 'up' or 'down'.`,\n [SeedcordErrorCode.PluginKyselyInvalidMigrationModule]: (filePath: string) =>\n `${paint.path(filePath)} needs an up function because it is in the migrations folder. Export up, and down if you need it, by name or on a default export object. Move a helper file out of the folder.`,\n [SeedcordErrorCode.PluginKyselyNonErrorFailure]: (message: string) =>\n `A migration failed with a value that is not an Error: ${message}.`,\n [SeedcordErrorCode.PluginKyselyBootstrapFailed]: (databaseName: string) =>\n `Could not create the database ${paint.sky(databaseName)}. Check that the database user may create databases, or create it yourself.`,\n\n [SeedcordErrorCode.CliCancelled]: () => 'Cancelled.',\n\n [SeedcordErrorCode.CliConfigInvalidExport]: () =>\n `The seedcord config file must default export an object, like ${paint.bold('export default defineConfig({ ... })')}.`,\n [SeedcordErrorCode.CliConfigNotFound]: (baseDir: string, candidates: readonly string[]) =>\n `Searched ${paint.path(baseDir)} for ${oneOf.format(candidates)} and found none. Run the command from your bot's folder, or create a ${paint.sky('seedcord.config.ts')} there.`,\n [SeedcordErrorCode.CliConfigInvalidField]: (field: string, expected: string) =>\n `${paint.bold(field)} in the seedcord config must be ${expected}.`,\n [SeedcordErrorCode.CliFileNotFound]: (path: string, field: string) =>\n `Cannot find ${paint.path(path)}. Point ${paint.bold(field)} in the seedcord config at a file that exists.`,\n [SeedcordErrorCode.CliInstanceInvalid]: (instancePath: string) =>\n `${paint.path(instancePath)} must default export the bot, a ${paint.bold('new Seedcord(...)')}, from ${paint.bold('@seedcord/gateway')} or ${paint.bold('@seedcord/http')}.`,\n [SeedcordErrorCode.CliStartFailed]: (instancePath: string, reason: string) =>\n `Failed to start the bot from ${paint.path(instancePath)}: ${reason}`,\n [SeedcordErrorCode.CliTsconfigNotFound]: (configDir: string, configured?: string) =>\n configured\n ? `${paint.bold('build.tsconfig')} points at ${paint.path(configured)}, which does not exist. Fix the path, or remove it to use the ${paint.sky('tsconfig.json')} in ${paint.path(configDir)}.`\n : `${paint.path(configDir)} does not contain a ${paint.sky('tsconfig.json')}. Add one there, or set ${paint.bold('build.tsconfig')} in the seedcord config.`,\n [SeedcordErrorCode.CliDependencyMissing]: (packages: readonly string[], projectDir: string, why: string) =>\n `Add ${allOf.format(packages.map((name) => paint.bold(name)))} to ${paint.path(projectDir)} as ${isOne(packages.length) ? 'a dev dependency' : 'dev dependencies'}. ${why}`,\n [SeedcordErrorCode.CliBuildFailed]: (diagnostics: string) => `Type check failed:\\n${diagnostics}`,\n [SeedcordErrorCode.CliBundleFailed]: (reason: string) => `Vite could not bundle the bot:\\n${reason}`,\n [SeedcordErrorCode.CliConfigOutDirDeletesRoot]: (outDir: string, root: string) =>\n `${paint.bold('build.outDir')} is ${paint.path(outDir)}, which contains ${paint.bold('root')} (${paint.path(root)}). ${paint.bold('seedcord build')} empties ${paint.bold('outDir')} before it writes. Point it at a folder of its own, like ${paint.sky('./dist')}.`,\n [SeedcordErrorCode.CliBuildOutDirNotEmpty]: (outDir: string) =>\n `${paint.bold('build.outDir')} is ${paint.path(outDir)}, which already contains other files. ${paint.bold('seedcord build')} empties ${paint.bold('outDir')} before it writes. Point it at an empty folder, or delete what is in it.`,\n [SeedcordErrorCode.CliProblems]: (count: number) =>\n `${paint.iris(count)} problems need fixing. Each one is listed below.`,\n [SeedcordErrorCode.CliEdgeCommandsNotDeployed]: (lines: readonly string[]) =>\n `${paint.iris(lines.length)} ${isOne(lines.length) ? 'command is' : 'commands are'} in your code with no deployed id on Discord, so the build cannot link ${isOne(lines.length) ? 'it' : 'them'}. Deploy with ${paint.bold('seedcord commands deploy')}, then build again.\\n${lines.join('\\n')}`,\n [SeedcordErrorCode.CliDevRuntimeNotRunning]: (method: string) =>\n `${paint.bold('seedcord dev')} called ${paint.bold(method)} while the dev runtime was not running. This is a bug in seedcord.`,\n [SeedcordErrorCode.CliDeployNoCommandsFolder]: (instance: string) =>\n `${paint.path(instance)} sets ${paint.bold('bot.commands.path')} to ${paint.bold('null')}. Point it at the folder that holds your commands to deploy them.`,\n [SeedcordErrorCode.CliDeployNeedsYes]: () =>\n `${paint.bold('seedcord commands deploy')} asks before it deploys, but it can only ask in a terminal with ${paint.bold('CI')} unset. Pass ${paint.bold('--yes')} to deploy without asking.`,\n [SeedcordErrorCode.CliNoScopeGiven]: (flags: readonly string[], note?: string) =>\n `No scope given. Pass ${oneOf.format(flags.map((flag) => paint.bold(flag)))}.${note ? ` ${note}` : ''}`,\n [SeedcordErrorCode.CliCommandConstructorThrew]: (name: string, file: string, reason: string) =>\n `${paint.sky(name)} threw while seedcord constructed it. Fix its constructor in ${paint.path(file)}. ${reason}`,\n [SeedcordErrorCode.CliCommandNotACommand]: (name: string, file: string) =>\n `${paint.bold(name)} in ${paint.path(file)} carries ${paint.bold('@RegisterCommand')}, but its component is not a slash command or a context menu. Extend ${paint.bold(\"BuilderComponent<'command'>\")} or ${paint.bold(\"BuilderComponent<'context_menu'>\")}.`,\n [SeedcordErrorCode.CliCommandsNotDeleted]: () =>\n 'Some commands could not be deleted. The warnings above give the reason for each one.',\n [SeedcordErrorCode.CliEdgeOnBun]: () =>\n `seedcord loads ${paint.path('cloudflare.config.ts')} through Cloudflare's config loader, which throws on Bun. Run the CLI on Node by leaving out ${paint.bold('--bun')}, as in ${paint.bold('bun run dev')}.`,\n [SeedcordErrorCode.CliEdgeNoWorker]: (cloudflareConfig: string) =>\n `${paint.path(cloudflareConfig)} sets no ${paint.bold('worker')}. Add a ${paint.bold('worker')} with your worker's ${paint.bold('name')} and ${paint.bold('compatibilityDate')}.`,\n [SeedcordErrorCode.CliNotProjectInstall]: (cliDir: string, projectInstall: string) =>\n `This ${paint.bold('seedcord')} runs from ${paint.path(cliDir)}, but the project installs its own at ${paint.path(projectInstall)}. The CLI and the bot must load the same seedcord packages. Run the command through a script in the project's ${paint.path('package.json')}.`,\n [SeedcordErrorCode.CliViteEnvironmentMissing]: (name: string, created: readonly string[]) =>\n `seedcord runs the bot in Vite's ${paint.bold(name)} environment. Vite created only ${allOf.format(created.map((environment) => paint.bold(environment)))}. Look in ${paint.bold('vitePlugins')} for a plugin whose ${paint.bold('config')} hook rewrites ${paint.bold('environments')}.`,\n [SeedcordErrorCode.CliListedFolderUnusable]: (folder: string, problem: keyof typeof listedFolderProblems) =>\n `${paint.bold('files')} in seedcord.config.ts lists ${paint.path(folder)}, ${listedFolderProblems[problem]}`,\n [SeedcordErrorCode.CliDevAlreadyRunning]: (configDir: string, pid: number, startedAt: string, lockFile: string) =>\n `Another ${paint.bold('seedcord dev')} is running this bot's application from ${paint.path(configDir)} (pid ${pid}, started ${startedAt}). Two dev sessions on one application overwrite each other's commands and interactions endpoint. Press ${paint.bold('q')} in that session, or delete ${paint.path(lockFile)} if it is no longer running.`,\n [SeedcordErrorCode.CliDevLockFolderNotOwned]: (folder: string) =>\n `Another user owns ${paint.path(folder)}, the folder ${paint.bold('seedcord dev')} writes its session locks to. That account could write a lock there that blocks your dev sessions. Ask that user or an admin to delete the folder, then start ${paint.bold('seedcord dev')} again.`,\n [SeedcordErrorCode.CliCodegenOutOfDate]: (outputPath: string) =>\n `${paint.path(outputPath)} is out of date. Run ${paint.bold('seedcord codegen')} and commit it.`,\n [SeedcordErrorCode.CliEdgeWithoutWorkerdCondition]: (cloudflareConfig: string, tsconfig: string) =>\n `${paint.path(cloudflareConfig)} makes this an edge bot, but ${paint.path(tsconfig)} leaves out ${paint.bold('\"customConditions\": [\"workerd\"]')}. Add it to compilerOptions for an edge bot, or set ${paint.bold('build.tsconfig')} to the tsconfig that holds it. For a node bot, move ${paint.path(cloudflareConfig)} out of this folder.`,\n [SeedcordErrorCode.CliWorkerdConditionWithoutCloudflareConfig]: (tsconfig: string, configDir: string) =>\n `${paint.path(tsconfig)} sets the ${paint.bold('workerd')} condition, which only an edge bot uses, but ${paint.path(configDir)} has no ${paint.path('cloudflare.config.ts')}. Add one for an edge bot. For a node bot, remove ${paint.bold('\"workerd\"')} from customConditions.`,\n [SeedcordErrorCode.CliConfigFileUnreadable]: (tool: string, file: string, output: string) =>\n `${tool} could not read ${paint.path(file)}. Fix the problem it reports:\\n${output}`,\n [SeedcordErrorCode.CliConfigFieldUnused]: (field: string, file: string, why: string) =>\n `${paint.path(file)} sets ${paint.bold(field)}. ${why} Remove ${paint.bold(field)} from ${paint.path(file)}.`,\n [SeedcordErrorCode.CliEdgeCompatDateTooOld]: (cloudflareConfig: string, date: string, firstDate: string) =>\n `A seedcord edge bot needs Cloudflare's Node compat. ${paint.path(cloudflareConfig)} sets ${paint.bold('compatibilityDate')} to ${date}, but Cloudflare turns Node compat on by default only from ${firstDate}. Set the date to ${firstDate} or later, or add ${paint.bold(\"'nodejs_compat'\")} to ${paint.bold('compatibilityFlags')}.`,\n [SeedcordErrorCode.CliEdgeNodeCompatOff]: (cloudflareConfig: string) =>\n `A seedcord edge bot needs Cloudflare's Node compat, but ${paint.path(cloudflareConfig)} turns it off with ${paint.bold(\"'no_nodejs_compat'\")}. Remove that flag from ${paint.bold('compatibilityFlags')}.`,\n [SeedcordErrorCode.CliEdgeBootFailed]: (reason: string) =>\n `The build could not start the worker in workerd, the runtime Cloudflare runs it on.\\n${reason}`,\n [SeedcordErrorCode.CliEdgeRootHoldsConfig]: (configFile: string, root: string) =>\n `An edge build bundles every file under ${paint.bold('root')}. ${paint.path(configFile)} sets ${paint.bold('root')} to ${paint.path(root)}, so the bundle would pull in that config file and tool configs like ${paint.sky('eslint.config.ts')}. Those break the bundle. Set ${paint.bold('root')} to the folder that holds the bot's code, like ${paint.sky(\"'./src'\")}.`,\n [SeedcordErrorCode.CliTypescriptNotStarted]: (tsc: string, reason: string) =>\n `Could not start TypeScript at ${paint.path(tsc)}: ${reason}`,\n [SeedcordErrorCode.CliPathHasHash]: (path: string) =>\n `${paint.path(path)} has a ${paint.bold('#')} in its path. Vite cuts a path at its first ${paint.bold('#')}, so rename it, or move the project to a folder without one.`,\n [SeedcordErrorCode.CliTunnelUrlUnavailable]: (seconds: number) =>\n `cloudflared did not report a tunnel URL within ${seconds}s. Check that the binary runs and that the network allows it.`,\n [SeedcordErrorCode.CliTunnelNotVerified]: (url: string) =>\n `Discord rejected ${paint.sky(url)} as an interactions endpoint. Discord checks the endpoint by sending it a signed request, so check that ${paint.bold('DISCORD_PUBLIC_KEY')} matches your application.`,\n [SeedcordErrorCode.CliTunnelUnreachable]: (url: string, seconds: number) =>\n `${paint.sky(url)} did not answer within ${seconds}s, so nothing was PATCHed to Discord.`,\n\n [SeedcordErrorCode.CreateFlagNotApplicable]: (flag: string) =>\n `The --${flag} flag does not apply to the answers you gave.`,\n [SeedcordErrorCode.CreateInvalidAnswer]: (flag: string, reason: string) => `--${flag}: ${reason}`,\n // node's parseArgs message ends on an unclosed quote\n [SeedcordErrorCode.CreateBadUsage]: (reason: string) => `${reason}\\nRun with --help for the flag list.`,\n [SeedcordErrorCode.CreateTargetNotEmpty]: (target: string) =>\n `${paint.path(target)} already has files in it. Pick an empty directory or a name that does not exist yet.`,\n [SeedcordErrorCode.CreateStepFailed]: (command: string, reason: string) =>\n `${paint.bold(command)} failed.\\n${reason}`\n} satisfies Record<SeedcordErrorCode, (...args: never[]) => string>;\n\n/** @internal */\nexport type SeedcordErrorArguments<Code extends SeedcordErrorCode> = Parameters<(typeof messages)[Code]>;\n\n/** @internal */\nexport function formatSeedcordErrorMessage<Code extends SeedcordErrorCode>(\n code: Code,\n args?: SeedcordErrorArguments<Code>\n): string {\n const formatter = messages[code];\n const resolvedArgs = (args ?? []) as unknown[];\n return (formatter as (...params: unknown[]) => string)(...resolvedArgs);\n}\n","import { SeedcordErrorCode } from './ErrorCodes';\nimport { formatSeedcordErrorMessage, type SeedcordErrorArguments } from './ErrorMessages';\nimport { paint } from './palette';\n\n/**\n * String literal type for Seedcord error identifiers.\n *\n * @internal\n */\ntype SeedcordErrorIdentifier = keyof typeof SeedcordErrorCode;\n\n/**\n * Options for Seedcord errors.\n *\n * @internal\n */\ninterface SeedcordErrorOptions extends ErrorOptions {}\n\nfunction resolveIdentifier(code: SeedcordErrorCode): SeedcordErrorIdentifier {\n return SeedcordErrorCode[code] as SeedcordErrorIdentifier;\n}\n\ntype SeedcordErrorPayload<Code extends SeedcordErrorCode> = SeedcordErrorArguments<Code> | undefined;\n\ntype SeedcordErrorCtorRest<Code extends SeedcordErrorCode> =\n SeedcordErrorArguments<Code> extends []\n ? [options?: SeedcordErrorOptions]\n : [args: SeedcordErrorArguments<Code>, options?: SeedcordErrorOptions];\n\nfunction resolveCtorInputs<Code extends SeedcordErrorCode>(\n rest: SeedcordErrorCtorRest<Code>\n): { args: SeedcordErrorPayload<Code>; options?: SeedcordErrorOptions } {\n const [maybeArgsOrOptions, maybeOptions] = rest;\n if (Array.isArray(maybeArgsOrOptions)) {\n const result: { args: SeedcordErrorPayload<Code>; options?: SeedcordErrorOptions } = {\n args: maybeArgsOrOptions\n };\n\n if (maybeOptions !== undefined) {\n result.options = maybeOptions;\n }\n\n return result;\n }\n\n const result: { args: SeedcordErrorPayload<Code>; options?: SeedcordErrorOptions } = {\n args: undefined\n };\n\n if (maybeArgsOrOptions !== undefined) {\n result.options = maybeArgsOrOptions;\n }\n\n return result;\n}\n\nfunction resolveMessage<Code extends SeedcordErrorCode>(code: Code, args: SeedcordErrorPayload<Code>): string {\n return formatSeedcordErrorMessage(code, args);\n}\n\nfunction formatErrorName(name: string, _identifier: SeedcordErrorIdentifier, code: SeedcordErrorCode): string {\n return `${paint.coral.bold(name)}[${paint.mute(code)}]`;\n}\n\n/**\n * String literal type for Seedcord error class names. Names the `type` argument of\n * {@link isSeedcordError}.\n */\nexport type SeedcordErrorTypeString = `Seedcord${'Error' | 'TypeError' | 'RangeError' | 'AggregateError'}`;\n\n// Symbol.for so two installed copies read the same slot\nconst kIdentifier: unique symbol = Symbol.for('seedcord:errors:identifier');\n\ninterface BaseSeedcordError {\n readonly code: SeedcordErrorCode;\n readonly [kIdentifier]: SeedcordErrorIdentifier;\n readonly type: SeedcordErrorTypeString;\n}\n\n// instanceof fails across two installed copies of this package\nconst CODED = Symbol.for('seedcord:errors:coded');\n\nfunction brand(prototype: object): void {\n Object.defineProperty(prototype, CODED, { value: true });\n}\n\nfunction isCoded(error: unknown): error is BaseSeedcordError {\n return typeof error === 'object' && error !== null && CODED in error;\n}\n\nexport class SeedcordError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends Error\n implements BaseSeedcordError\n{\n public readonly code: Code;\n readonly [kIdentifier]: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordError';\n\n constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(message, options);\n this.code = code;\n this[kIdentifier] = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this[kIdentifier], this.code);\n Object.setPrototypeOf(this, new.target.prototype);\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, new.target);\n }\n }\n}\n\nbrand(SeedcordError.prototype);\n\nexport class SeedcordTypeError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends TypeError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n readonly [kIdentifier]: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordTypeError';\n\n constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(message, options);\n this.code = code;\n this[kIdentifier] = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this[kIdentifier], this.code);\n Object.setPrototypeOf(this, new.target.prototype);\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, new.target);\n }\n }\n}\n\nbrand(SeedcordTypeError.prototype);\n\nexport class SeedcordRangeError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends RangeError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n readonly [kIdentifier]: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordRangeError';\n\n constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(message, options);\n this.code = code;\n this[kIdentifier] = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this[kIdentifier], this.code);\n Object.setPrototypeOf(this, new.target.prototype);\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, new.target);\n }\n }\n}\n\nbrand(SeedcordRangeError.prototype);\n\nexport class SeedcordAggregateError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends AggregateError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n readonly [kIdentifier]: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordAggregateError';\n\n constructor(code: Code, errors: readonly unknown[], ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(errors, message, options);\n this.code = code;\n this[kIdentifier] = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this[kIdentifier], this.code);\n Object.setPrototypeOf(this, new.target.prototype);\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, new.target);\n }\n }\n}\n\nbrand(SeedcordAggregateError.prototype);\n\n/**\n * Variant type for Seedcord error classes.\n *\n * @internal\n */\ntype SeedcordErrorVariant<\n Type extends SeedcordErrorTypeString,\n Code extends SeedcordErrorCode\n> = Type extends 'SeedcordError'\n ? SeedcordError<Code>\n : Type extends 'SeedcordTypeError'\n ? SeedcordTypeError<Code>\n : Type extends 'SeedcordRangeError'\n ? SeedcordRangeError<Code>\n : SeedcordAggregateError<Code>;\n\n/**\n * Union type of all Seedcord error variants for a specific error code.\n *\n * @internal\n */\ntype AnySeedcordErrorForCode<Code extends SeedcordErrorCode> = {\n [Variant in SeedcordErrorTypeString]: SeedcordErrorVariant<Variant, Code>;\n}[SeedcordErrorTypeString];\n\n/**\n * Union type of all Seedcord errors filtered by error class.\n *\n * @internal\n */\ntype ErrorTypeFilter<Type extends SeedcordErrorTypeString | undefined> = Type extends SeedcordErrorTypeString\n ? {\n [Code in SeedcordErrorCode]: SeedcordErrorVariant<Type, Code>;\n }[SeedcordErrorCode]\n : AnySeedcordErrorForCode<SeedcordErrorCode>;\n\n/**\n * Union type of all Seedcord errors filtered by error class and error code.\n *\n * @internal\n */\nexport type ErrorCodeFilter<\n Type extends SeedcordErrorTypeString | undefined,\n Code extends SeedcordErrorCode | undefined\n> = Code extends SeedcordErrorCode\n ? Type extends SeedcordErrorTypeString\n ? SeedcordErrorVariant<Type, Code>\n : AnySeedcordErrorForCode<Code>\n : ErrorTypeFilter<Type>;\n\n/**\n * Determines whether an unknown value is a Seedcord error, with optional narrowing by class and error code.\n *\n * @param error - The value to inspect.\n * @param type - Optional error class discriminator.\n * @param code - Optional {@link SeedcordErrorCode} discriminator to narrow by code.\n * @typeParam Type - What kind of {@link SeedcordErrorTypeString} to filter by.\n * @typeParam Code - The specific {@link SeedcordErrorCode} to filter by.\n */\nexport function isSeedcordError<\n Type extends SeedcordErrorTypeString | undefined,\n Code extends SeedcordErrorCode | undefined\n>(error: unknown, type?: Type, code?: Code): error is ErrorCodeFilter<Type, Code> {\n if (!isCoded(error)) return false;\n if (type && error.type !== type) return false;\n if (code === undefined) return true;\n // another copy of this package may number the same identifier differently\n return error[kIdentifier] === resolveIdentifier(code);\n}\n"],"mappings":";;;;;;AAKA,IAAY,oBAAL;;CAEH;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;C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,QAAW,OAAO;CAE/B,OAAO,MAAM,iBAAiB,kBAAkB,IAAI;AACxD"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as paint, o as isSeedcordError, p as SeedcordErrorCode, r as SeedcordErrorTypeString } from "./SeedcordError-Cce9qKW3.mjs";
|
|
2
2
|
//#region src/index.d.ts
|
|
3
3
|
/** Package version */
|
|
4
4
|
export declare const version: string;
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as isSeedcordError, c as
|
|
1
|
+
import { a as isSeedcordError, c as paint, d as SeedcordErrorCode } from "./SeedcordError-D9SmwpVL.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/index.ts
|
|
4
4
|
/** Package version */
|
|
5
|
-
const version = "0.
|
|
5
|
+
const version = "0.14.0";
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
8
|
export { SeedcordErrorCode, isSeedcordError, paint, version };
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
import { a as SeedcordTypeError, i as SeedcordRangeError, n as SeedcordError, s as
|
|
1
|
+
import { a as SeedcordTypeError, c as VitePluginPlace, f as setColorLevel, i as SeedcordRangeError, l as BRAND, n as SeedcordError, p as SeedcordErrorCode, s as SeedcordErrorArguments, t as SeedcordAggregateError, u as WORDMARK } from "./SeedcordError-Cce9qKW3.mjs";
|
|
2
|
+
//#region src/throwSingleOrAggregate.d.ts
|
|
3
|
+
type CountCode = { [Code in SeedcordErrorCode]: SeedcordErrorArguments<Code> extends [count: number] ? Code : never; }[SeedcordErrorCode];
|
|
4
|
+
export declare function throwSingleOrAggregate(problems: readonly unknown[], code: CountCode): void;
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/displayPath.d.ts
|
|
7
|
+
interface DisplayPathOptions {
|
|
8
|
+
prefix?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function displayPath(rawPath: string, { prefix }?: DisplayPathOptions): string;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/isSnowflake.d.ts
|
|
13
|
+
export declare function isSnowflake(value: string): boolean;
|
|
14
|
+
//#endregion
|
|
2
15
|
//#region src/validateDiscordToken.d.ts
|
|
16
|
+
interface BotToken {
|
|
17
|
+
readonly value: string;
|
|
18
|
+
readonly applicationId: string;
|
|
19
|
+
}
|
|
3
20
|
/** @internal */
|
|
4
|
-
export declare function validateDiscordToken(raw: unknown):
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/applicationIdFromToken.d.ts
|
|
7
|
-
export declare function applicationIdFromToken(token: string): string;
|
|
21
|
+
export declare function validateDiscordToken(raw: unknown): BotToken;
|
|
8
22
|
//#endregion
|
|
9
|
-
export { BRAND, SeedcordAggregateError, SeedcordError, SeedcordRangeError, SeedcordTypeError };
|
|
23
|
+
export { BRAND, type BotToken, SeedcordAggregateError, SeedcordError, type SeedcordErrorArguments, SeedcordRangeError, SeedcordTypeError, type VitePluginPlace, WORDMARK, setColorLevel };
|
|
10
24
|
//# sourceMappingURL=internal.index.d.mts.map
|
package/dist/internal.index.mjs
CHANGED
|
@@ -1,39 +1,65 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as SeedcordErrorCode, i as SeedcordTypeError, l as setColorLevel, n as SeedcordError, o as BRAND, r as SeedcordRangeError, s as WORDMARK, t as SeedcordAggregateError, u as displayPath } from "./SeedcordError-D9SmwpVL.mjs";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
//#region src/throwSingleOrAggregate.ts
|
|
4
|
+
function throwSingleOrAggregate(problems, code) {
|
|
5
|
+
if (problems.length === 0) return;
|
|
6
|
+
if (problems.length === 1) throw problems[0];
|
|
7
|
+
throw new SeedcordAggregateError(code, problems, [problems.length]);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/isSnowflake.ts
|
|
12
|
+
const SNOWFLAKE = /^\d{17,20}$/;
|
|
13
|
+
function isSnowflake(value) {
|
|
14
|
+
return SNOWFLAKE.test(value);
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
//#endregion
|
|
16
|
-
//#region src/
|
|
18
|
+
//#region src/validateDiscordToken.ts
|
|
19
|
+
const ENV_NAME = "DISCORD_BOT_TOKEN";
|
|
20
|
+
const TOKEN_SOURCE = "the bot token from your application's Bot page";
|
|
17
21
|
const URL_SAFE = /[-_]/g;
|
|
18
22
|
const STANDARD = {
|
|
19
23
|
"-": "+",
|
|
20
24
|
_: "/"
|
|
21
25
|
};
|
|
22
|
-
|
|
26
|
+
function unreadable(cause) {
|
|
27
|
+
return new SeedcordError(1007, [
|
|
28
|
+
ENV_NAME,
|
|
29
|
+
TOKEN_SOURCE,
|
|
30
|
+
"Discord builds the first part of a bot token from the application id, but this one doesn't have it. Check that the token wasn't cut off or mistyped."
|
|
31
|
+
], { cause });
|
|
32
|
+
}
|
|
23
33
|
function decode(segment) {
|
|
24
34
|
try {
|
|
25
35
|
return atob(segment.replaceAll(URL_SAFE, (char) => STANDARD[char] ?? char));
|
|
26
36
|
} catch (error) {
|
|
27
|
-
throw
|
|
37
|
+
throw unreadable(error);
|
|
28
38
|
}
|
|
29
39
|
}
|
|
30
|
-
function
|
|
31
|
-
const [first = ""] =
|
|
40
|
+
function applicationIdOf(value) {
|
|
41
|
+
const [first = ""] = value.split(".");
|
|
32
42
|
const decoded = decode(first);
|
|
33
|
-
if (!
|
|
43
|
+
if (!isSnowflake(decoded)) throw unreadable();
|
|
34
44
|
return decoded;
|
|
35
45
|
}
|
|
46
|
+
/** @internal */
|
|
47
|
+
function validateDiscordToken(raw) {
|
|
48
|
+
if (raw === null || raw === void 0) throw new SeedcordError(1006, [ENV_NAME]);
|
|
49
|
+
if (typeof raw !== "string") throw new SeedcordError(1007, [ENV_NAME, TOKEN_SOURCE]);
|
|
50
|
+
const value = raw.trim();
|
|
51
|
+
if (value === "") throw new SeedcordError(1006, [ENV_NAME]);
|
|
52
|
+
if (!/^[A-Za-z\d_-]{23,}\.[A-Za-z\d_-]{6,}\.[A-Za-z\d_-]{27,}$/.test(value)) throw new SeedcordError(1007, [
|
|
53
|
+
ENV_NAME,
|
|
54
|
+
TOKEN_SOURCE,
|
|
55
|
+
"It does not have the three dot-separated parts of a bot token."
|
|
56
|
+
]);
|
|
57
|
+
return {
|
|
58
|
+
value,
|
|
59
|
+
applicationId: applicationIdOf(value)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
36
62
|
|
|
37
63
|
//#endregion
|
|
38
|
-
export { BRAND, SeedcordAggregateError, SeedcordError, SeedcordRangeError, SeedcordTypeError,
|
|
64
|
+
export { BRAND, SeedcordAggregateError, SeedcordError, SeedcordRangeError, SeedcordTypeError, WORDMARK, displayPath, isSnowflake, setColorLevel, throwSingleOrAggregate, validateDiscordToken };
|
|
39
65
|
//# sourceMappingURL=internal.index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.index.mjs","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"internal.index.mjs","names":[],"sources":["../src/throwSingleOrAggregate.ts","../src/isSnowflake.ts","../src/validateDiscordToken.ts"],"sourcesContent":["import { SeedcordAggregateError } from './SeedcordError';\n\nimport type { SeedcordErrorCode } from './ErrorCodes';\nimport type { SeedcordErrorArguments } from './ErrorMessages';\n\ntype CountCode = {\n [Code in SeedcordErrorCode]: SeedcordErrorArguments<Code> extends [count: number] ? Code : never;\n}[SeedcordErrorCode];\n\nexport function throwSingleOrAggregate(problems: readonly unknown[], code: CountCode): void {\n if (problems.length === 0) return;\n if (problems.length === 1) throw problems[0];\n throw new SeedcordAggregateError(code, problems, [problems.length]);\n}\n","// ids reached 17 digits in late january 2015. a 64-bit id has at most 20\nconst SNOWFLAKE = /^\\d{17,20}$/;\n\nexport function isSnowflake(value: string): boolean {\n return SNOWFLAKE.test(value);\n}\n","import { SeedcordErrorCode } from './ErrorCodes';\nimport { isSnowflake } from './isSnowflake';\nimport { SeedcordError } from './SeedcordError';\n\nconst ENV_NAME = 'DISCORD_BOT_TOKEN';\n\nconst TOKEN_SOURCE = \"the bot token from your application's Bot page\";\n\nconst URL_SAFE = /[-_]/g;\nconst STANDARD: Record<string, string> = { '-': '+', _: '/' };\n\nexport interface BotToken {\n readonly value: string;\n readonly applicationId: string;\n}\n\nfunction unreadable(cause?: unknown): SeedcordError {\n return new SeedcordError(\n SeedcordErrorCode.ConfigInvalidEnv,\n [\n ENV_NAME,\n TOKEN_SOURCE,\n \"Discord builds the first part of a bot token from the application id, but this one doesn't have it. Check that the token wasn't cut off or mistyped.\"\n ],\n { cause }\n );\n}\n\nfunction decode(segment: string): string {\n try {\n return atob(segment.replaceAll(URL_SAFE, (char) => STANDARD[char] ?? char));\n } catch (error) {\n throw unreadable(error);\n }\n}\n\n// discord builds a bot token as base64(applicationId) followed by two more dot-separated segments\nfunction applicationIdOf(value: string): string {\n const [first = ''] = value.split('.');\n const decoded = decode(first);\n\n // a mistyped token can still be valid base64\n if (!isSnowflake(decoded)) throw unreadable();\n\n return decoded;\n}\n\n/** @internal */\nexport function validateDiscordToken(raw: unknown): BotToken {\n if (raw === null || raw === undefined) {\n throw new SeedcordError(SeedcordErrorCode.ConfigMissingEnv, [ENV_NAME]);\n }\n\n if (typeof raw !== 'string') {\n throw new SeedcordError(SeedcordErrorCode.ConfigInvalidEnv, [ENV_NAME, TOKEN_SOURCE]);\n }\n\n const value = raw.trim();\n if (value === '') {\n throw new SeedcordError(SeedcordErrorCode.ConfigMissingEnv, [ENV_NAME]);\n }\n\n // a 17-digit application id encodes to 23 chars. apps made before october 2015 have one\n const tokenRegex = /^[A-Za-z\\d_-]{23,}\\.[A-Za-z\\d_-]{6,}\\.[A-Za-z\\d_-]{27,}$/;\n\n if (!tokenRegex.test(value)) {\n throw new SeedcordError(SeedcordErrorCode.ConfigInvalidEnv, [\n ENV_NAME,\n TOKEN_SOURCE,\n 'It does not have the three dot-separated parts of a bot token.'\n ]);\n }\n\n return { value, applicationId: applicationIdOf(value) };\n}\n"],"mappings":";;;AASA,SAAgB,uBAAuB,UAA8B,MAAuB;CACxF,IAAI,SAAS,WAAW,GAAG;CAC3B,IAAI,SAAS,WAAW,GAAG,MAAM,SAAS;CAC1C,MAAM,IAAI,uBAAuB,MAAM,UAAU,CAAC,SAAS,MAAM,CAAC;AACtE;;;;ACZA,MAAM,YAAY;AAElB,SAAgB,YAAY,OAAwB;CAChD,OAAO,UAAU,KAAK,KAAK;AAC/B;;;;ACDA,MAAM,WAAW;AAEjB,MAAM,eAAe;AAErB,MAAM,WAAW;AACjB,MAAM,WAAmC;CAAE,KAAK;CAAK,GAAG;AAAI;AAO5D,SAAS,WAAW,OAAgC;CAChD,OAAO,IAAI,oBAEP;EACI;EACA;EACA;CACJ,GACA,EAAE,MAAM,CACZ;AACJ;AAEA,SAAS,OAAO,SAAyB;CACrC,IAAI;EACA,OAAO,KAAK,QAAQ,WAAW,WAAW,SAAS,SAAS,SAAS,IAAI,CAAC;CAC9E,SAAS,OAAO;EACZ,MAAM,WAAW,KAAK;CAC1B;AACJ;AAGA,SAAS,gBAAgB,OAAuB;CAC5C,MAAM,CAAC,QAAQ,MAAM,MAAM,MAAM,GAAG;CACpC,MAAM,UAAU,OAAO,KAAK;CAG5B,IAAI,CAAC,YAAY,OAAO,GAAG,MAAM,WAAW;CAE5C,OAAO;AACX;;AAGA,SAAgB,qBAAqB,KAAwB;CACzD,IAAI,QAAQ,QAAQ,QAAQ,QACxB,MAAM,IAAI,oBAAkD,CAAC,QAAQ,CAAC;CAG1E,IAAI,OAAO,QAAQ,UACf,MAAM,IAAI,oBAAkD,CAAC,UAAU,YAAY,CAAC;CAGxF,MAAM,QAAQ,IAAI,KAAK;CACvB,IAAI,UAAU,IACV,MAAM,IAAI,oBAAkD,CAAC,QAAQ,CAAC;CAM1E,IAAI,CAAC,2DAAW,KAAK,KAAK,GACtB,MAAM,IAAI,oBAAkD;EACxD;EACA;EACA;CACJ,CAAC;CAGL,OAAO;EAAE;EAAO,eAAe,gBAAgB,KAAK;CAAE;AAC1D"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seedcord/errors",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.14.0",
|
|
5
5
|
"engines": {
|
|
6
|
-
"node": "
|
|
6
|
+
"node": "^24.22.1 || >=26.12.1",
|
|
7
7
|
"bun": ">=1.4.2"
|
|
8
8
|
},
|
|
9
9
|
"description": "Typed errors with registered codes for seedcord bots",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"chalk": "^6.0.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@seedcord/eslint-config": "^
|
|
55
|
-
"@seedcord/tsconfig": "^
|
|
54
|
+
"@seedcord/eslint-config": "^3.0.0",
|
|
55
|
+
"@seedcord/tsconfig": "^3.0.0",
|
|
56
56
|
"@seedcord/tsdown-config": "^2.0.1",
|
|
57
57
|
"@seedcord/vitest-config": "^0.0.1"
|
|
58
58
|
},
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"test:watch": "vitest dev",
|
|
73
73
|
"coverage": "vitest run --coverage"
|
|
74
74
|
},
|
|
75
|
-
"readme": "<div align=\"center\">\n <picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://cdn.seedcord.org/assets/wordmark-dark.webp\" />\n <img src=\"https://cdn.seedcord.org/assets/wordmark-light.webp\" alt=\"seedcord\" width=\"440\" />\n </picture>\n</div>\n\n<div align=\"center\">\n <h3>The whole Discord bot, typed end to end</h3>\n <a href=\"https://seedcord.org\">Website</a> ·\n <a href=\"https://seedcord.org/guide\">Guide</a> ·\n <a href=\"https://seedcord.org/docs\">Reference</a> ·\n <a href=\"https://
|
|
75
|
+
"readme": "<div align=\"center\">\n <picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://cdn.seedcord.org/assets/wordmark-dark.webp\" />\n <img src=\"https://cdn.seedcord.org/assets/wordmark-light.webp\" alt=\"seedcord\" width=\"440\" />\n </picture>\n</div>\n\n<div align=\"center\">\n <h3>The whole Discord bot, typed end to end</h3>\n <a href=\"https://seedcord.org\">Website</a> ·\n <a href=\"https://seedcord.org/guide\">Guide</a> ·\n <a href=\"https://seedcord.org/docs\">Reference</a> ·\n <a href=\"https://seedcord.org/chat/\">Discord</a>\n</div>\n\n<br />\n\n<div align=\"center\">\n\n[](https://www.npmjs.com/package/@seedcord/errors) [](https://nodejs.org) [](https://bun.com) [](LICENSE)\n\n</div>\n\n## About\n\n`@seedcord/errors` defines the codes for every error seedcord throws, in `SeedcordErrorCode`. `isSeedcordError` checks a caught value against a code, so your code can react to one specific failure.\n\nBoth seedcord transports depend on it and re-export it, so a bot imports `isSeedcordError` from its transport. Install it directly in a plugin or a library that catches errors from a seedcord package, like [`@seedcord/custom-id`](https://www.npmjs.com/package/@seedcord/custom-id) in a discord.js bot.\n\nseedcord is pre-1.0, so a minor version can break your code. Each release's changelog says what changed and how to update.\n\n## Installation\n\n```sh\npnpm add @seedcord/errors\n```\n\n## Usage\n\nSay `Approve` is a `CustomId` from `@seedcord/custom-id`, and a click arrives on a button built from an older version of it:\n\n```ts\nimport { isSeedcordError, SeedcordErrorCode } from '@seedcord/errors';\n\ntry {\n Approve.decode(interaction.customId);\n} catch (error) {\n if (!isSeedcordError(error, 'SeedcordError', SeedcordErrorCode.CustomIdWireStale)) throw error;\n await interaction.reply('This button is out of date. Run the command again.');\n}\n```\n\nThe [error handling guide](https://seedcord.org/guide/replying/error-behavior) covers how a seedcord bot replies to an error.\n"
|
|
76
76
|
}
|