@seedcord/errors 0.15.0-next.0 → 0.15.0-next.3

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.
@@ -1,340 +1,6 @@
1
+ import { SeedcordErrorCode } from "./ErrorCodes.mjs";
1
2
  import chalk from "chalk";
2
3
 
3
- //#region src/ErrorCodes.ts
4
- /**
5
- * All Seedcord error codes.
6
- */
7
- let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
8
- /** Two or more configured emojis failed to resolve at startup. */
9
- SeedcordErrorCode[SeedcordErrorCode["ConfigEmojiUnresolved"] = 1001] = "ConfigEmojiUnresolved";
10
- /** A configured emoji is neither a name nor a `[name, guildId]` pair. */
11
- SeedcordErrorCode[SeedcordErrorCode["ConfigEmojiInvalid"] = 1002] = "ConfigEmojiInvalid";
12
- /** The application or guild a configured emoji points at has no emoji with that name. */
13
- SeedcordErrorCode[SeedcordErrorCode["ConfigEmojiNotFound"] = 1003] = "ConfigEmojiNotFound";
14
- /** Reading the emojis of the application or guild a configured emoji points at failed. */
15
- SeedcordErrorCode[SeedcordErrorCode["ConfigEmojiSourceUnreadable"] = 1004] = "ConfigEmojiSourceUnreadable";
16
- /** Discord has no webhook at a configured URL, because it was deleted or the id or token is wrong. */
17
- SeedcordErrorCode[SeedcordErrorCode["ConfigWebhookNotFound"] = 1005] = "ConfigWebhookNotFound";
18
- /** A required environment variable is unset. */
19
- SeedcordErrorCode[SeedcordErrorCode["ConfigMissingEnv"] = 1006] = "ConfigMissingEnv";
20
- /** An environment variable is set to a value seedcord cannot use. */
21
- SeedcordErrorCode[SeedcordErrorCode["ConfigInvalidEnv"] = 1007] = "ConfigInvalidEnv";
22
- /** A command that runs in guilds is registered without the `Guilds` intent, so discord.js caches no guild. */
23
- SeedcordErrorCode[SeedcordErrorCode["MissingGuildsIntent"] = 1008] = "MissingGuildsIntent";
24
- /** The running Node or Bun is older than the range seedcord declares in `engines`. */
25
- SeedcordErrorCode[SeedcordErrorCode["UnsupportedRuntimeVersion"] = 1009] = "UnsupportedRuntimeVersion";
26
- /** An edge config sets a REST sweeper interval. */
27
- SeedcordErrorCode[SeedcordErrorCode["ConfigEdgeRestSweeper"] = 1010] = "ConfigEdgeRestSweeper";
28
- /** Another process already listens on the port seedcord tries to listen on. */
29
- SeedcordErrorCode[SeedcordErrorCode["PortInUse"] = 1011] = "PortInUse";
30
- /** A startup task was added or removed while startup ran, or added after it finished. */
31
- SeedcordErrorCode[SeedcordErrorCode["LifecycleTaskChangeRejected"] = 1101] = "LifecycleTaskChangeRejected";
32
- /** A lifecycle call got a phase that is not a member of `StartupPhase` or `ShutdownPhase`. */
33
- SeedcordErrorCode[SeedcordErrorCode["LifecycleUnknownPhase"] = 1102] = "LifecycleUnknownPhase";
34
- /** One or more tasks failed during a startup phase. */
35
- SeedcordErrorCode[SeedcordErrorCode["LifecyclePhaseFailures"] = 1103] = "LifecyclePhaseFailures";
36
- /** A lifecycle task ran past its timeout. */
37
- SeedcordErrorCode[SeedcordErrorCode["LifecycleTaskTimeout"] = 1104] = "LifecycleTaskTimeout";
38
- /** A host whose startup failed was started again. */
39
- SeedcordErrorCode[SeedcordErrorCode["LifecycleRestartAfterFailure"] = 1105] = "LifecycleRestartAfterFailure";
40
- /** A shutdown deadline or a plugin's lifecycle timeout is zero, negative, or not finite. */
41
- SeedcordErrorCode[SeedcordErrorCode["LifecycleInvalidTimeout"] = 1106] = "LifecycleInvalidTimeout";
42
- /** A second Seedcord instance was constructed while one already exists. */
43
- SeedcordErrorCode[SeedcordErrorCode["CoreSingletonViolation"] = 1201] = "CoreSingletonViolation";
44
- /** A plugin was attached after the bot started. */
45
- SeedcordErrorCode[SeedcordErrorCode["CorePluginAfterInit"] = 1202] = "CorePluginAfterInit";
46
- /** A plugin was attached under a key another plugin already uses. */
47
- SeedcordErrorCode[SeedcordErrorCode["CorePluginKeyExists"] = 1203] = "CorePluginKeyExists";
48
- /** The bot's own role is missing from the guild's role cache. */
49
- SeedcordErrorCode[SeedcordErrorCode["CoreBotRoleMissing"] = 1204] = "CoreBotRoleMissing";
50
- /** A bot controller was constructed without the folder that holds its handlers. */
51
- SeedcordErrorCode[SeedcordErrorCode["CoreControllerPathMissing"] = 1205] = "CoreControllerPathMissing";
52
- /** seedcord could not import a file in the bot or in the CLI. */
53
- SeedcordErrorCode[SeedcordErrorCode["CoreImportFailed"] = 1206] = "CoreImportFailed";
54
- /** A file or folder that seedcord reads could not be read. */
55
- SeedcordErrorCode[SeedcordErrorCode["CorePathUnreadable"] = 1207] = "CorePathUnreadable";
56
- /** A plugin was attached under a key that the framework logs on. */
57
- SeedcordErrorCode[SeedcordErrorCode["CorePluginReservedChannel"] = 1208] = "CorePluginReservedChannel";
58
- /** The application id was read before startup resolved it. */
59
- SeedcordErrorCode[SeedcordErrorCode["CoreApplicationUnavailable"] = 1209] = "CoreApplicationUnavailable";
60
- /** A generated accessor like `Emojis` or `Commands` was read for a key that has no value yet. */
61
- SeedcordErrorCode[SeedcordErrorCode["CoreAccessorUnresolved"] = 1210] = "CoreAccessorUnresolved";
62
- /** A shutdown task was added on an edge bot. Cloudflare stops an isolate without a shutdown hook. */
63
- SeedcordErrorCode[SeedcordErrorCode["CoreLifecycleUnavailable"] = 1211] = "CoreLifecycleUnavailable";
64
- /** `emit` was called on the bus. It calls the listeners and skips every subscriber. */
65
- SeedcordErrorCode[SeedcordErrorCode["CoreBusEmitUnavailable"] = 1212] = "CoreBusEmitUnavailable";
66
- /** A command registers to the `'config'` guilds while `commands.guilds` is empty. */
67
- SeedcordErrorCode[SeedcordErrorCode["CoreCommandGuildsEmpty"] = 1213] = "CoreCommandGuildsEmpty";
68
- /** Discord refused the command deploy for one guild. */
69
- SeedcordErrorCode[SeedcordErrorCode["CoreCommandGuildDeployFailed"] = 1214] = "CoreCommandGuildDeployFailed";
70
- /** A plugin was attached under a group name the bot already uses. */
71
- SeedcordErrorCode[SeedcordErrorCode["CorePluginGroupTaken"] = 1215] = "CorePluginGroupTaken";
72
- /** A plugin was attached at a name that holds a group of plugins. */
73
- SeedcordErrorCode[SeedcordErrorCode["CorePluginKeyHoldsGroup"] = 1216] = "CorePluginKeyHoldsGroup";
74
- /** A plugin key is empty, has an empty part, or has more than one dot. */
75
- SeedcordErrorCode[SeedcordErrorCode["CorePluginKeyMalformed"] = 1217] = "CorePluginKeyMalformed";
76
- /** An attached plugin extends the `Plugin` class of a different copy of `@seedcord/core`. */
77
- SeedcordErrorCode[SeedcordErrorCode["CorePluginFromOtherCore"] = 1218] = "CorePluginFromOtherCore";
78
- /** A folder or the `build.start` file is outside `root`. */
79
- SeedcordErrorCode[SeedcordErrorCode["CorePathOutsideRoot"] = 1219] = "CorePathOutsideRoot";
80
- /** A plugin declares a transport or runtime the bot doesn't use. */
81
- SeedcordErrorCode[SeedcordErrorCode["CorePluginScopeMismatch"] = 1220] = "CorePluginScopeMismatch";
82
- /** A node http bot got a request through `fetch` before `start()` was called. */
83
- SeedcordErrorCode[SeedcordErrorCode["CoreFetchBeforeStart"] = 1221] = "CoreFetchBeforeStart";
84
- /** An edge worker got a POST without the ids that `seedcord build` writes into it. */
85
- SeedcordErrorCode[SeedcordErrorCode["CoreEdgeUnbuilt"] = 1222] = "CoreEdgeUnbuilt";
86
- /** A relative folder was read in a process that never got the bot's `root`. */
87
- SeedcordErrorCode[SeedcordErrorCode["CoreDirectoryRootUnknown"] = 1223] = "CoreDirectoryRootUnknown";
88
- /** Discord refused the global command deploy. */
89
- SeedcordErrorCode[SeedcordErrorCode["CoreCommandGlobalDeployFailed"] = 1224] = "CoreCommandGlobalDeployFailed";
90
- /** A built bot read a folder that did not exist under `root` when `seedcord build` ran. */
91
- SeedcordErrorCode[SeedcordErrorCode["CoreDirectoryNotBuilt"] = 1225] = "CoreDirectoryNotBuilt";
92
- /** A webhook sender was constructed with a URL that is not a Discord webhook URL. */
93
- SeedcordErrorCode[SeedcordErrorCode["CoreWebhookUrlInvalid"] = 1226] = "CoreWebhookUrlInvalid";
94
- /** Reading from Discord with `DISCORD_BOT_TOKEN` failed, like the application, its public key, or its commands. */
95
- SeedcordErrorCode[SeedcordErrorCode["CoreDiscordReadFailed"] = 1227] = "CoreDiscordReadFailed";
96
- /** Two routes, commands, migrations, or customId fields have the same name, or two code files build to the same file. */
97
- SeedcordErrorCode[SeedcordErrorCode["CoreDuplicateName"] = 1228] = "CoreDuplicateName";
98
- /** A Vite plugin from `vitePlugins` threw while Vite started or loaded a file, or failed when seedcord called `vitePlugins`. */
99
- SeedcordErrorCode[SeedcordErrorCode["CoreVitePluginThrew"] = 1229] = "CoreVitePluginThrew";
100
- /** `readFiles` read a folder that `files` in `seedcord.config.ts` leaves out. */
101
- SeedcordErrorCode[SeedcordErrorCode["CoreDirectoryNotListed"] = 1230] = "CoreDirectoryNotListed";
102
- /** A folder is inside one that `seedcord build` skips, like a dot-folder, `node_modules`, `outDir` or the logs folder. */
103
- SeedcordErrorCode[SeedcordErrorCode["CoreDirectorySkipped"] = 1231] = "CoreDirectorySkipped";
104
- /** `collection.entries()` ran on a Keyv store in `config.kv` that can't list its keys. */
105
- SeedcordErrorCode[SeedcordErrorCode["CoreKvKeysUnsupported"] = 1232] = "CoreKvKeysUnsupported";
106
- /** A plugin built with `new` outside `attach()` read `this.kv`. */
107
- SeedcordErrorCode[SeedcordErrorCode["CorePluginKvOutsideAttach"] = 1233] = "CorePluginKvOutsideAttach";
108
- /** The driver in `config.kv` threw, or reported a write as failed. */
109
- SeedcordErrorCode[SeedcordErrorCode["CoreKvDriverFailed"] = 1234] = "CoreKvDriverFailed";
110
- /** A command class carries `@RegisterCommand` twice. */
111
- SeedcordErrorCode[SeedcordErrorCode["DecoratorCommandAlreadyRegistered"] = 1301] = "DecoratorCommandAlreadyRegistered";
112
- /** `@RegisterCommand('global')` was given guild ids. */
113
- SeedcordErrorCode[SeedcordErrorCode["DecoratorCommandGlobalWithGuilds"] = 1302] = "DecoratorCommandGlobalWithGuilds";
114
- /** `@RegisterCommand('guild')` was given no guild ids. */
115
- SeedcordErrorCode[SeedcordErrorCode["DecoratorCommandGuildWithoutGuilds"] = 1303] = "DecoratorCommandGuildWithoutGuilds";
116
- /** A middleware decorator sets a priority that is not a finite number. */
117
- SeedcordErrorCode[SeedcordErrorCode["DecoratorInvalidMiddlewarePriority"] = 1304] = "DecoratorInvalidMiddlewarePriority";
118
- /** A `WebhookLog` subclass is missing its `@WebhookUrl` decorator. */
119
- SeedcordErrorCode[SeedcordErrorCode["DecoratorWebhookUrlMissing"] = 1305] = "DecoratorWebhookUrlMissing";
120
- /** A middleware decorator got an empty filter array. */
121
- SeedcordErrorCode[SeedcordErrorCode["DecoratorEmptyMiddlewareFilter"] = 1306] = "DecoratorEmptyMiddlewareFilter";
122
- /** A reply method was called in an ack state where Discord rejects it. */
123
- SeedcordErrorCode[SeedcordErrorCode["ReplyIllegalAckState"] = 1501] = "ReplyIllegalAckState";
124
- /** A reply component threw while seedcord serialized it. */
125
- SeedcordErrorCode[SeedcordErrorCode["ReplyComponentSerialization"] = 1502] = "ReplyComponentSerialization";
126
- /** `edit()` got a message that the interaction did not send. */
127
- SeedcordErrorCode[SeedcordErrorCode["ReplyForeignEditTarget"] = 1503] = "ReplyForeignEditTarget";
128
- /** `update()` or `deferUpdate()` was called on a modal that has no source message. */
129
- SeedcordErrorCode[SeedcordErrorCode["ReplyUpdateWithoutSource"] = 1504] = "ReplyUpdateWithoutSource";
130
- /** Discord's response to a `withResponse` callback has no message in it. */
131
- SeedcordErrorCode[SeedcordErrorCode["ReplyCallbackMissingMessage"] = 1505] = "ReplyCallbackMissingMessage";
132
- /** A customId prefix is empty, or holds a colon or a control character. */
133
- SeedcordErrorCode[SeedcordErrorCode["CustomIdInvalidPrefix"] = 1601] = "CustomIdInvalidPrefix";
134
- /** A customId field name looks like an integer. JS reorders integer keys. */
135
- SeedcordErrorCode[SeedcordErrorCode["CustomIdReservedFieldName"] = 1602] = "CustomIdReservedFieldName";
136
- /** A `oneOf()` or `someOf()` field was declared with no choices. */
137
- SeedcordErrorCode[SeedcordErrorCode["CustomIdEmptyChoices"] = 1603] = "CustomIdEmptyChoices";
138
- /** An `int()` field was declared with a min greater than its max. */
139
- SeedcordErrorCode[SeedcordErrorCode["CustomIdInvalidBounds"] = 1604] = "CustomIdInvalidBounds";
140
- /** `encode()` got a value that doesn't fit its field. */
141
- SeedcordErrorCode[SeedcordErrorCode["CustomIdValueRejected"] = 1605] = "CustomIdValueRejected";
142
- /** An encoded customId is longer than the 100 characters Discord allows. */
143
- SeedcordErrorCode[SeedcordErrorCode["CustomIdWireTooLong"] = 1606] = "CustomIdWireTooLong";
144
- /** A component handler is missing the route decorator that matches its base. */
145
- SeedcordErrorCode[SeedcordErrorCode["CustomIdHandlerRouteMissing"] = 1607] = "CustomIdHandlerRouteMissing";
146
- /** A handler's `match()` has no arm for the current route, field, event, or command. */
147
- SeedcordErrorCode[SeedcordErrorCode["MatchArmMissing"] = 1608] = "MatchArmMissing";
148
- /** An event handler or middleware read the event name but was constructed without one. */
149
- SeedcordErrorCode[SeedcordErrorCode["EventNameUnavailable"] = 1609] = "EventNameUnavailable";
150
- /** Discord sent an autocomplete payload with no focused option. */
151
- SeedcordErrorCode[SeedcordErrorCode["AutocompleteNoFocusedOption"] = 1610] = "AutocompleteNoFocusedOption";
152
- /** The submitted modal has no field with the requested custom id. */
153
- SeedcordErrorCode[SeedcordErrorCode["ModalFieldNotFound"] = 1611] = "ModalFieldNotFound";
154
- /** A modal field getter was called on a field of another kind. */
155
- SeedcordErrorCode[SeedcordErrorCode["ModalFieldWrongKind"] = 1612] = "ModalFieldWrongKind";
156
- /** A modal field read as required has nothing picked. */
157
- SeedcordErrorCode[SeedcordErrorCode["ModalFieldEmpty"] = 1613] = "ModalFieldEmpty";
158
- /** A channel select returned a channel whose type the `getSelectedChannels()` call excludes. */
159
- SeedcordErrorCode[SeedcordErrorCode["ModalFieldChannelType"] = 1614] = "ModalFieldChannelType";
160
- /** A customId was encoded under an older shape of the same definition. */
161
- SeedcordErrorCode[SeedcordErrorCode["CustomIdWireStale"] = 1615] = "CustomIdWireStale";
162
- /** A customId is corrupt, truncated, or was encoded by a different definition. */
163
- SeedcordErrorCode[SeedcordErrorCode["CustomIdWireInvalid"] = 1616] = "CustomIdWireInvalid";
164
- /** `dispatch.require()` was called for a key that nothing set on this dispatch. */
165
- SeedcordErrorCode[SeedcordErrorCode["DispatchStateMissing"] = 1617] = "DispatchStateMissing";
166
- /** A `Cooldown` gate got a duration that doesn't parse, or one of zero or less. */
167
- SeedcordErrorCode[SeedcordErrorCode["GateInvalidCooldownDuration"] = 1701] = "GateInvalidCooldownDuration";
168
- /** A paginator got a `perPage` that is not a positive integer. */
169
- SeedcordErrorCode[SeedcordErrorCode["PaginationInvalidPerPage"] = 1801] = "PaginationInvalidPerPage";
170
- /** A control row has no controls, or more than the five buttons Discord allows. */
171
- SeedcordErrorCode[SeedcordErrorCode["PaginationControlCount"] = 1802] = "PaginationControlCount";
172
- /** A control row lists the same control twice. Its two buttons would share a custom_id. */
173
- SeedcordErrorCode[SeedcordErrorCode["PaginationDuplicateControls"] = 1803] = "PaginationDuplicateControls";
174
- /** A color value doesn't resolve to a Discord color integer. */
175
- SeedcordErrorCode[SeedcordErrorCode["ColorUnresolvable"] = 1901] = "ColorUnresolvable";
176
- /** A resolved color is outside Discord's range of 0x000000 to 0xffffff. */
177
- SeedcordErrorCode[SeedcordErrorCode["ColorOutOfRange"] = 1902] = "ColorOutOfRange";
178
- /** `renderTable` got a `maxWidth` or `padding` outside the values it accepts. */
179
- SeedcordErrorCode[SeedcordErrorCode["UtilTableOptionInvalid"] = 1951] = "UtilTableOptionInvalid";
180
- /** `assertNever` ran with a value that its types ruled out. */
181
- SeedcordErrorCode[SeedcordErrorCode["UtilUnhandledUnionMember"] = 1952] = "UtilUnhandledUnionMember";
182
- /** `WinstonFileSink` got a `filename` with a folder in it. File logs always go in the logs folder. */
183
- SeedcordErrorCode[SeedcordErrorCode["LoggerFileNameHasFolder"] = 1971] = "LoggerFileNameHasFolder";
184
- /** A plugin's constructor called `rejectOptions` on the options it got. */
185
- SeedcordErrorCode[SeedcordErrorCode["PluginOptionsRejected"] = 2001] = "PluginOptionsRejected";
186
- /** Two or more plugins threw while disposing. */
187
- SeedcordErrorCode[SeedcordErrorCode["PluginDisposeFailures"] = 2002] = "PluginDisposeFailures";
188
- /** A plugin service class is missing the decorator that registers it. */
189
- SeedcordErrorCode[SeedcordErrorCode["PluginServiceDecoratorMissing"] = 2003] = "PluginServiceDecoratorMissing";
190
- /** A plugin's `services` was read before the plugin finished `init()`. */
191
- SeedcordErrorCode[SeedcordErrorCode["PluginServicesNotReady"] = 2004] = "PluginServicesNotReady";
192
- /** A plugin could not connect to the service it wraps. */
193
- SeedcordErrorCode[SeedcordErrorCode["PluginConnectionFailed"] = 2005] = "PluginConnectionFailed";
194
- /** A plugin could not close its connection cleanly during shutdown. */
195
- SeedcordErrorCode[SeedcordErrorCode["PluginDisconnectFailed"] = 2006] = "PluginDisconnectFailed";
196
- /** Mongoose threw while building a model, usually for a duplicate model name or a missing schema. */
197
- SeedcordErrorCode[SeedcordErrorCode["PluginMongooseModelCreationFailed"] = 2101] = "PluginMongooseModelCreationFailed";
198
- /** A mongoose service was registered with an empty model name. */
199
- SeedcordErrorCode[SeedcordErrorCode["PluginMongooseModelNameMissing"] = 2102] = "PluginMongooseModelNameMissing";
200
- /** A kysely service class has no table. */
201
- SeedcordErrorCode[SeedcordErrorCode["PluginKyselyServiceTableMissing"] = 2201] = "PluginKyselyServiceTableMissing";
202
- /** A migration run got a step count that is not a non-negative integer. */
203
- SeedcordErrorCode[SeedcordErrorCode["PluginKyselyInvalidStepCount"] = 2202] = "PluginKyselyInvalidStepCount";
204
- /** A migration run got a direction other than `up` or `down`. */
205
- SeedcordErrorCode[SeedcordErrorCode["PluginKyselyUnknownDirection"] = 2203] = "PluginKyselyUnknownDirection";
206
- /** A file in the migrations folder has no `up` function. */
207
- SeedcordErrorCode[SeedcordErrorCode["PluginKyselyInvalidMigrationModule"] = 2204] = "PluginKyselyInvalidMigrationModule";
208
- /** A migration failed with a thrown value that is not an `Error`. */
209
- SeedcordErrorCode[SeedcordErrorCode["PluginKyselyNonErrorFailure"] = 2205] = "PluginKyselyNonErrorFailure";
210
- /** Creating the target Postgres database failed. */
211
- SeedcordErrorCode[SeedcordErrorCode["PluginKyselyBootstrapFailed"] = 2206] = "PluginKyselyBootstrapFailed";
212
- /** Someone pressed Ctrl-C at a prompt in `seedcord` or `create-seedcord`. */
213
- SeedcordErrorCode[SeedcordErrorCode["CliCancelled"] = 3001] = "CliCancelled";
214
- /** The seedcord config file's default export is not an object. */
215
- SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidExport"] = 3101] = "CliConfigInvalidExport";
216
- /** No seedcord config file exists in the folder the CLI searched. */
217
- SeedcordErrorCode[SeedcordErrorCode["CliConfigNotFound"] = 3102] = "CliConfigNotFound";
218
- /** The file that `instance` or `build.start` in the seedcord config points at does not exist. */
219
- SeedcordErrorCode[SeedcordErrorCode["CliFileNotFound"] = 3103] = "CliFileNotFound";
220
- /** The instance file's default export is not a constructed `Seedcord`. */
221
- SeedcordErrorCode[SeedcordErrorCode["CliInstanceInvalid"] = 3104] = "CliInstanceInvalid";
222
- /** The bot threw during startup. */
223
- SeedcordErrorCode[SeedcordErrorCode["CliStartFailed"] = 3105] = "CliStartFailed";
224
- /** `build.tsconfig` points at a missing file, or it is unset and the config's folder has no `tsconfig.json`. */
225
- SeedcordErrorCode[SeedcordErrorCode["CliTsconfigNotFound"] = 3106] = "CliTsconfigNotFound";
226
- /** `seedcord build` found type errors. */
227
- SeedcordErrorCode[SeedcordErrorCode["CliBuildFailed"] = 3107] = "CliBuildFailed";
228
- /** `commands clean` or `commands purge` ran without a flag that picks where it deletes. */
229
- SeedcordErrorCode[SeedcordErrorCode["CliNoScopeGiven"] = 3108] = "CliNoScopeGiven";
230
- /** cloudflared never reported a quick tunnel hostname. */
231
- SeedcordErrorCode[SeedcordErrorCode["CliTunnelUrlUnavailable"] = 3109] = "CliTunnelUrlUnavailable";
232
- /** Discord rejected the tunnel URL as an interactions endpoint. */
233
- SeedcordErrorCode[SeedcordErrorCode["CliTunnelNotVerified"] = 3110] = "CliTunnelNotVerified";
234
- /** The tunnel URL never answered its health probe. */
235
- SeedcordErrorCode[SeedcordErrorCode["CliTunnelUnreachable"] = 3111] = "CliTunnelUnreachable";
236
- /** A field in the seedcord config is missing or has the wrong shape. */
237
- SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidField"] = 3112] = "CliConfigInvalidField";
238
- /** A class carrying `@RegisterCommand` threw while seedcord constructed it. */
239
- SeedcordErrorCode[SeedcordErrorCode["CliCommandConstructorThrew"] = 3113] = "CliCommandConstructorThrew";
240
- /** Vite threw while bundling the bot. */
241
- SeedcordErrorCode[SeedcordErrorCode["CliBundleFailed"] = 3114] = "CliBundleFailed";
242
- /** `build.outDir` is `root` or a folder that contains it. */
243
- SeedcordErrorCode[SeedcordErrorCode["CliConfigOutDirDeletesRoot"] = 3115] = "CliConfigOutDirDeletesRoot";
244
- /** The project is missing a dev dependency the CLI runs, like `typescript` or `@cloudflare/vite-plugin`. */
245
- SeedcordErrorCode[SeedcordErrorCode["CliDependencyMissing"] = 3116] = "CliDependencyMissing";
246
- /** `build.outDir` already has other files in it. */
247
- SeedcordErrorCode[SeedcordErrorCode["CliBuildOutDirNotEmpty"] = 3117] = "CliBuildOutDirNotEmpty";
248
- /** One CLI step found two or more problems. Each one is in the error's `errors`. */
249
- SeedcordErrorCode[SeedcordErrorCode["CliProblems"] = 3118] = "CliProblems";
250
- /** `seedcord codegen --check` found the committed augmentations out of date. */
251
- SeedcordErrorCode[SeedcordErrorCode["CliCodegenOutOfDate"] = 3119] = "CliCodegenOutOfDate";
252
- /** A file or folder in the project has a `#` in its path. */
253
- SeedcordErrorCode[SeedcordErrorCode["CliPathHasHash"] = 3120] = "CliPathHasHash";
254
- /** An edge bot's tsconfig is missing the `workerd` condition. */
255
- SeedcordErrorCode[SeedcordErrorCode["CliEdgeWithoutWorkerdCondition"] = 3121] = "CliEdgeWithoutWorkerdCondition";
256
- /** A bot with no `cloudflare.config.ts` sets the `workerd` condition in its tsconfig. */
257
- SeedcordErrorCode[SeedcordErrorCode["CliWorkerdConditionWithoutCloudflareConfig"] = 3122] = "CliWorkerdConditionWithoutCloudflareConfig";
258
- /** TypeScript could not read the project's tsconfig, or Cloudflare's config loader could not read `cloudflare.config.ts`. */
259
- SeedcordErrorCode[SeedcordErrorCode["CliConfigFileUnreadable"] = 3123] = "CliConfigFileUnreadable";
260
- /** The CLI could not start the TypeScript compiler. */
261
- SeedcordErrorCode[SeedcordErrorCode["CliTypescriptNotStarted"] = 3124] = "CliTypescriptNotStarted";
262
- /** A config file sets a field this bot can't set, like `entrypoint` in an edge bot's `cloudflare.config.ts`. */
263
- SeedcordErrorCode[SeedcordErrorCode["CliConfigFieldUnused"] = 3125] = "CliConfigFieldUnused";
264
- /** An edge bot's `compatibilityDate` is older than Cloudflare's Node compat default, and no flag turns it on. */
265
- SeedcordErrorCode[SeedcordErrorCode["CliEdgeCompatDateTooOld"] = 3126] = "CliEdgeCompatDateTooOld";
266
- /** An edge bot sets `no_nodejs_compat`. */
267
- SeedcordErrorCode[SeedcordErrorCode["CliEdgeNodeCompatOff"] = 3127] = "CliEdgeNodeCompatOff";
268
- /** The build could not start the edge worker in workerd. */
269
- SeedcordErrorCode[SeedcordErrorCode["CliEdgeBootFailed"] = 3128] = "CliEdgeBootFailed";
270
- /** An edge bot's `root` holds its seedcord config. */
271
- SeedcordErrorCode[SeedcordErrorCode["CliEdgeRootHoldsConfig"] = 3129] = "CliEdgeRootHoldsConfig";
272
- /** An edge build found commands in code that have no deployed id on Discord. */
273
- SeedcordErrorCode[SeedcordErrorCode["CliEdgeCommandsNotDeployed"] = 3130] = "CliEdgeCommandsNotDeployed";
274
- /** Something called the dev runtime before `start()` finished or after `stop()`. This is a bug in seedcord. */
275
- SeedcordErrorCode[SeedcordErrorCode["CliDevRuntimeNotRunning"] = 3131] = "CliDevRuntimeNotRunning";
276
- /** `seedcord commands deploy` ran on a bot whose `commands.path` is `null`. */
277
- SeedcordErrorCode[SeedcordErrorCode["CliDeployNoCommandsFolder"] = 3132] = "CliDeployNoCommandsFolder";
278
- /** `seedcord commands deploy` ran without `--yes` where it cannot ask first. */
279
- SeedcordErrorCode[SeedcordErrorCode["CliDeployNeedsYes"] = 3133] = "CliDeployNeedsYes";
280
- /** A class carrying `@RegisterCommand` builds a component that is not a command or a context menu. */
281
- SeedcordErrorCode[SeedcordErrorCode["CliCommandNotACommand"] = 3134] = "CliCommandNotACommand";
282
- /** `seedcord commands clean` or `purge` could not delete some of the commands it picked. */
283
- SeedcordErrorCode[SeedcordErrorCode["CliCommandsNotDeleted"] = 3135] = "CliCommandsNotDeleted";
284
- /** The CLI ran on Bun for an edge bot. */
285
- SeedcordErrorCode[SeedcordErrorCode["CliEdgeOnBun"] = 3136] = "CliEdgeOnBun";
286
- /** An edge bot's `cloudflare.config.ts` sets no `worker`. */
287
- SeedcordErrorCode[SeedcordErrorCode["CliEdgeNoWorker"] = 3137] = "CliEdgeNoWorker";
288
- /** The running `seedcord` is a different install from the project's own. */
289
- SeedcordErrorCode[SeedcordErrorCode["CliNotProjectInstall"] = 3138] = "CliNotProjectInstall";
290
- /** Vite's environments leave out the one seedcord runs the bot in. */
291
- SeedcordErrorCode[SeedcordErrorCode["CliViteEnvironmentMissing"] = 3139] = "CliViteEnvironmentMissing";
292
- /** A folder that `files` in `seedcord.config.ts` lists is missing or is a file. */
293
- SeedcordErrorCode[SeedcordErrorCode["CliListedFolderUnusable"] = 3140] = "CliListedFolderUnusable";
294
- /** Another `seedcord dev` already runs a bot on the same Discord application. */
295
- SeedcordErrorCode[SeedcordErrorCode["CliDevAlreadyRunning"] = 3141] = "CliDevAlreadyRunning";
296
- /** The folder that holds the dev session locks belongs to another user. */
297
- SeedcordErrorCode[SeedcordErrorCode["CliDevLockFolderNotOwned"] = 3142] = "CliDevLockFolderNotOwned";
298
- /** A plugin's `codegen()` threw. */
299
- SeedcordErrorCode[SeedcordErrorCode["CliPluginCodegenThrew"] = 3143] = "CliPluginCodegenThrew";
300
- /** A plugin class with a `codegen()` is missing its `static readonly id`. */
301
- SeedcordErrorCode[SeedcordErrorCode["CliPluginCodegenNoId"] = 3144] = "CliPluginCodegenNoId";
302
- /** A plugin's `codegen()` returned a value that codegen can't write as a type. */
303
- SeedcordErrorCode[SeedcordErrorCode["CliPluginCodegenValue"] = 3145] = "CliPluginCodegenValue";
304
- /** Two attachments of one plugin class returned different values at one key from `codegen()`. */
305
- SeedcordErrorCode[SeedcordErrorCode["CliPluginCodegenConflict"] = 3146] = "CliPluginCodegenConflict";
306
- /** A flag answers a question that the earlier answers skip. */
307
- SeedcordErrorCode[SeedcordErrorCode["CreateFlagNotApplicable"] = 3201] = "CreateFlagNotApplicable";
308
- /** A flag has a value its question rejects. */
309
- SeedcordErrorCode[SeedcordErrorCode["CreateInvalidAnswer"] = 3202] = "CreateInvalidAnswer";
310
- /** The command line did not parse. */
311
- SeedcordErrorCode[SeedcordErrorCode["CreateBadUsage"] = 3203] = "CreateBadUsage";
312
- /** The target path already has files in it. */
313
- SeedcordErrorCode[SeedcordErrorCode["CreateTargetNotEmpty"] = 3204] = "CreateTargetNotEmpty";
314
- /** A command that create-seedcord ran exited non-zero. */
315
- SeedcordErrorCode[SeedcordErrorCode["CreateStepFailed"] = 3205] = "CreateStepFailed";
316
- /** The name given to `seedcord make` can't become a file name. */
317
- SeedcordErrorCode[SeedcordErrorCode["MakeInvalidName"] = 3301] = "MakeInvalidName";
318
- /** A template calls `importOf` on a folder that doesn't hold exactly one template file. */
319
- SeedcordErrorCode[SeedcordErrorCode["MakeImportOfUnmatched"] = 3302] = "MakeImportOfUnmatched";
320
- /** A template uses one value as two of text, a list, and an entry with fields. */
321
- SeedcordErrorCode[SeedcordErrorCode["MakeValueUsedTwoWays"] = 3303] = "MakeValueUsedTwoWays";
322
- /** Handlebars could not parse or render a template file. */
323
- SeedcordErrorCode[SeedcordErrorCode["MakeTemplateFailed"] = 3304] = "MakeTemplateFailed";
324
- /** A template calls `lookup` with a key that isn't quoted text. */
325
- SeedcordErrorCode[SeedcordErrorCode["MakeLookupDynamicKey"] = 3305] = "MakeLookupDynamicKey";
326
- /** `seedcord make` ran without a terminal to ask its questions in. */
327
- SeedcordErrorCode[SeedcordErrorCode["MakeNeedsTerminal"] = 3306] = "MakeNeedsTerminal";
328
- /** `seedcord make` found no templates in the bot or its plugins. */
329
- SeedcordErrorCode[SeedcordErrorCode["MakeNoTemplates"] = 3307] = "MakeNoTemplates";
330
- /** A path `seedcord make` would write to is taken, by a file on disk or by another file of the same template. */
331
- SeedcordErrorCode[SeedcordErrorCode["MakePathTaken"] = 3308] = "MakePathTaken";
332
- /** A template's partial calls itself, so `seedcord make` can't tell how many levels to ask for. */
333
- SeedcordErrorCode[SeedcordErrorCode["MakePartialCallsItself"] = 3309] = "MakePartialCallsItself";
334
- return SeedcordErrorCode;
335
- }({});
336
-
337
- //#endregion
338
4
  //#region ../../tooling/brand/dist/index.mjs
339
5
  const BRAND_COLORS = {
340
6
  pith: "#f8f6e8",
@@ -355,6 +21,9 @@ var SiteAddress = class {
355
21
  get path() {
356
22
  return new URL(this.url).pathname.replace(/\/$/, "");
357
23
  }
24
+ get exportDir() {
25
+ return `dist${this.path}`;
26
+ }
358
27
  at(path) {
359
28
  if (path === "") return this.url;
360
29
  return `${this.url}/${path.replace(/^\/+/, "")}`;
@@ -366,6 +35,7 @@ const PRODUCTION_SITES = {
366
35
  guide: new SiteAddress(`${PRODUCTION_ORIGIN}/guide`),
367
36
  docs: new SiteAddress(`${PRODUCTION_ORIGIN}/docs`)
368
37
  };
38
+ const NEXT_GUIDE = new SiteAddress(`https://next.seedcord.org${PRODUCTION_SITES.guide.path}`);
369
39
 
370
40
  //#endregion
371
41
  //#region src/displayPath.ts
@@ -496,15 +166,17 @@ const messages = {
496
166
  [1229]: (plugin, place, configFile, reason) => place.hook === void 0 ? `${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.")}` : `The Vite plugin ${paint.sky(plugin)} from ${paint.bold("vitePlugins")} in ${paint.path(configFile)} threw ${placeText(place.hook, place.loading)}. ${reasonThen(reason, vitePluginFix(place))}`,
497
167
  [1207]: (path, reason) => `Could not read ${paint.path(path)}. ${reasonThen(reason, "Check that it exists and that this process can read it.")}`,
498
168
  [1219]: (path, root) => `${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.`,
499
- [1223]: (dir) => `${paint.path(dir)} is relative to ${paint.bold("root")}, but nothing set ${paint.bold("root")} in this process. The ${paint.bold("seedcord")} CLI sets it, but a plain script or a test doesn't. Pass an absolute path there, like ${paint.sky(`resolve(import.meta.dirname, '${dir}')`)}.`,
500
- [1225]: (dir, root) => `${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.`,
501
- [1230]: (dir) => `${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']")}.`,
502
- [1231]: (dir) => `${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.`,
169
+ [1223]: (dir) => `${paint.path(dir)} is relative to ${paint.bold("root")}, but nothing set ${paint.bold("root")} in this process. The ${paint.bold("seedcord")} CLI sets it, but a plain script or a test doesn't. Pass an absolute path instead, like ${paint.sky(`resolve(import.meta.dirname, '${dir}')`)}. If you ran a file from your build folder, run ${paint.path("index.mjs")} from that folder instead.`,
170
+ [1225]: (dir, root) => `When ${paint.bold("seedcord build")} ran, ${paint.path(dir)} was neither a folder under ${paint.bold("root")} (${paint.path(root)}) nor one listed in ${paint.bold("files")}, so the build holds none of its files. Create the folder, then build again.`,
171
+ [1230]: (dir) => `${paint.bold("readFiles")} was called on ${paint.path(dir)}, which is outside every folder that ${paint.bold("files")} lists 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']")}.`,
172
+ [1231]: (dir) => `${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.`,
503
173
  [1232]: () => `${paint.bold("collection.entries()")} reads the key list of the Keyv store in ${paint.bold("config.kv")}, but that store can't list its keys. Cache adapters like ${paint.bold("@keyv/memcache")} never can. Pass an adapter that can, like ${paint.bold("@keyv/redis")} or ${paint.bold("@keyv/sqlite")}.`,
504
174
  [1234]: (operation, key) => `The driver in ${paint.bold("config.kv")} failed to ${operation} ${paint.sky(key)}. Check that the storage it connects to is reachable.`,
175
+ [1235]: (guildId) => `The member cache of guild ${paint.sky(guildId)} doesn't hold the bot's member, so seedcord can't read the bot's permissions there. If ${paint.bold("clientOptions.makeCache")} limits ${paint.bold("GuildMemberManager")}, keep the bot's member with ${paint.sky("keepOverLimit: (member) => member.id === member.client.user.id")}.`,
176
+ [1236]: () => `A module from your build read its path from ${paint.bold("import.meta")}, but nothing set that path because ${paint.path("index.mjs")} didn't run first. Run ${paint.path("index.mjs")} instead of the module, like ${paint.bold("node dist/index.mjs")}.`,
505
177
  [1233]: (plugin) => `${paint.bold(plugin)} read ${paint.bold("this.kv")} on an instance that ${paint.bold("attach()")} didn't build. ${paint.bold("this.kv")} stores a plugin's records under its attach key, which only ${paint.bold("attach()")} gives it. Attach the class with ${paint.bold(`seedcord.attach('key', ${plugin})`)}.`,
506
178
  [1215]: (head, key) => `${paint.bold(head)} is already taken on this bot, so ${paint.sky(key)} cannot nest under it. Pick another group name.`,
507
- [1217]: (key, reason) => `${paint.sky(key)} ${reason} Write a group and a plugin name around one dot, like 'services.users'.`,
179
+ [1217]: (key, reason) => `${paint.sky(key)} ${reason} Write a group and a plugin name with one dot between them, like 'services.users'.`,
508
180
  [1218]: (plugin) => `${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.`,
509
181
  [1220]: (plugin, axis, declared, host) => `${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}.`,
510
182
  [1216]: (key) => `${paint.sky(key)} already holds a group of plugins. Attach this one under a name of its own.`,
@@ -513,12 +185,12 @@ const messages = {
513
185
  [1222]: () => `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.`,
514
186
  [1221]: () => `${paint.bold("fetch()")} ran before ${paint.bold("start()")}. Call ${paint.bold("await seedcord.start()")} before your server passes requests to ${paint.bold("fetch()")}.`,
515
187
  [1210]: (accessor, key) => `${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.`,
516
- [1211]: () => `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().`,
188
+ [1211]: () => `core.shutdown.addTask() does not work on an edge bot. Cloudflare doesn't run a shutdown hook when it stops an isolate, so a shutdown task would never run. To use shutdown tasks, run the bot on node with new Seedcord(config).start().`,
517
189
  [1212]: (event) => `core.bus.emit('${event}') would reach your on() listeners but skip every Subscriber class. Call core.bus.publish('${event}', data) to run both.`,
518
- [1213]: (commandName) => `${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', [...]).`,
190
+ [1213]: (commandName) => `${paint.sky(commandName)} registers to the 'config' guilds, but commands.guilds is empty.\nList the ids under commands.guilds, or pass them to @RegisterCommand('guild', [...]).`,
519
191
  [1214]: (guildId, reason, status) => `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."))}`,
520
- [1224]: (reason, status) => `Discord refused the global command deploy. ${reasonThen(reason, deployFix(status, "Try again, and check discordstatus.com if it keeps failing."))}`,
521
- [1226]: (className) => `${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>")}.`,
192
+ [1224]: (reason, status) => `Discord refused the global command deploy. ${reasonThen(reason, deployFix(status, "Try again. If it keeps failing, check discordstatus.com."))}`,
193
+ [1226]: (className) => `${paint.sky(className)} was given a URL that is not a Discord webhook URL. Pass the webhook URL from the channel's Integrations settings. It looks like ${paint.bold("https://discord.com/api/webhooks/<id>/<token>")}.`,
522
194
  [1227]: (what, reason, fix) => `Could not read ${what} from Discord (${reason}). ${fix ?? `Check that ${token()} is still valid.`}`,
523
195
  [1228]: (kind, name, sources = [], note) => `${sources.length > 0 ? `${allOf.format(sources)} define the ${kind} ${quoted(name)}.` : `The ${kind} ${quoted(name)} is defined twice.`}${note ? ` ${note}` : ""} Rename one.`,
524
196
  [1301]: (commandName, existingCall, requestedCall) => `${paint.sky(commandName)} is registered twice, first with ${existingCall}, then with ${requestedCall}. Keep one.`,
@@ -527,10 +199,11 @@ const messages = {
527
199
  [1304]: (className, priority) => `${paint.sky(className)} sets its middleware priority to ${priority}. Pass a finite number.`,
528
200
  [1305]: (className) => `${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.`,
529
201
  [1306]: (className, key) => `${paint.sky(className)} passes an empty array as ${paint.bold(key)}. Remove the key to run the middleware on everything.`,
202
+ [1307]: (decorator, className, key, fix) => `${paint.bold(decorator)} on ${paint.sky(className)} lists ${quoted(key)} twice. ${fix}`,
530
203
  [1501]: (method, reason, alternative, routeId) => `${paint.sky(`${method}()`)} was called when ${reason}.\n${alternative} (route ${paint.mute(routeId)})`,
531
204
  [1502]: (componentClass, index, detail, routeId) => `${paint.sky(componentClass)} at components[${index}] failed to serialize: ${detail.replace(/\.$/, "")}. (route ${paint.mute(routeId)})`,
532
- [1503]: (method, targetId, routeId) => `${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)})`,
533
- [1504]: (method, routeId) => `${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)})`,
205
+ [1503]: (method, targetId, routeId) => `${paint.sky(`${method}()`)} was passed message ${targetId}, which this interaction did not send.\nPass a message that reply(), followUp(), edit(), or update() returned for this interaction. (route ${paint.mute(routeId)})`,
206
+ [1504]: (method, routeId) => `${paint.sky(`${method}()`)} was called on a modal that a command opened. That modal doesn't have a source message.\nUse reply() or defer(). (route ${paint.mute(routeId)})`,
534
207
  [1505]: (method, routeId) => `Discord's interaction callback for ${paint.sky(`${method}()`)} returned no message. (route ${paint.mute(routeId)})`,
535
208
  [1601]: (prefix) => `The customId prefix ${quoted(prefix)} is empty or holds a colon or a control character. Pick a prefix without them.`,
536
209
  [1602]: (field) => `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.`,
@@ -539,19 +212,18 @@ const messages = {
539
212
  [1605]: (field, expected, value) => `The customId field ${quoted(field)} expects ${expected}, but encode() got ${value}.`,
540
213
  [1606]: (prefix, length) => `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.`,
541
214
  [1607]: (className) => `${paint.sky(className)} is missing its route decorator. Add the one that matches its base, for example ${paint.bold("@ButtonRoute")} or ${paint.bold("@UserMenuRoute")}.`,
542
- [1608]: (handler, kind, value) => `${paint.bold(handler)}'s match() has no arm for the ${kind} ${quoted(value)}. Add one to the object you pass to match().`,
543
- [1609]: (handler, read) => `${paint.sky(handler)} read ${paint.bold(read)}, but it was constructed without an event name. The event controller passes that name. A handler or middleware you construct yourself takes it as the fourth constructor argument.`,
215
+ [1608]: (handler, kind, value) => `${paint.bold(handler)}'s match() doesn't have a case for the ${kind} ${quoted(value)}. Add one to the object you pass to match().`,
544
216
  [1610]: () => "Discord sent an autocomplete payload with no focused option.",
545
217
  [1611]: (customId) => `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.`,
546
218
  [1612]: (customId, kind, getter) => getter ? `The modal field ${quoted(customId)} holds ${kind}. Read it with ${paint.bold(`${getter}()`)}.` : `The modal field ${quoted(customId)} holds ${kind}, but none of the getters read that kind.`,
547
219
  [1613]: (customId) => `The modal field ${quoted(customId)} has nothing picked. Build the component as required, or read it without the required argument.`,
548
220
  [1614]: (customId, picked, allowed) => `The modal field ${quoted(customId)} picked a ${picked} channel, but this read allows ${oneOf.format(allowed)}. Give the channel select the same channel types.`,
549
- [1615]: (prefix) => `The customId ${quoted(prefix)} was encoded under an older shape of this definition. Adding, removing, changing, or moving a field changes the layout hash.`,
221
+ [1615]: (prefix) => `The customId ${quoted(prefix)} was encoded under an older shape of this definition, because adding, removing, changing, or moving a field changes its layout hash.`,
550
222
  [1616]: (detail) => `The customId could not be decoded. ${sentence(detail)}`,
551
223
  [1617]: (key) => `Nothing set ${paint.sky(key)} on this dispatch. Check that the middleware writing it is registered and that its filter covers this dispatch.`,
552
224
  [1701]: (input) => `The cooldown duration ${quoted(input)} is not valid. Pass a positive number of seconds, or a duration string like '30m', '24h', or '500ms'.`,
553
225
  [1801]: (perPage) => `perPage is ${perPage}. Pass a positive integer.`,
554
- [1802]: (count, max) => `This control row has ${counted(count, "button", "buttons")}. Pass 1 to ${max}, the most Discord allows in one row.`,
226
+ [1802]: (count, max) => `This control row has ${counted(count, "button", "buttons")}. Use between 1 and ${max} buttons, the most Discord allows in one row.`,
555
227
  [1803]: (key) => `This control row repeats the ${paint.sky(key)} control. Each control can appear once in a row.`,
556
228
  [1901]: (value) => `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.`,
557
229
  [1902]: (value) => `${value} is outside Discord's color range, 0 to 16777215 (0xffffff).`,
@@ -564,20 +236,20 @@ const messages = {
564
236
  [2004]: (pluginName) => `${paint.sky(`${pluginName}.services`)} was read before the plugin finished ${paint.bold("init()")}. Read it inside a handler, or after start() resolves.`,
565
237
  [2005]: (service, target) => `Could not connect to ${paint.bold(service)}${target ? ` (${paint.sky(target)})` : ""}. Check that it is running and that the connection string is right.`,
566
238
  [2006]: (service) => `Could not close the ${paint.bold(service)} connection cleanly during shutdown.`,
567
- [2101]: (modelName, className) => `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.`,
239
+ [2101]: (modelName, className) => `Could not build the mongoose model ${paint.sky(modelName)} for ${paint.bold(className)}. Check that another model doesn't already use that name and that the class has a schema.`,
568
240
  [2102]: (className) => `${paint.sky(className)} passes an empty model name to ${paint.bold("@RegisterMongooseService()")}. Pass a non-empty modelName.`,
569
241
  [2201]: (className) => `${paint.sky(className)} has no table. Pass one to ${paint.bold("@RegisterKyselyService()")}.`,
570
242
  [2202]: (steps) => `The migration step count is ${steps}. Pass zero or a positive integer.`,
571
243
  [2203]: (direction) => `${paint.sky(String(direction))} is not a migration direction. Pass 'up' or 'down'.`,
572
- [2204]: (filePath) => `${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.`,
244
+ [2204]: (filePath) => `${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. If the file is a helper, move it out of the folder.`,
573
245
  [2205]: (message) => `A migration failed with a value that is not an Error: ${message}.`,
574
246
  [2206]: (databaseName) => `Could not create the database ${paint.sky(databaseName)}. Check that the database user may create databases, or create it yourself.`,
575
247
  [3001]: () => "Cancelled.",
576
- [3101]: () => `The seedcord config file must default export an object, like ${paint.bold("export default defineConfig({ ... })")}.`,
248
+ [3101]: () => `The seedcord config file must export an object as its default, like ${paint.bold("export default defineConfig({ ... })")}.`,
577
249
  [3102]: (baseDir, candidates) => `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.`,
578
250
  [3112]: (field, expected) => `${paint.bold(field)} in the seedcord config must be ${expected}.`,
579
251
  [3103]: (path, field) => `Cannot find ${paint.path(path)}. Point ${paint.bold(field)} in the seedcord config at a file that exists.`,
580
- [3104]: (instancePath) => `${paint.path(instancePath)} must default export the bot, a ${paint.bold("new Seedcord(...)")}, from ${paint.bold("@seedcord/gateway")} or ${paint.bold("@seedcord/http")}.`,
252
+ [3104]: (instancePath) => `${paint.path(instancePath)} must export the bot as its default: a ${paint.bold("new Seedcord(...)")} from ${paint.bold("@seedcord/gateway")} or ${paint.bold("@seedcord/http")}.`,
581
253
  [3105]: (instancePath, reason) => `Failed to start the bot from ${paint.path(instancePath)}: ${reason}`,
582
254
  [3106]: (configDir, configured) => configured ? `${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)}.` : `${paint.path(configDir)} does not contain a ${paint.sky("tsconfig.json")}. Add one there, or set ${paint.bold("build.tsconfig")} in the seedcord config.`,
583
255
  [3116]: (packages, projectDir, why) => `Add ${allOf.format(packages.map((name) => paint.bold(name)))} to ${paint.path(projectDir)} as ${isOne(packages.length) ? "a dev dependency" : "dev dependencies"}. ${why}`,
@@ -595,16 +267,19 @@ const messages = {
595
267
  [3134]: (name, file) => `${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'>")}.`,
596
268
  [3135]: () => "Some commands could not be deleted. The warnings above give the reason for each one.",
597
269
  [3136]: () => `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")}.`,
598
- [3137]: (cloudflareConfig) => `${paint.path(cloudflareConfig)} sets no ${paint.bold("worker")}. Add a ${paint.bold("worker")} with your worker's ${paint.bold("name")} and ${paint.bold("compatibilityDate")}.`,
270
+ [3137]: (cloudflareConfig) => `${paint.path(cloudflareConfig)} doesn't set ${paint.bold("worker")}. Set ${paint.bold("worker")} to your worker's ${paint.bold("name")} and ${paint.bold("compatibilityDate")}.`,
599
271
  [3138]: (cliDir, projectInstall) => `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")}.`,
600
- [3139]: (name, created) => `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")}.`,
272
+ [3139]: (name, created) => `seedcord runs the bot in Vite's ${paint.bold(name)} environment, but 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")}.`,
601
273
  [3140]: (folder, problem) => `${paint.bold("files")} in seedcord.config.ts lists ${paint.path(folder)}, ${listedFolderProblems[problem]}`,
602
- [3141]: (configDir, pid, startedAt, lockFile) => `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.`,
274
+ [3141]: (configDir, pid, startedAt, lockFile) => `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 that session is no longer running.`,
603
275
  [3142]: (folder) => `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.`,
604
- [3143]: (plugin, key, reason) => `The ${paint.bold("codegen()")} of the plugin attached at ${paint.sky(key)} (${paint.sky(plugin)}) threw. ${sentence(reason)} ${paint.bold("seedcord codegen")} calls ${paint.bold("codegen()")} without running ${paint.bold("init()")} first, so read only constructor state and files in it.`,
276
+ [3143]: (plugin, key, reason) => `The ${paint.bold("codegen()")} of the plugin attached at ${paint.sky(key)} (${paint.sky(plugin)}) threw. ${sentence(reason)} ${paint.bold("seedcord codegen")} calls ${paint.bold("codegen()")} without running ${paint.bold("init()")} first, so read only constructor state and files in ${paint.bold("codegen()")}.`,
605
277
  [3144]: (plugin, key) => `The plugin attached at ${paint.sky(key)} (${paint.sky(plugin)}) needs an id because it has a ${paint.bold("codegen()")}. Add ${paint.bold("static readonly id = '<your package name>'")} to the class.`,
606
278
  [3145]: (id, key, path, value) => `The ${paint.bold("codegen()")} of the plugin attached at ${paint.sky(key)} (${paint.sky(id)}) returned ${value} at ${paint.bold(path)}. Codegen can't write that value as a type. It writes plain data, and classes or objects that a project file or the plugin's package exports. Export the value from a file, or return plain data.`,
607
- [3146]: (id, first, second, path) => `The plugins attached at ${paint.sky(first)} and ${paint.sky(second)} are both ${paint.bold(id)}, and their ${paint.bold("codegen()")} results differ at ${paint.bold(path)}. Every attachment of one plugin shares one type, so both have to return the same value there. Change that value in the files one of them reads, or attach the plugin once.`,
279
+ [3146]: (id, first, second, path) => `The plugins attached at ${paint.sky(first)} and ${paint.sky(second)} are both ${paint.bold(id)}, but their ${paint.bold("codegen()")} results differ at ${paint.bold(path)}. Every attachment of one plugin shares one type, so both have to return the same value there. Change that value in the files one of them reads, or attach the plugin once.`,
280
+ [3147]: (minLength) => `${paint.bold("seedcord ask")} takes a question of at least ${minLength} characters, with a letter or a number in them. Run something like ${paint.bold("seedcord ask \"how do i refuse a command\"")}.`,
281
+ [3148]: (wait, guide) => `${wait} You can read the guide at ${paint.sky(guide)} in the meantime.`,
282
+ [3149]: (reason, guide) => `The guide search failed. ${reason}. Try again, or read the guide at ${paint.sky(guide)}.`,
608
283
  [3119]: (outputPath) => `${paint.path(outputPath)} is out of date. Run ${paint.bold("seedcord codegen")} and commit it.`,
609
284
  [3121]: (cloudflareConfig, tsconfig) => `${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.`,
610
285
  [3122]: (tsconfig, configDir) => `${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.`,
@@ -615,9 +290,9 @@ const messages = {
615
290
  [3128]: (reason) => `The build could not start the worker in workerd, the runtime Cloudflare runs it on.\n${reason}`,
616
291
  [3129]: (configFile, root) => `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'")}.`,
617
292
  [3124]: (tsc, reason) => `Could not start TypeScript at ${paint.path(tsc)}: ${reason}`,
618
- [3120]: (path) => `${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.`,
293
+ [3120]: (path) => `${paint.path(path)} has a ${paint.bold("#")} in its path. Vite cuts a path at its first ${paint.bold("#")}. Rename that folder or file, or move the project to a folder without one.`,
619
294
  [3109]: (seconds) => `cloudflared did not report a tunnel URL within ${seconds}s. Check that the binary runs and that the network allows it.`,
620
- [3110]: (url) => `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.`,
295
+ [3110]: (url) => `Discord rejected ${paint.sky(url)} as an interactions endpoint. Discord tests the endpoint with a request it signs with your application's key, so check that ${paint.bold("DISCORD_PUBLIC_KEY")} matches your application.`,
621
296
  [3111]: (url, seconds) => `${paint.sky(url)} did not answer within ${seconds}s, so nothing was PATCHed to Discord.`,
622
297
  [3201]: (flag) => `The --${flag} flag does not apply to the answers you gave.`,
623
298
  [3202]: (flag, reason) => `--${flag}: ${reason}`,
@@ -632,14 +307,14 @@ const messages = {
632
307
  list: `loops over it with ${paint.bold("#each")}`,
633
308
  object: `reads a field from it, like ${paint.bold(`${value}.name`)}`
634
309
  };
635
- return `The ${paint.bold(template)} template uses ${paint.bold(value)} two ways. It ${uses[first]}, and it also ${uses[second]}. Give one of the two uses its own name.`;
310
+ return `The ${paint.bold(template)} template uses ${paint.bold(value)} two ways. In one place it ${uses[first]}, and in another it ${uses[second]}. Give one of the two uses its own name.`;
636
311
  },
637
312
  [3304]: (file, from, reason) => `Handlebars could not render ${paint.path(file)} from ${paint.bold(from)}.\n${reason}\nFix that template file.`,
638
313
  [3305]: (template, value) => `The ${paint.bold(template)} template calls ${paint.bold("lookup")} on ${paint.bold(value)} without a quoted key. seedcord make can't tell which field of ${paint.bold(value)} to ask for. Give lookup a quoted key like ${paint.bold(`{{lookup ${value} "title"}}`)}, or map the value in a helper under ${paint.bold("make.helpers")} in seedcord.config.ts.`,
639
314
  [3306]: () => `${paint.bold("seedcord make")} asks for a template, a name and each value in a terminal. Run it from a terminal with ${paint.bold("CI")} unset.`,
640
315
  [3307]: (folder) => `Found no templates in ${paint.path(folder)} or in the installed plugins. Each folder inside ${paint.path(folder)} is one template. ${paint.sky(PRODUCTION_SITES.guide.at("tooling/make"))} shows how to write one and where to copy the starters from.`,
641
316
  [3308]: (path, takenByTemplate) => takenByTemplate === void 0 ? `${paint.path(path)} already exists. Pick another name, or delete that file first.` : `Two files of the ${paint.bold(takenByTemplate)} template would both be written to ${paint.path(path)}. Pick a name that keeps them apart, or give the files different names in the template.`,
642
- [3309]: (template, partial) => `The ${paint.bold(partial)} partial in the ${paint.bold(template)} template calls itself. seedcord make asks for every value before it writes a file, and it can't tell how many levels a partial that calls itself goes down. Write out each level the template needs.`
317
+ [3309]: (template, partial) => `The ${paint.bold(partial)} partial in the ${paint.bold(template)} template calls itself. seedcord make asks for every value before it writes a file, so it can't tell how many times the partial calls itself. Write out each level the template needs.`
643
318
  };
644
319
  /** @internal */
645
320
  function formatSeedcordErrorMessage(code, args) {
@@ -758,5 +433,5 @@ function isSeedcordError(error, type, code) {
758
433
  }
759
434
 
760
435
  //#endregion
761
- export { isSeedcordError as a, setColorLevel as c, SeedcordTypeError as i, displayPath as l, SeedcordError as n, WORDMARK as o, SeedcordRangeError as r, paint as s, SeedcordAggregateError as t, SeedcordErrorCode as u };
762
- //# sourceMappingURL=SeedcordError-BvEoyypY.mjs.map
436
+ export { isSeedcordError as a, setColorLevel as c, SeedcordTypeError as i, displayPath as l, SeedcordError as n, WORDMARK as o, SeedcordRangeError as r, paint as s, SeedcordAggregateError as t };
437
+ //# sourceMappingURL=SeedcordError-DMuI3AbC.mjs.map