meocord 4.2.2 → 4.2.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.
- package/CHANGELOG.md +130 -0
- package/dist/cjs/_shared/{controller.decorator-U2NBWcoU.cjs → controller.decorator-hp5xdJU4.cjs} +512 -183
- package/dist/cjs/_shared/{startup-roots-lA5xkBFq.cjs → event-sources-DzqTODXg.cjs} +265 -80
- package/dist/cjs/_shared/{providers-B4MOFBrW.cjs → providers-BBvbnmLP.cjs} +780 -281
- package/dist/cjs/_shared/{sharded-cooldown-store-HTUb3Ii_.cjs → sharded-cooldown-store-B62g5O88.cjs} +11 -9
- package/dist/cjs/_shared/{translate-error-CbBHUu5P.cjs → translate-error-wsgfsUET.cjs} +1 -1
- package/dist/cjs/common/index.cjs +4 -104
- package/dist/cjs/core/index.cjs +432 -181
- package/dist/cjs/decorator/index.cjs +85 -120
- package/dist/cjs/testing/index.cjs +1664 -784
- package/dist/cli.json +1 -1
- package/dist/esm/bin/app-template/package.json.template +9 -9
- package/dist/esm/bin/app-template/src/main.ts.template +3 -2
- package/dist/esm/bin/generator.js +6 -4
- package/dist/esm/bin/helper/filter-generator.helper.js +6 -4
- package/dist/esm/bin/helper/guard-generator.helper.js +6 -4
- package/dist/esm/bin/helper/interceptor-generator.helper.js +6 -4
- package/dist/esm/bin/helper/observer-generator.helper.js +6 -4
- package/dist/esm/bin/helper/pipe-generator.helper.js +6 -4
- package/dist/esm/bin/helper/service-generator.helper.js +6 -4
- package/dist/esm/bin/meocord.js +106 -48
- package/dist/esm/build/native-addons.js +75 -19
- package/dist/esm/build/rsbuild-config.js +11 -3
- package/dist/esm/build/typed-externals.js +15 -2
- package/dist/esm/common/cooldown-store.js +38 -14
- package/dist/esm/common/deprecation.js +4 -1
- package/dist/esm/common/execution-context.js +3 -1
- package/dist/esm/common/explained-error.js +7 -3
- package/dist/esm/common/log-level.js +13 -9
- package/dist/esm/common/logger.js +4 -2
- package/dist/esm/common/meocord-text.js +11 -6
- package/dist/esm/common/redis-cooldown-store.js +3 -7
- package/dist/esm/common/response/flags.js +17 -1
- package/dist/esm/common/response/install-context.js +27 -16
- package/dist/esm/common/response/presenter.js +7 -3
- package/dist/esm/common/response/response-state.js +27 -5
- package/dist/esm/common/sharded-cooldown-store.js +11 -9
- package/dist/esm/common/theme.js +3 -1
- package/dist/esm/common/translator.js +17 -8
- package/dist/esm/core/autocomplete-routes.js +26 -0
- package/dist/esm/core/command-conflicts.js +15 -7
- package/dist/esm/core/command-registration.js +15 -1
- package/dist/esm/core/cooldown-runner.js +7 -9
- package/dist/esm/core/defer.js +2 -5
- package/dist/esm/core/dispatcher.js +83 -58
- package/dist/esm/core/event-requirements.js +67 -19
- package/dist/esm/core/event-sources.js +100 -0
- package/dist/esm/core/fallback.js +3 -1
- package/dist/esm/core/filter-runner.js +4 -4
- package/dist/esm/core/guard-runner.js +173 -52
- package/dist/esm/core/handler-input.js +24 -3
- package/dist/esm/core/handler-pipeline.js +44 -28
- package/dist/esm/core/handler-registry.js +51 -21
- package/dist/esm/core/input-runner.js +7 -8
- package/dist/esm/core/interceptor-runner.js +4 -5
- package/dist/esm/core/lifecycle-hooks.js +3 -8
- package/dist/esm/core/lifecycle-order.js +1 -15
- package/dist/esm/core/meocord-classes.js +14 -1
- package/dist/esm/core/meocord-factory.js +80 -53
- package/dist/esm/core/meocord.app.js +174 -89
- package/dist/esm/core/message-help.js +5 -9
- package/dist/esm/core/message-params.js +126 -46
- package/dist/esm/core/message-routes.js +225 -45
- package/dist/esm/core/message-words.js +30 -2
- package/dist/esm/core/observer-runner.js +2 -1
- package/dist/esm/core/process-state.js +19 -0
- package/dist/esm/core/providers.js +28 -3
- package/dist/esm/core/scalar-types.js +57 -16
- package/dist/esm/core/shard-context.js +11 -10
- package/dist/esm/core/shard-exit.js +3 -3
- package/dist/esm/core/shard-manager.js +16 -6
- package/dist/esm/core/startup-roots.js +28 -8
- package/dist/esm/core/theme-resolvers.js +26 -11
- package/dist/esm/core/theme-runtime.js +23 -13
- package/dist/esm/core/theme-scope.js +27 -29
- package/dist/esm/core/theme-validation.js +1 -1
- package/dist/esm/decorator/app.decorator.js +6 -1
- package/dist/esm/decorator/command-builder.decorator.js +14 -0
- package/dist/esm/decorator/controller-class.decorator.js +1 -1
- package/dist/esm/decorator/controller.decorator.js +48 -19
- package/dist/esm/decorator/defer.decorator.js +2 -2
- package/dist/esm/decorator/event.decorator.js +4 -5
- package/dist/esm/decorator/filter.decorator.js +2 -2
- package/dist/esm/decorator/guard.decorator.js +4 -61
- package/dist/esm/decorator/inject.decorator.js +4 -1
- package/dist/esm/decorator/interceptor.decorator.js +2 -2
- package/dist/esm/decorator/theme.decorator.js +4 -3
- package/dist/esm/decorator/validation.decorator.js +5 -5
- package/dist/esm/package.json.js +1 -1
- package/dist/esm/testing/catalog.js +29 -13
- package/dist/esm/testing/cooldown-store-suite.js +3 -3
- package/dist/esm/testing/discord-defaults.js +449 -355
- package/dist/esm/testing/inspect-handler.js +91 -10
- package/dist/esm/testing/meocord-testing-module.js +195 -77
- package/dist/esm/testing/mock-fn.js +8 -2
- package/dist/esm/testing/mock-interaction.js +639 -113
- package/dist/esm/testing/response-log.js +8 -0
- package/dist/esm/testing/response.js +7 -5
- package/dist/esm/testing/routing.js +48 -6
- package/dist/esm/testing/strict-mocks.js +1 -0
- package/dist/esm/testing/theme.js +3 -2
- package/dist/esm/util/common.util.js +30 -9
- package/dist/esm/util/generator-cli.util.js +6 -4
- package/dist/esm/util/inherited-env.util.js +72 -13
- package/dist/esm/util/json.util.js +10 -3
- package/dist/esm/util/meocord-cli.util.js +3 -2
- package/dist/esm/util/meocord-config-loader.util.js +14 -1
- package/dist/esm/util/meocord-config-validation.util.js +13 -3
- package/dist/esm/util/meocord-source-config.util.js +13 -3
- package/dist/esm/util/platform.util.js +3 -2
- package/dist/esm/util/refusal.util.js +29 -11
- package/dist/esm/util/registration-mode.util.js +14 -1
- package/dist/esm/util/timer-limit.util.js +4 -1
- package/dist/esm/util/tsconfig-paths.util.js +38 -7
- package/dist/esm/util/tsconfig.util.js +16 -58
- package/dist/esm/util/user-text.util.js +8 -4
- package/dist/esm/util/value.util.js +15 -4
- package/dist/types/common/index.d.cts +13 -9
- package/dist/types/common/index.d.ts +13 -9
- package/dist/types/core/index.d.cts +21 -11
- package/dist/types/core/index.d.ts +21 -11
- package/dist/types/decorator/index.d.cts +63 -63
- package/dist/types/decorator/index.d.ts +63 -63
- package/dist/types/{index-DKJclIi-.d.ts → index-Brkd6QGL.d.ts} +81 -35
- package/dist/types/{index-Dlf0ZZtS.d.cts → index-CqXImwF_.d.cts} +81 -35
- package/dist/types/interface/index.d.cts +1 -1
- package/dist/types/interface/index.d.ts +1 -1
- package/dist/types/{route-Bh1U13yy.d.ts → route-IQrK-MN2.d.cts} +11 -3
- package/dist/types/{route-Bh1U13yy.d.cts → route-bI-okq7g.d.ts} +11 -3
- package/dist/types/testing/index.d.cts +137 -54
- package/dist/types/testing/index.d.ts +137 -54
- package/dist/types/{theme-resolvers-CyEz9pnv.d.cts → theme-resolvers-AtgeaYqF.d.cts} +1 -1
- package/dist/types/{theme-resolvers-DA204O-q.d.ts → theme-resolvers-BgqysV8d.d.ts} +1 -1
- package/dist/types/{translator-Bg7hwxDF.d.cts → translator-D8aydlCE.d.ts} +12 -11
- package/dist/types/{translator-CeP4bCzp.d.ts → translator-iJhDlgwL.d.cts} +12 -11
- package/package.json +5 -2
|
@@ -307,9 +307,10 @@ interface ResponseSendOptions {
|
|
|
307
307
|
*/
|
|
308
308
|
interface ResponseCall {
|
|
309
309
|
/**
|
|
310
|
-
* The Discord method it used; `
|
|
310
|
+
* The Discord method it used; `respond` answers an autocomplete with its choices, and `message.edit` edits the message
|
|
311
|
+
* itself, once the interaction's token has expired.
|
|
311
312
|
*/
|
|
312
|
-
method: 'deferReply' | 'deferUpdate' | 'reply' | 'update' | 'editReply' | 'followUp' | 'deleteReply' | 'showModal' | 'message.edit';
|
|
313
|
+
method: 'deferReply' | 'deferUpdate' | 'reply' | 'update' | 'editReply' | 'followUp' | 'deleteReply' | 'showModal' | 'launchActivity' | 'sendPremiumRequired' | 'respond' | 'message.edit';
|
|
313
314
|
/** What was sent, as that method received it; none for a deferral or a deletion. */
|
|
314
315
|
payload?: unknown;
|
|
315
316
|
/** What the call rejected with, such as the `DiscordAPIError` for a refused call; absent when it succeeded. */
|
|
@@ -794,7 +795,8 @@ declare abstract class ExecutionContext {
|
|
|
794
795
|
/**
|
|
795
796
|
* The response state of the interaction being handled, the same one `respond(interaction)` returns,
|
|
796
797
|
* or `undefined` for anything that cannot be answered: a message, a reaction, an event or
|
|
797
|
-
* autocomplete.
|
|
798
|
+
* autocomplete. An `@On('interactionCreate')` handler's call has none either, as MeoCord answers that interaction
|
|
799
|
+
* through the handler it dispatches it to.
|
|
798
800
|
*/
|
|
799
801
|
get response(): ResponseState | undefined;
|
|
800
802
|
/**
|
|
@@ -834,11 +836,19 @@ declare abstract class ExecutionContext {
|
|
|
834
836
|
* {@link ExecutionContext.getHandlerParams} returns.
|
|
835
837
|
*/
|
|
836
838
|
abstract getArgs(): readonly unknown[];
|
|
837
|
-
/**
|
|
839
|
+
/**
|
|
840
|
+
* The interaction being handled, or `undefined` for a message or a reaction. For an event, the interaction it
|
|
841
|
+
* carries, as `@On('interactionCreate')` does; `undefined` for any other event.
|
|
842
|
+
*/
|
|
838
843
|
abstract getInteraction(): Interaction | undefined;
|
|
839
|
-
/**
|
|
844
|
+
/**
|
|
845
|
+
* The message being handled, or an event's first argument when it is a message, as in `@On('messageCreate')`;
|
|
846
|
+
* `undefined` for anything else, a reaction's message included. For `@On('messageUpdate')`, that is the message as it
|
|
847
|
+
* was before the edit, which may be partial; the edited one is the event's second argument, from
|
|
848
|
+
* {@link ExecutionContext.getArgs}.
|
|
849
|
+
*/
|
|
840
850
|
abstract getMessage(): Message | undefined;
|
|
841
|
-
/** The reaction being handled, or `undefined` for anything else. */
|
|
851
|
+
/** The reaction being handled, or the one an event carries; `undefined` for anything else. */
|
|
842
852
|
abstract getReaction(): MessageReaction | PartialMessageReaction | undefined;
|
|
843
853
|
/** What is being handled: an interaction, an autocomplete request, a message, a reaction or an event. */
|
|
844
854
|
abstract getType(): ExecutionContextType;
|
|
@@ -1099,7 +1109,8 @@ interface CooldownVerdict {
|
|
|
1099
1109
|
* With a refusal, when the next call is allowed, as a Unix timestamp in milliseconds on the store's own clock. Every
|
|
1100
1110
|
* refusal in one wait gives the same one, so `messages.dmOnCooldown` tells one wait from the next by it, across
|
|
1101
1111
|
* processes and however late the answer arrives. The built-in stores give it; a store without it is told apart by
|
|
1102
|
-
* `retryAfterMs` and the bot's clock instead.
|
|
1112
|
+
* `retryAfterMs` and the bot's clock instead. Their `consume`, and the default `consumeMany` of a store that asks it,
|
|
1113
|
+
* give it as a non-enumerable property, so their verdicts compare and serialise without it.
|
|
1103
1114
|
*/
|
|
1104
1115
|
retryTimestamp?: number;
|
|
1105
1116
|
}
|
|
@@ -1684,8 +1695,9 @@ interface DispatchResult {
|
|
|
1684
1695
|
*/
|
|
1685
1696
|
durationMs: number;
|
|
1686
1697
|
/**
|
|
1687
|
-
* The guard class that denied the call, whether it returned `false` or threw `GuardDeniedError`.
|
|
1688
|
-
*
|
|
1698
|
+
* The guard class that denied the call, whether it returned `false` or threw `GuardDeniedError`. With the outcome
|
|
1699
|
+
* `'denied'`, or `'error'` when the answer to a guard's `GuardDeniedError` failed to build; not for a
|
|
1700
|
+
* `GuardDeniedError` the handler threw itself.
|
|
1689
1701
|
*/
|
|
1690
1702
|
deniedBy?: abstract new (...args: any[]) => unknown;
|
|
1691
1703
|
/**
|
|
@@ -1781,8 +1793,11 @@ type StageParams<C extends abstract new (...args: any[]) => unknown> = 'params'
|
|
|
1781
1793
|
interface GuardOptions {
|
|
1782
1794
|
/**
|
|
1783
1795
|
* The context types the guard runs for, as `ExecutionContext.getType()` reports them; it is skipped for
|
|
1784
|
-
* any other call.
|
|
1785
|
-
* `@
|
|
1796
|
+
* any other call. An autocomplete is its own type, `'autocomplete'`, so a guard limited to `'interaction'`
|
|
1797
|
+
* doesn't run before `@Autocomplete` handlers. A subclass inherits them unless it declares its own. A global
|
|
1798
|
+
* guard also runs before `@On` handlers, so one that reads an interaction declares `['interaction']`, or
|
|
1799
|
+
* `['interaction', 'autocomplete']` to run before autocomplete handlers too. A guard that runs before an
|
|
1800
|
+
* autocomplete answers nothing there: return `false` to show no choices.
|
|
1786
1801
|
*
|
|
1787
1802
|
* @defaultValue every type
|
|
1788
1803
|
*/
|
|
@@ -2108,10 +2123,11 @@ interface MeoCordApplication {
|
|
|
2108
2123
|
* every shard would meet, MeoCord refusing the app or Discord refusing the login for good (an invalid token, or
|
|
2109
2124
|
* intents it disallows or does not know), the manager logs why, stops every shard and exits 1 instead.
|
|
2110
2125
|
*
|
|
2111
|
-
* @returns A promise that resolves once the bot is logged in, or every shard has been spawned.
|
|
2112
|
-
*
|
|
2113
|
-
*
|
|
2114
|
-
* stopped
|
|
2126
|
+
* @returns A promise that resolves once the bot is logged in, or every shard has been spawned. With process
|
|
2127
|
+
* sharding, it also resolves when `stop()` ends the start, which then spawns no more shards.
|
|
2128
|
+
* @throws For a bot in one process, the error of a provider's factory that failed, or the login error, such as an
|
|
2129
|
+
* invalid token; it also rejects when `stop()` ends the start. In either mode, a start of an app already stopped
|
|
2130
|
+
* rejects.
|
|
2115
2131
|
*/
|
|
2116
2132
|
start(): Promise<void>;
|
|
2117
2133
|
/**
|
|
@@ -2122,7 +2138,8 @@ interface MeoCordApplication {
|
|
|
2122
2138
|
* not waited for.
|
|
2123
2139
|
*
|
|
2124
2140
|
* A stop while the bot starts ends that start: it waits for the providers being made, at most `shutdownTimeout`, and
|
|
2125
|
-
* nothing more is made after it.
|
|
2141
|
+
* nothing more is made after it. What the start made is shut down by the rule {@link OnShutdown} gives. A call after
|
|
2142
|
+
* the first waits for it, and a stopped app does not start again.
|
|
2126
2143
|
*
|
|
2127
2144
|
* @returns A promise that resolves once the bot is stopped. It never rejects: a failure to close is logged, and sets
|
|
2128
2145
|
* `process.exitCode` to 1 unless another code is already set.
|
|
@@ -2131,6 +2148,10 @@ interface MeoCordApplication {
|
|
|
2131
2148
|
/**
|
|
2132
2149
|
* Registers the application's commands with Discord, where `meocord.config.ts`'s `commands` says.
|
|
2133
2150
|
* A failure is logged rather than thrown.
|
|
2151
|
+
*
|
|
2152
|
+
* For a bot in one process, it needs the bot online, as the application comes from the login; called earlier, it
|
|
2153
|
+
* logs a warning and registers nothing. With process sharding, the manager registers over REST, before or after
|
|
2154
|
+
* `start()`.
|
|
2134
2155
|
*/
|
|
2135
2156
|
registerCommands(): Promise<void>;
|
|
2136
2157
|
}
|
|
@@ -2197,17 +2218,25 @@ interface OnReady {
|
|
|
2197
2218
|
* Implement it to stop what {@link OnReady} started: timers, open connections, writes still buffered.
|
|
2198
2219
|
*
|
|
2199
2220
|
* @remarks
|
|
2200
|
-
* Called when the bot stops, on SIGINT or SIGTERM or through `app.stop()`, before the client is destroyed, and
|
|
2201
|
-
*
|
|
2202
|
-
*
|
|
2203
|
-
*
|
|
2204
|
-
*
|
|
2205
|
-
* It runs
|
|
2206
|
-
*
|
|
2207
|
-
*
|
|
2208
|
-
*
|
|
2221
|
+
* Called when the bot stops, on SIGINT or SIGTERM or through `app.stop()`, before the client is destroyed, and when
|
|
2222
|
+
* its start fails. Hooks run one at a time in reverse dependency order, so a service stops before the services it
|
|
2223
|
+
* injects. The whole sequence is limited by `shutdownTimeout` in `meocord.config.ts`; shutdown then goes on whether or
|
|
2224
|
+
* not it finished. A hook that throws is logged and the next one still runs.
|
|
2225
|
+
*
|
|
2226
|
+
* It runs for each class and provided value the bot has made whose `onReady`, and that of everything it depends on,
|
|
2227
|
+
* has finished or doesn't exist. So a provided value with no `onReady`, such as a connection pool, is closed on any
|
|
2228
|
+
* stop once it is made, one during startup included, while a class whose `onReady` never ran is not shut down, nor is
|
|
2229
|
+
* anything that depends on it. A stop while the ready hooks are running waits for the `onReady` in progress, within
|
|
2230
|
+
* `shutdownTimeout`, then shuts that class down too, and no further `onReady` starts. An `onReady` still running once
|
|
2231
|
+
* only the hooks' share of the timeout is left is named in a warning and skipped. An `onReady` that threw counts as
|
|
2209
2232
|
* finished, so its partial setup is cleaned up.
|
|
2210
2233
|
*
|
|
2234
|
+
* A start that fails, because a provider's factory or the login failed, shuts down what it made by the same rule, so
|
|
2235
|
+
* the process can end with its exit code. A value the app gave with `useValue` is left open: a retry of `start()` makes
|
|
2236
|
+
* the rest again, and once the bot stops, by `app.stop()`, a Ctrl+C or a SIGTERM, the value is shut down by the same
|
|
2237
|
+
* rule, which leaves out one with an `onReady` a failed start never ran. A stop while a failed start shuts down waits
|
|
2238
|
+
* for that shutdown, all within one `shutdownTimeout`.
|
|
2239
|
+
*
|
|
2211
2240
|
* @example
|
|
2212
2241
|
* ```ts
|
|
2213
2242
|
* import { appendFile } from 'node:fs/promises'
|
|
@@ -2646,7 +2675,8 @@ interface MessageCommandOptions {
|
|
|
2646
2675
|
types?: Record<string, MessageParamType>;
|
|
2647
2676
|
/**
|
|
2648
2677
|
* How long a reply showing a command's usage, or a guard's or validation's reason, stays before it is deleted, in
|
|
2649
|
-
* seconds. `0` keeps it.
|
|
2678
|
+
* seconds. `0` keeps it, and so does a time longer than a timer can wait, 2147483 seconds (about 24.8 days), which
|
|
2679
|
+
* startup warns about.
|
|
2650
2680
|
* @defaultValue `10`
|
|
2651
2681
|
*/
|
|
2652
2682
|
deleteUsageRepliesAfter?: number;
|
|
@@ -2787,7 +2817,7 @@ interface MessageHelpEntry {
|
|
|
2787
2817
|
description?: string;
|
|
2788
2818
|
/** Its aliases and other spellings, as the caller types them, such as `!m`. */
|
|
2789
2819
|
aliases: string[];
|
|
2790
|
-
/** Where it works; a command with a `member`, `role` or `channel` param works in servers only. */
|
|
2820
|
+
/** Where it works; a command with a `member`, `role` or `channel` param, or required flag, works in servers only. */
|
|
2791
2821
|
scope: MessageScope;
|
|
2792
2822
|
/** Each param and flag, with what it takes. */
|
|
2793
2823
|
params: MessageHelpParam[];
|
|
@@ -2902,7 +2932,10 @@ interface MessageParamTypes {
|
|
|
2902
2932
|
member: GuildMember;
|
|
2903
2933
|
/** A user, by mention or ID. */
|
|
2904
2934
|
user: User;
|
|
2905
|
-
/**
|
|
2935
|
+
/**
|
|
2936
|
+
* A role of the message's server, by mention, ID or name; an optional one that another optional param follows
|
|
2937
|
+
* takes a mention or an ID only.
|
|
2938
|
+
*/
|
|
2906
2939
|
role: Role;
|
|
2907
2940
|
/** A channel of the message's server, by mention or ID. */
|
|
2908
2941
|
channel: GuildBasedChannel;
|
|
@@ -2940,8 +2973,11 @@ interface EntityRef<T> {
|
|
|
2940
2973
|
/** Fetches the entity, once however many callers ask at the same time; `undefined` when there is none. */
|
|
2941
2974
|
resolve(): Promise<T | undefined>;
|
|
2942
2975
|
}
|
|
2943
|
-
/**
|
|
2944
|
-
|
|
2976
|
+
/**
|
|
2977
|
+
* Splits a pattern into its words. Each word is one step of tail recursion, with the words found so far in `Acc`, so a
|
|
2978
|
+
* pattern may hold about 1,000 of them.
|
|
2979
|
+
*/
|
|
2980
|
+
type PatternWords<S extends string, Acc extends string[] = []> = S extends `${infer Word} ${infer Rest}` ? PatternWords<Rest, Word extends '' ? Acc : [...Acc, Word]> : S extends '' ? Acc : [...Acc, S];
|
|
2945
2981
|
/**
|
|
2946
2982
|
* The value a param's type gives: a named type, or one of the words `a|b` lists. An app's type not declared
|
|
2947
2983
|
* in {@link MessageParamTypes} is not checked.
|
|
@@ -3099,8 +3135,9 @@ interface MessageHandlerOptions {
|
|
|
3099
3135
|
description?: string;
|
|
3100
3136
|
/**
|
|
3101
3137
|
* Where the command works; `'any'` by default. A message sent elsewhere gets a usage reply saying
|
|
3102
|
-
* where it works, and the handler does not run. A command with a `member`, `role` or `channel` param
|
|
3103
|
-
* works in servers only; `'dm'` with one is refused as the
|
|
3138
|
+
* where it works, and the handler does not run. A command with a `member`, `role` or `channel` param, or a required
|
|
3139
|
+
* flag of one of those types, works in servers only; `'dm'` with one, or with an optional such flag, is refused as the
|
|
3140
|
+
* bot starts. An optional flag of those types refuses a DM only when the message gives it.
|
|
3104
3141
|
*/
|
|
3105
3142
|
scope?: MessageScope;
|
|
3106
3143
|
/**
|
|
@@ -3182,8 +3219,13 @@ interface MeoCordConfig {
|
|
|
3182
3219
|
rsbuild?: (config: RsbuildConfig) => RsbuildConfig | undefined;
|
|
3183
3220
|
/**
|
|
3184
3221
|
* Makes stack traces name your source files, lines and columns, from the source map the build writes
|
|
3185
|
-
* beside `dist/main.js`. Under Node, `meocord start` passes `--enable-source-maps`;
|
|
3186
|
-
*
|
|
3222
|
+
* beside `dist/main.js`. Under Node, `meocord start` passes `--enable-source-maps`; started without the
|
|
3223
|
+
* flag, the bundle maps each stack through `Error.prepareStackTrace` itself. Either way every trace Node
|
|
3224
|
+
* prints is mapped.
|
|
3225
|
+
*
|
|
3226
|
+
* Under Bun, the bundle maps `error.stack`, and so each trace MeoCord's `Logger` prints. What Bun prints
|
|
3227
|
+
* itself, for an uncaught error, an unhandled rejection or `console.error(error)` before `error.stack` is
|
|
3228
|
+
* read, keeps the bundle's positions.
|
|
3187
3229
|
*
|
|
3188
3230
|
* Set `false` for an error tracker that applies uploaded source maps to the bundle's positions, or a
|
|
3189
3231
|
* source mapper of your own.
|
|
@@ -3355,7 +3397,11 @@ interface CommandBuilderOptions {
|
|
|
3355
3397
|
* empty after dropping blank ids is not registered at all, rather than falling back to global. Under a
|
|
3356
3398
|
* development server, it goes there with every other command.
|
|
3357
3399
|
*
|
|
3358
|
-
*
|
|
3400
|
+
* A builder that extends another and gives no `guilds` inherits its base's, with a warning when it is decorated: declare
|
|
3401
|
+
* `guilds` on the subclass to keep them. The next major version (5.0) registers such a builder's command in the
|
|
3402
|
+
* configured scope.
|
|
3403
|
+
*
|
|
3404
|
+
* @defaultValue the configured scope, or the guilds of the builder it extends
|
|
3359
3405
|
*/
|
|
3360
3406
|
guilds?: (string | undefined)[];
|
|
3361
3407
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
2
|
import '@rsbuild/core';
|
|
3
3
|
import '../controller.enum-DTDn69N9.cjs';
|
|
4
|
-
export { ar as AutocompleteMetadata, O as BuildableCommandType, as as CallHandler, _ as CheckedParams, ao as ClassProvider, at as CommandBuildResult, S as CommandBuilderBase, X as CommandBuilderConstructor, Q as CommandBuilderOptions, Y as CommandInteractionType, au as CommandMetadata, av as CommandRegistrationConfig, a1 as ControllerOptions, ak as CooldownOptions, a9 as CooldownStoreFailure, aw as DeepPartial, D as DeepReadonly, ab as DispatchObserver, ax as DispatchOutcome, ay as DispatchResult, az as EntityRef, a7 as ExceptionFilter, F as FactoryProvider, a4 as GuardInterface, a3 as GuardOptions, aA as GuildThemeTarget, aj as InferSchemaOutput, a6 as InterceptorInterface, a5 as InterceptorOptions, J as MeoCordApplication, aB as MeoCordConfig, aq as MeoCordMessages, M as MeoCordTheme, L as MessageCommandOptions, Z as MessageHandlerOptions, N as MessageHelp, aC as MessageHelpEntry, aD as MessageHelpOptions, aE as MessageHelpParam, aF as MessageParamType, aG as MessageParamTypes, an as MessagePrefix, aH as MessageResponseContext, K as MessageScope, al as ObserverOptions, aI as OnReady, aJ as OnShutdown, W as PIPED_BRAND, aK as ParamRefsOf, aL as ParamsOf, af as PipeInterface, aM as Piped, aN as PresentedError, aO as PrimaryEntryPointCommandData, a8 as Provider, P as ProviderToken, a0 as ReactionEvent, aP as ReactionHandlerOptions, $ as ReactionHandlerSettings, aQ as ReadyInfo, aR as ReservedThemeRole, aS as ResponseContext, aT as ResponseFile, aa as ResponsePresenter, aU as ResponseView, ac as RootTheme, aV as RsbuildConfig, aW as ShardingConfig, a2 as StageParams, ag as StandardSchemaV1, aX as StandardSchemaV1Issue, aY as StandardSchemaV1Props, aZ as StandardSchemaV1Result, a_ as ThemeButtonStyle, a$ as ThemeButtons, b0 as ThemeColors, b1 as ThemeEmojis, am as ThemeOverride, ae as ThemeResolver, ad as ThemeResolvers, T as Token, b2 as UserThemeTarget, ai as ValidateOptions, ah as ValidatePipes, ap as ValueProvider } from '../index-
|
|
4
|
+
export { ar as AutocompleteMetadata, O as BuildableCommandType, as as CallHandler, _ as CheckedParams, ao as ClassProvider, at as CommandBuildResult, S as CommandBuilderBase, X as CommandBuilderConstructor, Q as CommandBuilderOptions, Y as CommandInteractionType, au as CommandMetadata, av as CommandRegistrationConfig, a1 as ControllerOptions, ak as CooldownOptions, a9 as CooldownStoreFailure, aw as DeepPartial, D as DeepReadonly, ab as DispatchObserver, ax as DispatchOutcome, ay as DispatchResult, az as EntityRef, a7 as ExceptionFilter, F as FactoryProvider, a4 as GuardInterface, a3 as GuardOptions, aA as GuildThemeTarget, aj as InferSchemaOutput, a6 as InterceptorInterface, a5 as InterceptorOptions, J as MeoCordApplication, aB as MeoCordConfig, aq as MeoCordMessages, M as MeoCordTheme, L as MessageCommandOptions, Z as MessageHandlerOptions, N as MessageHelp, aC as MessageHelpEntry, aD as MessageHelpOptions, aE as MessageHelpParam, aF as MessageParamType, aG as MessageParamTypes, an as MessagePrefix, aH as MessageResponseContext, K as MessageScope, al as ObserverOptions, aI as OnReady, aJ as OnShutdown, W as PIPED_BRAND, aK as ParamRefsOf, aL as ParamsOf, af as PipeInterface, aM as Piped, aN as PresentedError, aO as PrimaryEntryPointCommandData, a8 as Provider, P as ProviderToken, a0 as ReactionEvent, aP as ReactionHandlerOptions, $ as ReactionHandlerSettings, aQ as ReadyInfo, aR as ReservedThemeRole, aS as ResponseContext, aT as ResponseFile, aa as ResponsePresenter, aU as ResponseView, ac as RootTheme, aV as RsbuildConfig, aW as ShardingConfig, a2 as StageParams, ag as StandardSchemaV1, aX as StandardSchemaV1Issue, aY as StandardSchemaV1Props, aZ as StandardSchemaV1Result, a_ as ThemeButtonStyle, a$ as ThemeButtons, b0 as ThemeColors, b1 as ThemeEmojis, am as ThemeOverride, ae as ThemeResolver, ad as ThemeResolvers, T as Token, b2 as UserThemeTarget, ai as ValidateOptions, ah as ValidatePipes, ap as ValueProvider } from '../index-CqXImwF_.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
2
|
import '@rsbuild/core';
|
|
3
3
|
import '../controller.enum-DTDn69N9.js';
|
|
4
|
-
export { ar as AutocompleteMetadata, O as BuildableCommandType, as as CallHandler, _ as CheckedParams, ao as ClassProvider, at as CommandBuildResult, S as CommandBuilderBase, X as CommandBuilderConstructor, Q as CommandBuilderOptions, Y as CommandInteractionType, au as CommandMetadata, av as CommandRegistrationConfig, a1 as ControllerOptions, ak as CooldownOptions, a9 as CooldownStoreFailure, aw as DeepPartial, D as DeepReadonly, ab as DispatchObserver, ax as DispatchOutcome, ay as DispatchResult, az as EntityRef, a7 as ExceptionFilter, F as FactoryProvider, a4 as GuardInterface, a3 as GuardOptions, aA as GuildThemeTarget, aj as InferSchemaOutput, a6 as InterceptorInterface, a5 as InterceptorOptions, J as MeoCordApplication, aB as MeoCordConfig, aq as MeoCordMessages, M as MeoCordTheme, L as MessageCommandOptions, Z as MessageHandlerOptions, N as MessageHelp, aC as MessageHelpEntry, aD as MessageHelpOptions, aE as MessageHelpParam, aF as MessageParamType, aG as MessageParamTypes, an as MessagePrefix, aH as MessageResponseContext, K as MessageScope, al as ObserverOptions, aI as OnReady, aJ as OnShutdown, W as PIPED_BRAND, aK as ParamRefsOf, aL as ParamsOf, af as PipeInterface, aM as Piped, aN as PresentedError, aO as PrimaryEntryPointCommandData, a8 as Provider, P as ProviderToken, a0 as ReactionEvent, aP as ReactionHandlerOptions, $ as ReactionHandlerSettings, aQ as ReadyInfo, aR as ReservedThemeRole, aS as ResponseContext, aT as ResponseFile, aa as ResponsePresenter, aU as ResponseView, ac as RootTheme, aV as RsbuildConfig, aW as ShardingConfig, a2 as StageParams, ag as StandardSchemaV1, aX as StandardSchemaV1Issue, aY as StandardSchemaV1Props, aZ as StandardSchemaV1Result, a_ as ThemeButtonStyle, a$ as ThemeButtons, b0 as ThemeColors, b1 as ThemeEmojis, am as ThemeOverride, ae as ThemeResolver, ad as ThemeResolvers, T as Token, b2 as UserThemeTarget, ai as ValidateOptions, ah as ValidatePipes, ap as ValueProvider } from '../index-
|
|
4
|
+
export { ar as AutocompleteMetadata, O as BuildableCommandType, as as CallHandler, _ as CheckedParams, ao as ClassProvider, at as CommandBuildResult, S as CommandBuilderBase, X as CommandBuilderConstructor, Q as CommandBuilderOptions, Y as CommandInteractionType, au as CommandMetadata, av as CommandRegistrationConfig, a1 as ControllerOptions, ak as CooldownOptions, a9 as CooldownStoreFailure, aw as DeepPartial, D as DeepReadonly, ab as DispatchObserver, ax as DispatchOutcome, ay as DispatchResult, az as EntityRef, a7 as ExceptionFilter, F as FactoryProvider, a4 as GuardInterface, a3 as GuardOptions, aA as GuildThemeTarget, aj as InferSchemaOutput, a6 as InterceptorInterface, a5 as InterceptorOptions, J as MeoCordApplication, aB as MeoCordConfig, aq as MeoCordMessages, M as MeoCordTheme, L as MessageCommandOptions, Z as MessageHandlerOptions, N as MessageHelp, aC as MessageHelpEntry, aD as MessageHelpOptions, aE as MessageHelpParam, aF as MessageParamType, aG as MessageParamTypes, an as MessagePrefix, aH as MessageResponseContext, K as MessageScope, al as ObserverOptions, aI as OnReady, aJ as OnShutdown, W as PIPED_BRAND, aK as ParamRefsOf, aL as ParamsOf, af as PipeInterface, aM as Piped, aN as PresentedError, aO as PrimaryEntryPointCommandData, a8 as Provider, P as ProviderToken, a0 as ReactionEvent, aP as ReactionHandlerOptions, $ as ReactionHandlerSettings, aQ as ReadyInfo, aR as ReservedThemeRole, aS as ResponseContext, aT as ResponseFile, aa as ResponsePresenter, aU as ResponseView, ac as RootTheme, aV as RsbuildConfig, aW as ShardingConfig, a2 as StageParams, ag as StandardSchemaV1, aX as StandardSchemaV1Issue, aY as StandardSchemaV1Props, aZ as StandardSchemaV1Result, a_ as ThemeButtonStyle, a$ as ThemeButtons, b0 as ThemeColors, b1 as ThemeEmojis, am as ThemeOverride, ae as ThemeResolver, ad as ThemeResolvers, T as Token, b2 as UserThemeTarget, ai as ValidateOptions, ah as ValidatePipes, ap as ValueProvider } from '../index-Brkd6QGL.js';
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
+
import { I as IsWord } from './translator-iJhDlgwL.cjs';
|
|
2
|
+
|
|
1
3
|
/** A `{name}` or `{name:type}` param's name. */
|
|
2
4
|
type ParamName<S extends string> = S extends `${infer Name}:${string}` ? Name : S;
|
|
3
5
|
/** A `{name:type}` param's type, `string` for a `{name}`. */
|
|
4
6
|
type ParamType<S extends string> = S extends `${string}:${infer Type}` ? Type : 'string';
|
|
5
|
-
/**
|
|
6
|
-
type
|
|
7
|
+
/**
|
|
8
|
+
* Each param of a pattern, with its name and type, read as the runtime reads it: a `{` then a name of ASCII letters,
|
|
9
|
+
* digits and `_`, an optional `:type` without `/`, then `}`. Any other brace is the pattern's own text, and reading
|
|
10
|
+
* resumes after it.
|
|
11
|
+
*/
|
|
12
|
+
type RouteParamSpecs<T extends string> = T extends `${string}{${infer After}` ? After extends `${infer Param}}${infer Rest}` ? IsParam<Param> extends true ? {
|
|
7
13
|
name: ParamName<Param>;
|
|
8
14
|
type: ParamType<Param>;
|
|
9
|
-
} | RouteParamSpecs<Rest> : never;
|
|
15
|
+
} | RouteParamSpecs<Rest> : RouteParamSpecs<After> : never : never;
|
|
16
|
+
/** Whether the text between a `{` and the next `}` is a param: a word name, and a type without `/` after a `:`. */
|
|
17
|
+
type IsParam<Param extends string> = Param extends `${string}/${string}` ? false : IsWord<ParamName<Param>>;
|
|
10
18
|
/** The words a type such as `open|closed` chooses from, as a union. */
|
|
11
19
|
type Choices<T extends string> = T extends `${infer Word}|${infer Rest}` ? Word | Choices<Rest> : T;
|
|
12
20
|
/**
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
+
import { I as IsWord } from './translator-D8aydlCE.js';
|
|
2
|
+
|
|
1
3
|
/** A `{name}` or `{name:type}` param's name. */
|
|
2
4
|
type ParamName<S extends string> = S extends `${infer Name}:${string}` ? Name : S;
|
|
3
5
|
/** A `{name:type}` param's type, `string` for a `{name}`. */
|
|
4
6
|
type ParamType<S extends string> = S extends `${string}:${infer Type}` ? Type : 'string';
|
|
5
|
-
/**
|
|
6
|
-
type
|
|
7
|
+
/**
|
|
8
|
+
* Each param of a pattern, with its name and type, read as the runtime reads it: a `{` then a name of ASCII letters,
|
|
9
|
+
* digits and `_`, an optional `:type` without `/`, then `}`. Any other brace is the pattern's own text, and reading
|
|
10
|
+
* resumes after it.
|
|
11
|
+
*/
|
|
12
|
+
type RouteParamSpecs<T extends string> = T extends `${string}{${infer After}` ? After extends `${infer Param}}${infer Rest}` ? IsParam<Param> extends true ? {
|
|
7
13
|
name: ParamName<Param>;
|
|
8
14
|
type: ParamType<Param>;
|
|
9
|
-
} | RouteParamSpecs<Rest> : never;
|
|
15
|
+
} | RouteParamSpecs<Rest> : RouteParamSpecs<After> : never : never;
|
|
16
|
+
/** Whether the text between a `{` and the next `}` is a param: a word name, and a type without `/` after a `:`. */
|
|
17
|
+
type IsParam<Param extends string> = Param extends `${string}/${string}` ? false : IsWord<ParamName<Param>>;
|
|
10
18
|
/** The words a type such as `open|closed` chooses from, as a union. */
|
|
11
19
|
type Choices<T extends string> = T extends `${infer Word}|${infer Rest}` ? Word | Choices<Rest> : T;
|
|
12
20
|
/**
|