@seedcord/gateway 0.1.0 → 0.1.1
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/dist/index.cjs +28 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +19 -17
- package/dist/index.mjs +28 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
1
2
|
import { AnyCustomId, AutocompletableNames, BaseReplySender, ChoiceValueOf, EntryFor, FocusedField, GateFitsWith, HasComponentDefs, MatchArms, ModalLike, PageCursor, SingleParams, SlashOptions as SlashOptions$1 } from "@seedcord/core/internal";
|
|
2
3
|
import { ArraySource as ArraySource$1, AutocompleteOptions, BaseHandler, Bus, ContextMenuKind, CoreBase, CursorSource as CursorSource$1, DispatchContext, Gate, GateContextBase, GateNoticeOptions, GuildPermissionsContext, Initializeable, Notice, PaginatorBase, PaginatorConfig, PermissionNoticeOverrides, PermissionScope, RepliableHandler as RepliableHandler$1, RequiredOf, SelectMenuKind, SlashOptionRegistry, Subscriber as Subscriber$1, SubscriptionKey, WebhookLog as WebhookLog$1 } from "@seedcord/core";
|
|
3
4
|
import { Logger } from "@seedcord/logger";
|
|
@@ -14,7 +15,6 @@ export * from "@seedcord/rate-limiter";
|
|
|
14
15
|
export * from "@seedcord/utils";
|
|
15
16
|
export * from "@seedcord/event-emitter";
|
|
16
17
|
export type * from "@seedcord/types";
|
|
17
|
-
|
|
18
18
|
//#region src/subscriptions.d.ts
|
|
19
19
|
declare module '@seedcord/core/internal' {
|
|
20
20
|
interface DefaultSubscriptions {
|
|
@@ -26,7 +26,7 @@ declare module '@seedcord/core/internal' {
|
|
|
26
26
|
anyEvent: { [Name in keyof ClientEvents]: {
|
|
27
27
|
name: Name;
|
|
28
28
|
args: ClientEvents[Name];
|
|
29
|
-
} }[keyof ClientEvents];
|
|
29
|
+
}; }[keyof ClientEvents];
|
|
30
30
|
/** Triggered for every interaction the bot receives, before routing. */
|
|
31
31
|
anyInteraction: {
|
|
32
32
|
interaction: Interaction;
|
|
@@ -48,7 +48,8 @@ type EventsConfig = {
|
|
|
48
48
|
*/
|
|
49
49
|
middlewares?: string;
|
|
50
50
|
} | {
|
|
51
|
-
/** No events configured */
|
|
51
|
+
/** No events configured */
|
|
52
|
+
path: null;
|
|
52
53
|
};
|
|
53
54
|
/**
|
|
54
55
|
* The gateway transport's bot configuration, the shared {@link BotConfig} plus the pieces only a
|
|
@@ -170,7 +171,7 @@ declare abstract class BaseHandler$1<ValidEvent extends ValidEventTypes> extends
|
|
|
170
171
|
getEvent(): ValidEvent;
|
|
171
172
|
}
|
|
172
173
|
//#endregion
|
|
173
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
174
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/basic.d.ts
|
|
174
175
|
/**
|
|
175
176
|
Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
|
176
177
|
|
|
@@ -178,7 +179,7 @@ Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/Jav
|
|
|
178
179
|
*/
|
|
179
180
|
type Constructor<T, Arguments extends unknown[] = any[]> = new (...arguments_: Arguments) => T;
|
|
180
181
|
//#endregion
|
|
181
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
182
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-never.d.ts
|
|
182
183
|
/**
|
|
183
184
|
Returns a boolean for whether the given type is `never`.
|
|
184
185
|
|
|
@@ -234,7 +235,7 @@ type B = IsTrueFixed<never>;
|
|
|
234
235
|
*/
|
|
235
236
|
type IsNever<T> = [T] extends [never] ? true : false;
|
|
236
237
|
//#endregion
|
|
237
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
238
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-equal.d.ts
|
|
238
239
|
/**
|
|
239
240
|
Returns a boolean for whether the two given types are equal.
|
|
240
241
|
|
|
@@ -265,7 +266,7 @@ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false
|
|
|
265
266
|
// This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
|
|
266
267
|
type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
|
|
267
268
|
//#endregion
|
|
268
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
269
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/non-empty-tuple.d.ts
|
|
269
270
|
/**
|
|
270
271
|
Matches any non-empty tuple.
|
|
271
272
|
|
|
@@ -289,7 +290,7 @@ sum();
|
|
|
289
290
|
*/
|
|
290
291
|
type NonEmptyTuple<T = unknown> = readonly [T, ...T[]];
|
|
291
292
|
//#endregion
|
|
292
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
293
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-union.d.ts
|
|
293
294
|
/**
|
|
294
295
|
Returns a boolean for whether the given type is a union.
|
|
295
296
|
|
|
@@ -308,12 +309,13 @@ type IsUnion<T> = InternalIsUnion<T>;
|
|
|
308
309
|
/**
|
|
309
310
|
The actual implementation of `IsUnion`.
|
|
310
311
|
*/
|
|
311
|
-
type InternalIsUnion<T, U = T> = (IsNever<T> extends true ? false : T extends any ? IsEqual<U, T> extends true ? false : true : never) extends infer Result
|
|
312
|
+
type InternalIsUnion<T, U = T> = (IsNever<T> extends true ? false : T extends any ? IsEqual<U, T> extends true ? false : true : never) extends (infer Result) ?
|
|
313
|
+
// In some cases `Result` will return `false | true` which is `boolean`,
|
|
312
314
|
// that means `T` has at least two types and it's a union type,
|
|
313
315
|
// so we will return `true` instead of `boolean`.
|
|
314
|
-
|
|
316
|
+
boolean extends Result ? true : Result : never; // Should never happen
|
|
315
317
|
//#endregion
|
|
316
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
318
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/promisable.d.ts
|
|
317
319
|
/**
|
|
318
320
|
Create a type that represents either the value or the value wrapped in `PromiseLike`.
|
|
319
321
|
|
|
@@ -345,7 +347,7 @@ type Promisable<T> = T | PromiseLike<T>;
|
|
|
345
347
|
type SingleEventPayload<Names extends ValidNonInteractionKeys> = IsUnion<Names> extends true ? never : ClientEvents[Names];
|
|
346
348
|
//#endregion
|
|
347
349
|
//#region src/handlers/event/EventHandler.d.ts
|
|
348
|
-
type EventMatchArms<Names extends ValidNonInteractionKeys, Ret> = { [Name in Names]: (...args: ClientEvents[Name]) => Promisable<Ret
|
|
350
|
+
type EventMatchArms<Names extends ValidNonInteractionKeys, Ret> = { [Name in Names]: (...args: ClientEvents[Name]) => Promisable<Ret>; };
|
|
349
351
|
/**
|
|
350
352
|
* Base class for a Discord client event handler.
|
|
351
353
|
*
|
|
@@ -574,7 +576,7 @@ type SentMessage = Message;
|
|
|
574
576
|
*/
|
|
575
577
|
declare class ReplySender extends BaseReplySender<SentMessage, GatewayFile> {
|
|
576
578
|
private readonly interaction;
|
|
577
|
-
constructor(interaction: Repliables, routeId: string, bus
|
|
579
|
+
constructor(interaction: Repliables, routeId: string, bus: Bus);
|
|
578
580
|
protected writeReply(response: GatewayReplyResponse | string, opts?: SendOpts): Promise<SentMessage | undefined>;
|
|
579
581
|
protected writeDefer(opts?: DeferOpts): Promise<void>;
|
|
580
582
|
protected writeDeferUpdate(): Promise<void>;
|
|
@@ -640,7 +642,7 @@ interface Ungateable {
|
|
|
640
642
|
}
|
|
641
643
|
type ProvidedContext<TCtor extends AnyHandlerCtor> = InstanceType<TCtor> extends InteractionHandler<infer Repliable> ? InteractionGateContext<Repliable> : InstanceType<TCtor> extends EventHandler<infer Names> ? EventGateContext<Names> : Ungateable;
|
|
642
644
|
type KindName<Ctx> = Ctx extends Ungateable ? 'autocomplete' : Ctx extends InteractionGateContext<infer R> ? R extends ChatInputCommandInteraction ? 'Slash' : R extends MessageContextMenuCommandInteraction ? 'MessageMenu' : R extends UserContextMenuCommandInteraction ? 'UserMenu' : R extends StringSelectMenuInteraction ? 'StringSelect' : R extends UserSelectMenuInteraction ? 'UserSelect' : R extends RoleSelectMenuInteraction ? 'RoleSelect' : R extends ChannelSelectMenuInteraction ? 'ChannelSelect' : R extends MentionableSelectMenuInteraction ? 'MentionableSelect' : R extends ButtonInteraction ? 'Button' : R extends ModalSubmitInteraction ? 'Modal' : 'an interaction' : Ctx extends EventGateContext<infer N> ? `${N & string} event` : 'an agnostic';
|
|
643
|
-
type FitAll<TCtor extends AnyHandlerCtor, Gates extends readonly Gate<GateContextBase>[]> = { [Index in keyof Gates]: GateFitsWith<ProvidedContext<TCtor>, KindName<ProvidedContext<TCtor>>, Gates[Index], KindName<RequiredOf<Gates[Index]
|
|
645
|
+
type FitAll<TCtor extends AnyHandlerCtor, Gates extends readonly Gate<GateContextBase>[]> = { [Index in keyof Gates]: GateFitsWith<ProvidedContext<TCtor>, KindName<ProvidedContext<TCtor>>, Gates[Index], KindName<RequiredOf<Gates[Index]>>>; };
|
|
644
646
|
//#endregion
|
|
645
647
|
//#region src/bot/decorators/Gated.d.ts
|
|
646
648
|
/**
|
|
@@ -713,7 +715,7 @@ interface GatewayLens<Cache extends CacheType> {
|
|
|
713
715
|
type SlashOptions<Route extends keyof SlashOptionRegistry, Cache extends CacheType = 'cached'> = SlashOptions$1<Route, GatewayLens<Cache>>;
|
|
714
716
|
//#endregion
|
|
715
717
|
//#region src/handlers/interaction/SlashHandler.d.ts
|
|
716
|
-
type SlashMatchArms<Route extends keyof SlashOptionRegistry, Cache extends CacheType, Ret> = { [Key in Route]: (options: SlashOptions<Key, Cache>) => Promisable<Ret
|
|
718
|
+
type SlashMatchArms<Route extends keyof SlashOptionRegistry, Cache extends CacheType, Ret> = { [Key in Route]: (options: SlashOptions<Key, Cache>) => Promisable<Ret>; };
|
|
717
719
|
/**
|
|
718
720
|
* Base class for a chat-input (slash) command handler.
|
|
719
721
|
*
|
|
@@ -808,7 +810,7 @@ declare abstract class ContextMenuHandler<Kind extends ContextMenuKind, Cache ex
|
|
|
808
810
|
}
|
|
809
811
|
//#endregion
|
|
810
812
|
//#region src/handlers/interaction/AutocompleteHandler.d.ts
|
|
811
|
-
type FocusedArms<Route extends keyof SlashOptionRegistry, Ret> = { [Name in AutocompletableNames<Route>]: (value: string, respond: (choices: readonly ApplicationCommandOptionChoiceData<ChoiceValueOf<EntryFor<Route, Name>>>[]) => Promise<void>) => Promisable<Ret
|
|
813
|
+
type FocusedArms<Route extends keyof SlashOptionRegistry, Ret> = { [Name in AutocompletableNames<Route>]: (value: string, respond: (choices: readonly ApplicationCommandOptionChoiceData<ChoiceValueOf<EntryFor<Route, Name>>>[]) => Promise<void>) => Promisable<Ret>; };
|
|
812
814
|
/**
|
|
813
815
|
* Base class for a Discord autocomplete handler.
|
|
814
816
|
*
|
|
@@ -1120,7 +1122,7 @@ declare function Nsfw(options?: GateNoticeOptions): Gate<InteractionGateContext<
|
|
|
1120
1122
|
* The global {@link Emojis} accessor type. Each key resolves to its precise class, `GuildEmoji` for a `'guild'`
|
|
1121
1123
|
* tag and `ApplicationEmoji` for an `'application'` tag, the tags `seedcord codegen` writes into {@link EmojiMap}.
|
|
1122
1124
|
*/
|
|
1123
|
-
type InjectedEmojiMap = { [K in keyof EmojiMap]: EmojiMap[K] extends 'guild' ? GuildEmoji : ApplicationEmoji };
|
|
1125
|
+
type InjectedEmojiMap = { [K in keyof EmojiMap]: EmojiMap[K] extends 'guild' ? GuildEmoji : ApplicationEmoji; };
|
|
1124
1126
|
/**
|
|
1125
1127
|
* The bot's resolved emojis, keyed by {@link EmojiMap}. Filled by {@link EmojiInjector} during startup.
|
|
1126
1128
|
* A read before that throws.
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import { installNodeDefaults } from "@seedcord/logger/node";
|
|
3
|
-
import { BaseReplySender, CommandInjector, EventMetadataKey, FaultThrottle, GateNotice, GatedMetadataKey, HmrManager, InteractionMetadataKey, InteractionRouteKeys, InteractionRoutes, MiddlewareMetadataKey, MissingPermissions, NoticeCard, PermissionNames, PublishDefault, accessorStore, areRoutes, asError, clearStore, decodeComponentRoute, deferFlags,
|
|
3
|
+
import { BaseReplySender, CommandInjector, EventMetadataKey, FaultThrottle, GateNotice, GatedMetadataKey, HmrManager, InteractionMetadataKey, InteractionRouteKeys, InteractionRoutes, MiddlewareMetadataKey, MissingPermissions, NoticeCard, PermissionNames, PublishDefault, accessorStore, areRoutes, asError, clearStore, decodeComponentRoute, deferFlags, guardedAccessor, isEmojiTuple, outcomeFor, pickNotice, prefixOf, queuedMsFor, reportDispatch, reportedWrite, routeIdOf, runHandlerGates, sendFlags, setBotColor, slowGateMonitor } from "@seedcord/core/internal";
|
|
4
4
|
import { SeedcordErrorCode } from "@seedcord/errors";
|
|
5
5
|
import { SeedcordError, SeedcordTypeError, validateDiscordToken } from "@seedcord/errors/internal";
|
|
6
6
|
import { ArraySource as ArraySource$1, BaseHandler, BuilderComponent, Bus, CursorSource as CursorSource$1, CustomId, DispatchContext, Fault, Notice, PaginatorBase, RepliableHandler as RepliableHandler$1, RowComponent, Silence, Subscriber as Subscriber$1, WebhookLog as WebhookLog$1, assertPermissions, defineGate } from "@seedcord/core";
|
|
@@ -556,10 +556,10 @@ function seedState(interaction) {
|
|
|
556
556
|
var ReplySender = class extends BaseReplySender {
|
|
557
557
|
interaction;
|
|
558
558
|
constructor(interaction, routeId, bus) {
|
|
559
|
-
super(routeId,
|
|
559
|
+
super(routeId, {
|
|
560
560
|
bus,
|
|
561
561
|
interactionId: interaction.id
|
|
562
|
-
});
|
|
562
|
+
}, seedState(interaction));
|
|
563
563
|
this.interaction = interaction;
|
|
564
564
|
}
|
|
565
565
|
async writeReply(response, opts) {
|
|
@@ -1499,7 +1499,7 @@ function interactionKind(interaction) {
|
|
|
1499
1499
|
|
|
1500
1500
|
//#endregion
|
|
1501
1501
|
//#region src/bot/handleEventFault.ts
|
|
1502
|
-
const logger$1 = new Logger("
|
|
1502
|
+
const logger$1 = new Logger("Faults", { channel: "errors" });
|
|
1503
1503
|
/**
|
|
1504
1504
|
* The event controller boundary. Reports a throw from an event handler and never replies, since a
|
|
1505
1505
|
* generic event has no reply target. A {@link Silence} or a non-reporting {@link Notice} stops quietly, a
|
|
@@ -1601,11 +1601,11 @@ var EventDispatcher = class {
|
|
|
1601
1601
|
utils.summary("Loaded", {
|
|
1602
1602
|
"event handlers": this.loadedHandlers.length,
|
|
1603
1603
|
middlewares: this.loadedMiddlewares.length
|
|
1604
|
-
});
|
|
1605
|
-
if (this.loadedMiddlewares.length > 0) utils.block("Loaded event middlewares", utils.entries(this.loadedMiddlewares));
|
|
1604
|
+
}, "debug");
|
|
1605
|
+
if (this.loadedMiddlewares.length > 0) utils.block("Loaded event middlewares", utils.entries(this.loadedMiddlewares), "debug");
|
|
1606
1606
|
const perEvent = {};
|
|
1607
1607
|
for (const [event, handlers] of this.eventMap) perEvent[event] = handlers.length;
|
|
1608
|
-
utils.block("Loaded event handlers", [...utils.entries(this.loadedHandlers), ...utils.counts(perEvent)]);
|
|
1608
|
+
utils.block("Loaded event handlers", [...utils.entries(this.loadedHandlers), ...utils.counts(perEvent)], "debug");
|
|
1609
1609
|
}
|
|
1610
1610
|
async loadHandlers(dir) {
|
|
1611
1611
|
await traverseDirectory(dir, (fullPath, relativePath, imported) => {
|
|
@@ -1655,14 +1655,10 @@ var EventDispatcher = class {
|
|
|
1655
1655
|
...metadata.events && { events: metadata.events }
|
|
1656
1656
|
});
|
|
1657
1657
|
this.middlewares.sort((a, b) => a.priority - b.priority);
|
|
1658
|
-
if (this.loading) {
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
});
|
|
1663
|
-
return;
|
|
1664
|
-
}
|
|
1665
|
-
this.logger.utils.registration(`${middlewareCtor.name} ${paint.mute(`(${metadata.priority})`)}`, relativePath, "event middleware");
|
|
1658
|
+
if (this.loading) this.loadedMiddlewares.push({
|
|
1659
|
+
name: `${middlewareCtor.name} (${metadata.priority})`,
|
|
1660
|
+
from: formatFilePath(relativePath)
|
|
1661
|
+
});
|
|
1666
1662
|
}
|
|
1667
1663
|
async runMiddlewares(eventName, args) {
|
|
1668
1664
|
for (const { ctor, events } of this.middlewares) {
|
|
@@ -1708,7 +1704,6 @@ var EventDispatcher = class {
|
|
|
1708
1704
|
name: handlerClass.name,
|
|
1709
1705
|
from
|
|
1710
1706
|
});
|
|
1711
|
-
else this.logger.utils.registration(handlerClass.name, from);
|
|
1712
1707
|
}
|
|
1713
1708
|
attachToClient() {
|
|
1714
1709
|
for (const [eventName] of this.eventMap) this.attachListener(eventName);
|
|
@@ -1757,7 +1752,8 @@ var EventDispatcher = class {
|
|
|
1757
1752
|
try {
|
|
1758
1753
|
this.logger.debug(`Processing ${paint.mint.bold(eventName)} with ${paint.mute(ctor.name)}`);
|
|
1759
1754
|
const handler = new ctor(args, this.core, eventName);
|
|
1760
|
-
|
|
1755
|
+
const eventCtx = eventGateContext(eventName, args, this.core);
|
|
1756
|
+
await runHandlerGates(ctor, eventCtx);
|
|
1761
1757
|
await handler.execute();
|
|
1762
1758
|
} catch (caught) {
|
|
1763
1759
|
handleEventFault(caught, String(eventName), ctor.name, args, this.core);
|
|
@@ -1795,7 +1791,7 @@ var UnhandledAutocomplete = class extends AutocompleteHandler {
|
|
|
1795
1791
|
*
|
|
1796
1792
|
* @internal
|
|
1797
1793
|
*/
|
|
1798
|
-
const HARMLESS_API_CODES = new Set([
|
|
1794
|
+
const HARMLESS_API_CODES = /* @__PURE__ */ new Set([
|
|
1799
1795
|
RESTJSONErrorCodes.UnknownInteraction,
|
|
1800
1796
|
RESTJSONErrorCodes.InteractionHasAlreadyBeenAcknowledged,
|
|
1801
1797
|
RESTJSONErrorCodes.UnknownMessage
|
|
@@ -1803,7 +1799,7 @@ const HARMLESS_API_CODES = new Set([
|
|
|
1803
1799
|
|
|
1804
1800
|
//#endregion
|
|
1805
1801
|
//#region src/bot/handleInteractionFault.ts
|
|
1806
|
-
const logger = new Logger("
|
|
1802
|
+
const logger = new Logger("Faults", { channel: "errors" });
|
|
1807
1803
|
/**
|
|
1808
1804
|
* The interaction controller boundary. Sorts a throw from any handler-lifecycle phase into the right
|
|
1809
1805
|
* user reply plus the right bus event. When a handler is built its sender is passed in, so the boundary
|
|
@@ -1971,8 +1967,8 @@ var InteractionDispatcher = class {
|
|
|
1971
1967
|
utils.summary("Loaded", {
|
|
1972
1968
|
"interaction handlers": this.loadedHandlers.length,
|
|
1973
1969
|
middlewares: this.loadedMiddlewares.length
|
|
1974
|
-
});
|
|
1975
|
-
if (this.loadedMiddlewares.length > 0) utils.block("Loaded middlewares", utils.entries(this.loadedMiddlewares));
|
|
1970
|
+
}, "debug");
|
|
1971
|
+
if (this.loadedMiddlewares.length > 0) utils.block("Loaded middlewares", utils.entries(this.loadedMiddlewares), "debug");
|
|
1976
1972
|
utils.block("Loaded interaction handlers", [...utils.entries(this.loadedHandlers), ...utils.counts({
|
|
1977
1973
|
slash: this.slashMap.size,
|
|
1978
1974
|
buttons: this.buttonMap.size,
|
|
@@ -1985,7 +1981,7 @@ var InteractionDispatcher = class {
|
|
|
1985
1981
|
"message menus": this.messageContextMenuMap.size,
|
|
1986
1982
|
"user menus": this.userContextMenuMap.size,
|
|
1987
1983
|
autocomplete: this.autocompleteMap.size
|
|
1988
|
-
})]);
|
|
1984
|
+
})], "debug");
|
|
1989
1985
|
}
|
|
1990
1986
|
async loadHandlers(dir) {
|
|
1991
1987
|
await traverseDirectory(dir, (fullPath, relativePath, imported) => {
|
|
@@ -2015,14 +2011,10 @@ var InteractionDispatcher = class {
|
|
|
2015
2011
|
priority: metadata.priority
|
|
2016
2012
|
});
|
|
2017
2013
|
this.middlewares.sort((a, b) => a.priority - b.priority);
|
|
2018
|
-
if (this.loading) {
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
});
|
|
2023
|
-
return;
|
|
2024
|
-
}
|
|
2025
|
-
this.logger.utils.registration(`${middlewareCtor.name} ${paint.mute(`(${metadata.priority})`)}`, relativePath, "middleware");
|
|
2014
|
+
if (this.loading) this.loadedMiddlewares.push({
|
|
2015
|
+
name: `${middlewareCtor.name} (${metadata.priority})`,
|
|
2016
|
+
from: formatFilePath(relativePath)
|
|
2017
|
+
});
|
|
2026
2018
|
}
|
|
2027
2019
|
isHandlerClass(obj) {
|
|
2028
2020
|
if (typeof obj !== "function") return false;
|
|
@@ -2055,7 +2047,6 @@ var InteractionDispatcher = class {
|
|
|
2055
2047
|
name: handlerClass.name,
|
|
2056
2048
|
from
|
|
2057
2049
|
});
|
|
2058
|
-
else this.logger.utils.registration(handlerClass.name, from);
|
|
2059
2050
|
}
|
|
2060
2051
|
/** @internal For use in dev mode */
|
|
2061
2052
|
async onHmr(event) {
|
|
@@ -2115,7 +2106,7 @@ var InteractionDispatcher = class {
|
|
|
2115
2106
|
const report = (outcome) => {
|
|
2116
2107
|
if (reported) return;
|
|
2117
2108
|
reported = true;
|
|
2118
|
-
this.core.bus
|
|
2109
|
+
reportDispatch(this.core.bus, {
|
|
2119
2110
|
routeId,
|
|
2120
2111
|
interactionId: interaction.id,
|
|
2121
2112
|
kind,
|
|
@@ -2123,7 +2114,7 @@ var InteractionDispatcher = class {
|
|
|
2123
2114
|
startedAt,
|
|
2124
2115
|
fallback: !matched,
|
|
2125
2116
|
queuedMs
|
|
2126
|
-
})
|
|
2117
|
+
});
|
|
2127
2118
|
};
|
|
2128
2119
|
let sender;
|
|
2129
2120
|
try {
|
|
@@ -2205,9 +2196,7 @@ var InteractionDispatcher = class {
|
|
|
2205
2196
|
case interaction.isAutocomplete():
|
|
2206
2197
|
await this.handleAutocomplete(interaction);
|
|
2207
2198
|
break;
|
|
2208
|
-
default:
|
|
2209
|
-
this.logger.warn(`Unhandled interaction type: ${interaction.type}`);
|
|
2210
|
-
break;
|
|
2199
|
+
default: this.logger.warn(`Unhandled interaction type: ${interaction.type}`);
|
|
2211
2200
|
}
|
|
2212
2201
|
}
|
|
2213
2202
|
async handleSlashCommand(interaction) {
|
|
@@ -2248,7 +2237,7 @@ var InteractionDispatcher = class {
|
|
|
2248
2237
|
};
|
|
2249
2238
|
|
|
2250
2239
|
//#endregion
|
|
2251
|
-
//#region \0@oxc-project+runtime@0.
|
|
2240
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/decorate.js
|
|
2252
2241
|
function __decorate(decorators, target, key, desc) {
|
|
2253
2242
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2254
2243
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2363,7 +2352,7 @@ __decorate([Envapt("DISCORD_BOT_TOKEN", { converter: (raw) => validateDiscordTok
|
|
|
2363
2352
|
//#endregion
|
|
2364
2353
|
//#region src/version.ts
|
|
2365
2354
|
/** Package version */
|
|
2366
|
-
const version = "0.1.
|
|
2355
|
+
const version = "0.1.1";
|
|
2367
2356
|
|
|
2368
2357
|
//#endregion
|
|
2369
2358
|
//#region src/Seedcord.ts
|
|
@@ -2415,7 +2404,7 @@ var Seedcord = class Seedcord extends Pluggable {
|
|
|
2415
2404
|
}
|
|
2416
2405
|
static reset() {
|
|
2417
2406
|
super.reset();
|
|
2418
|
-
LoggerChannelRegistry.instance.
|
|
2407
|
+
LoggerChannelRegistry.instance.configure({});
|
|
2419
2408
|
}
|
|
2420
2409
|
registerStartupTasks() {
|
|
2421
2410
|
if (Envapter.isDevelopment || Envapter.isTest) this.registerHmrAwareModules();
|