@seedcord/gateway 0.1.1 → 0.1.2
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 +9 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +13 -18
- package/dist/index.mjs +15 -76
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import { AnyCustomId, AutocompletableNames, BaseReplySender, ChoiceValueOf, EntryFor, FocusedField, GateFitsWith, HasComponentDefs, MatchArms, ModalLike, PageCursor, SingleParams, SlashOptions as SlashOptions$1 } from "@seedcord/core/internal";
|
|
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
|
+
import { ArraySource as ArraySource$1, AutocompleteOptions, BaseHandler as BaseHandler$1, 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";
|
|
4
4
|
import { Logger } from "@seedcord/logger";
|
|
5
5
|
import { APIInteractionGuildMember, APIModalInteractionResponseCallbackData, AnySelectMenuInteraction, ApplicationCommandOptionChoiceData, ApplicationCommandType, ApplicationEmoji, AutocompleteInteraction, BaseMessageOptions, BooleanCache, ButtonInteraction, ButtonStyle, CacheType, CacheTypeReducer, ChannelSelectMenuInteraction, ChatInputCommandInteraction, Client, ClientEvents, ClientOptions, CommandInteractionOption, ContextMenuCommandInteraction, Events, Guild, GuildEmoji, GuildMember, Interaction, MentionableSelectMenuInteraction, Message, MessageContextMenuCommandInteraction, ModalSubmitInteraction, Role, RoleSelectMenuInteraction, StringSelectMenuInteraction, TextChannel, User, UserContextMenuCommandInteraction, UserSelectMenuInteraction } from "discord.js";
|
|
6
6
|
import { Plugin as Plugin$1, PluginLifecycleSpec, PluginOptions, PluginOptions as PluginOptions$1 } from "@seedcord/core/plugin";
|
|
@@ -67,7 +67,7 @@ interface GatewayBotConfig extends BotConfig {
|
|
|
67
67
|
*/
|
|
68
68
|
interface GatewayConfig extends Config {
|
|
69
69
|
bot: GatewayBotConfig;
|
|
70
|
-
/** The gateway websocket requires a persistent process
|
|
70
|
+
/** The gateway websocket requires a persistent process. */
|
|
71
71
|
runtime?: 'server';
|
|
72
72
|
/**
|
|
73
73
|
* The health-check server. `false` disables it, `true` or omit for the defaults, an object
|
|
@@ -166,8 +166,7 @@ type NonModalInteraction = Exclude<Repliables, ModalSubmitInteraction>;
|
|
|
166
166
|
* The gateway base, fixes the core base's `TCore` to the gateway {@link Core} and adds the `getEvent`
|
|
167
167
|
* gate hook.
|
|
168
168
|
*/
|
|
169
|
-
declare abstract class BaseHandler
|
|
170
|
-
/** @internal */
|
|
169
|
+
declare abstract class BaseHandler<ValidEvent extends ValidEventTypes> extends BaseHandler$1<ValidEvent, Core> {
|
|
171
170
|
getEvent(): ValidEvent;
|
|
172
171
|
}
|
|
173
172
|
//#endregion
|
|
@@ -370,7 +369,7 @@ type EventMatchArms<Names extends ValidNonInteractionKeys, Ret> = { [Name in Nam
|
|
|
370
369
|
* }
|
|
371
370
|
* ```
|
|
372
371
|
*/
|
|
373
|
-
declare abstract class EventHandler<in out Names extends ValidNonInteractionKeys> extends BaseHandler
|
|
372
|
+
declare abstract class EventHandler<in out Names extends ValidNonInteractionKeys> extends BaseHandler<ClientEvents[Names]> {
|
|
374
373
|
private readonly firedEvent;
|
|
375
374
|
constructor(event: ClientEvents[Names], core: Core, eventName?: Names);
|
|
376
375
|
protected readonly event: SingleEventPayload<Names>;
|
|
@@ -414,7 +413,7 @@ declare abstract class EventHandler<in out Names extends ValidNonInteractionKeys
|
|
|
414
413
|
*
|
|
415
414
|
* @typeParam EventName - One or more `ClientEvents` keys. Defaults to every event (catchall).
|
|
416
415
|
*/
|
|
417
|
-
declare abstract class EventMiddleware<in out EventName extends ValidNonInteractionKeys = ValidNonInteractionKeys> extends BaseHandler
|
|
416
|
+
declare abstract class EventMiddleware<in out EventName extends ValidNonInteractionKeys = ValidNonInteractionKeys> extends BaseHandler<ClientEvents[EventName]> {
|
|
418
417
|
private readonly firedEvent;
|
|
419
418
|
constructor(event: ClientEvents[EventName], core: Core, eventName?: EventName);
|
|
420
419
|
protected readonly event: SingleEventPayload<EventName>;
|
|
@@ -568,12 +567,8 @@ interface EventGateContext<Names extends ValidNonInteractionKeys = ValidNonInter
|
|
|
568
567
|
type GateContext = InteractionGateContext | EventGateContext;
|
|
569
568
|
//#endregion
|
|
570
569
|
//#region src/bot/ReplySender.d.ts
|
|
571
|
-
/** The created message a gateway reply resolves to. */
|
|
572
570
|
type SentMessage = Message;
|
|
573
|
-
/**
|
|
574
|
-
* Writes interaction responses through the discord.js interaction. Construction is internal to the repliable
|
|
575
|
-
* handler bases and the dispatcher.
|
|
576
|
-
*/
|
|
571
|
+
/** Writes interaction responses through discord.js. The repliable handler bases and the dispatcher construct it. */
|
|
577
572
|
declare class ReplySender extends BaseReplySender<SentMessage, GatewayFile> {
|
|
578
573
|
private readonly interaction;
|
|
579
574
|
constructor(interaction: Repliables, routeId: string, bus: Bus);
|
|
@@ -687,7 +682,7 @@ declare function Gated<const Gates extends NonEmptyTuple<Gate<GateContextBase>>>
|
|
|
687
682
|
*
|
|
688
683
|
* @typeParam Repliable - The interaction type this middleware processes
|
|
689
684
|
*/
|
|
690
|
-
declare abstract class InteractionMiddleware<Repliable extends Repliables> extends BaseHandler
|
|
685
|
+
declare abstract class InteractionMiddleware<Repliable extends Repliables> extends BaseHandler<Repliable> {
|
|
691
686
|
constructor(event: Repliable, core: Core);
|
|
692
687
|
}
|
|
693
688
|
//#endregion
|
|
@@ -833,7 +828,7 @@ type FocusedArms<Route extends keyof SlashOptionRegistry, Ret> = { [Name in Auto
|
|
|
833
828
|
* }
|
|
834
829
|
* ```
|
|
835
830
|
*/
|
|
836
|
-
declare abstract class AutocompleteHandler<Route extends keyof SlashOptionRegistry, Cache extends CacheType = 'cached'> extends BaseHandler
|
|
831
|
+
declare abstract class AutocompleteHandler<Route extends keyof SlashOptionRegistry, Cache extends CacheType = 'cached'> extends BaseHandler<AutocompleteInteraction<Cache>> {
|
|
837
832
|
/** @internal */
|
|
838
833
|
readonly __autocompleteRoute?: Route;
|
|
839
834
|
constructor(event: AutocompleteInteraction<Cache>, core: Core, dispatch?: DispatchContext);
|
|
@@ -844,8 +839,8 @@ declare abstract class AutocompleteHandler<Route extends keyof SlashOptionRegist
|
|
|
844
839
|
*/
|
|
845
840
|
protected get focused(): FocusedField<Route>;
|
|
846
841
|
/**
|
|
847
|
-
* Run the arm for the focused field.
|
|
848
|
-
* match is how you read it. There is no single-field shortcut the way slash/component handlers have one.
|
|
842
|
+
* Run the arm for the focused field. Because an autocomplete always dispatches by which field is
|
|
843
|
+
* focused, match is how you read it. There is no single-field shortcut the way slash/component handlers have one.
|
|
849
844
|
*
|
|
850
845
|
* Provide one arm per autocompletable field across the registered commands, keyed by field name. Each
|
|
851
846
|
* arm receives the focused partial value and a `respond` typed to that field's choice value. The
|
|
@@ -907,13 +902,13 @@ declare abstract class ComponentHandler<Event extends ComponentInteraction, Defs
|
|
|
907
902
|
* Reading this decodes `this.event.customId` once (cached after the first read) and throws
|
|
908
903
|
* `StaleCustomId` or `InvalidCustomId` when the wire no longer matches the current shape, which the
|
|
909
904
|
* controller boundary turns into a reply. On a handler registered for several routes this is
|
|
910
|
-
* `never
|
|
905
|
+
* `never`. Use {@link match} instead.
|
|
911
906
|
*/
|
|
912
907
|
protected get params(): SingleParams<Defs>;
|
|
913
908
|
/**
|
|
914
909
|
* Run the arm for whichever route the component was minted from. Use this only when the handler is
|
|
915
910
|
* registered for several routes. A single-route handler reads `this.params` directly. On a multi-route
|
|
916
|
-
* handler `this.params` is `never`,
|
|
911
|
+
* handler `this.params` is `never`, leaving match as the only way to read the decoded params.
|
|
917
912
|
*
|
|
918
913
|
* Provide one arm per registered route, keyed by its prefix, and each arm receives that route's own
|
|
919
914
|
* decoded params. The arms cover every registered route prefix, checked at compile time, and a prefix
|
|
@@ -1528,5 +1523,5 @@ declare class Seedcord extends Pluggable<'gateway', 'server'> implements Core, S
|
|
|
1528
1523
|
/** Package version */
|
|
1529
1524
|
declare const version: string;
|
|
1530
1525
|
//#endregion
|
|
1531
|
-
export { ArraySource, AssignRoleNoticeOverrides, AutocompleteHandler, ButtonHandler, type CheckPermissionOptions, type ConfirmOptions, ContextMenuHandler, type Core, CursorSource, type DefaultConfirmOptions, Emojis, type EventGateContext, EventHandler, EventMiddleware, type EventSpec, type EventsConfig, type GateContext, Gated, type GatewayBotConfig, type GatewayConfig, type GatewayFile, type GatewayPluginOptions, type GatewayReplyResponse, HasPermsToAssignOptions, IgnoreBots, type InjectedEmojiMap, type InteractionGateContext, InteractionHandler, InteractionMiddleware, Middleware, type MiddlewareOptions, MiddlewareType, ModalHandler, Nsfw, type PageContext, Paginator, Plugin, type PluginLifecycleSpec, type PluginOptions, RegisterEvent, type RegisterEventOptions, RepliableHandler, type Repliables, Seedcord, SelectMenuHandler, SlashHandler, type SlashOptions, Subscriber, type ValidEventTypes, type ValidInteractionTypes, type ValidNonInteractionKeys, WebhookLog, checkBotPermissions, checkPermissions, getConfirmation, hasPermsToAssign, version };
|
|
1526
|
+
export { ArraySource, AssignRoleNoticeOverrides, AutocompleteHandler, BaseHandler, ButtonHandler, type CheckPermissionOptions, type ConfirmOptions, ContextMenuHandler, type Core, CursorSource, type DefaultConfirmOptions, Emojis, type EventGateContext, EventHandler, EventMiddleware, type EventSpec, type EventsConfig, type GateContext, Gated, type GatewayBotConfig, type GatewayConfig, type GatewayFile, type GatewayPluginOptions, type GatewayReplyResponse, HasPermsToAssignOptions, IgnoreBots, type InjectedEmojiMap, type InteractionGateContext, InteractionHandler, InteractionMiddleware, Middleware, type MiddlewareOptions, MiddlewareType, ModalHandler, Nsfw, type PageContext, Paginator, Plugin, type PluginLifecycleSpec, type PluginOptions, RegisterEvent, type RegisterEventOptions, RepliableHandler, type Repliables, Seedcord, SelectMenuHandler, SlashHandler, type SlashOptions, Subscriber, type ValidEventTypes, type ValidInteractionTypes, type ValidNonInteractionKeys, WebhookLog, checkBotPermissions, checkPermissions, getConfirmation, hasPermsToAssign, version };
|
|
1532
1527
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { installNodeDefaults } from "@seedcord/logger/node";
|
|
|
3
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
|
-
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";
|
|
6
|
+
import { ArraySource as ArraySource$1, BaseHandler as BaseHandler$1, 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";
|
|
7
7
|
import { Logger, LoggerChannelRegistry, paint } from "@seedcord/logger";
|
|
8
8
|
import { ButtonStyle, Client, ComponentType, DiscordAPIError, Events, Guild, GuildMember, Message, MessageFlags, PermissionFlagsBits, RESTJSONErrorCodes, Role, User } from "discord.js";
|
|
9
9
|
import { ButtonBuilder, TextDisplayBuilder } from "@discordjs/builders";
|
|
@@ -266,12 +266,6 @@ const emojiStorage = accessorStore();
|
|
|
266
266
|
* A read before that throws.
|
|
267
267
|
*/
|
|
268
268
|
const Emojis = guardedAccessor("Emojis", emojiStorage);
|
|
269
|
-
/**
|
|
270
|
-
* Loads and injects emojis based on bot configuration. A guild emoji requires the Guilds intent in the client
|
|
271
|
-
* options.
|
|
272
|
-
*
|
|
273
|
-
* @internal
|
|
274
|
-
*/
|
|
275
269
|
var EmojiInjector = class {
|
|
276
270
|
core;
|
|
277
271
|
logger = new Logger("Emojis", { channel: "bot" });
|
|
@@ -435,12 +429,6 @@ function hasPermsToAssign(roleOrOptions) {
|
|
|
435
429
|
//#endregion
|
|
436
430
|
//#region src/bot/confirm/reserved.ts
|
|
437
431
|
const RESERVED_CONFIRM_PREFIX = "__seedcord_confirm";
|
|
438
|
-
/**
|
|
439
|
-
* The reserved confirm/cancel codec. It has no route, so the dispatcher ignores its clicks and only the
|
|
440
|
-
* in-process collector reads them. Do not mint a real component from it.
|
|
441
|
-
*
|
|
442
|
-
* @internal
|
|
443
|
-
*/
|
|
444
432
|
const CONFIRM_DEF = new CustomId(RESERVED_CONFIRM_PREFIX).oneOf("choice", ["confirm", "cancel"]);
|
|
445
433
|
|
|
446
434
|
//#endregion
|
|
@@ -506,8 +494,7 @@ async function getConfirmation(handler, prompt, options) {
|
|
|
506
494
|
* The gateway base, fixes the core base's `TCore` to the gateway {@link Core} and adds the `getEvent`
|
|
507
495
|
* gate hook.
|
|
508
496
|
*/
|
|
509
|
-
var BaseHandler
|
|
510
|
-
/** @internal */
|
|
497
|
+
var BaseHandler = class extends BaseHandler$1 {
|
|
511
498
|
getEvent() {
|
|
512
499
|
return this.event;
|
|
513
500
|
}
|
|
@@ -523,7 +510,7 @@ var BaseHandler$1 = class extends BaseHandler {
|
|
|
523
510
|
*
|
|
524
511
|
* @typeParam Repliable - The interaction type this middleware processes
|
|
525
512
|
*/
|
|
526
|
-
var InteractionMiddleware = class extends BaseHandler
|
|
513
|
+
var InteractionMiddleware = class extends BaseHandler {
|
|
527
514
|
constructor(event, core) {
|
|
528
515
|
super(event, core, void 0, "interactions");
|
|
529
516
|
}
|
|
@@ -549,10 +536,7 @@ function seedState(interaction) {
|
|
|
549
536
|
if (interaction.deferred) return "deferred-reply";
|
|
550
537
|
return "unacked";
|
|
551
538
|
}
|
|
552
|
-
/**
|
|
553
|
-
* Writes interaction responses through the discord.js interaction. Construction is internal to the repliable
|
|
554
|
-
* handler bases and the dispatcher.
|
|
555
|
-
*/
|
|
539
|
+
/** Writes interaction responses through discord.js. The repliable handler bases and the dispatcher construct it. */
|
|
556
540
|
var ReplySender = class extends BaseReplySender {
|
|
557
541
|
interaction;
|
|
558
542
|
constructor(interaction, routeId, bus) {
|
|
@@ -698,13 +682,6 @@ var InteractionHandler = class extends RepliableHandler {
|
|
|
698
682
|
|
|
699
683
|
//#endregion
|
|
700
684
|
//#region src/bot/utilities/miscellaneous/slashRouteOf.ts
|
|
701
|
-
/**
|
|
702
|
-
* Computes the dispatch route for a chat-input or autocomplete interaction. The controller and
|
|
703
|
-
* `seedcord codegen` both assemble route keys through the same {@link buildSlashRoute}, so a dispatched
|
|
704
|
-
* interaction and a generated registry key always match.
|
|
705
|
-
*
|
|
706
|
-
* @internal
|
|
707
|
-
*/
|
|
708
685
|
function slashRouteOf(interaction) {
|
|
709
686
|
const group = interaction.options.getSubcommandGroup(false) ?? void 0;
|
|
710
687
|
const subcommand = interaction.options.getSubcommand(false) ?? void 0;
|
|
@@ -836,7 +813,7 @@ var ContextMenuHandler = class extends InteractionHandler {
|
|
|
836
813
|
* }
|
|
837
814
|
* ```
|
|
838
815
|
*/
|
|
839
|
-
var AutocompleteHandler = class extends BaseHandler
|
|
816
|
+
var AutocompleteHandler = class extends BaseHandler {
|
|
840
817
|
constructor(event, core, dispatch) {
|
|
841
818
|
super(event, core, dispatch, "interactions");
|
|
842
819
|
}
|
|
@@ -856,8 +833,8 @@ var AutocompleteHandler = class extends BaseHandler$1 {
|
|
|
856
833
|
return focused;
|
|
857
834
|
}
|
|
858
835
|
/**
|
|
859
|
-
* Run the arm for the focused field.
|
|
860
|
-
* match is how you read it. There is no single-field shortcut the way slash/component handlers have one.
|
|
836
|
+
* Run the arm for the focused field. Because an autocomplete always dispatches by which field is
|
|
837
|
+
* focused, match is how you read it. There is no single-field shortcut the way slash/component handlers have one.
|
|
861
838
|
*
|
|
862
839
|
* Provide one arm per autocompletable field across the registered commands, keyed by field name. Each
|
|
863
840
|
* arm receives the focused partial value and a `respond` typed to that field's choice value. The
|
|
@@ -940,7 +917,7 @@ var ComponentHandler = class extends InteractionHandler {
|
|
|
940
917
|
* Reading this decodes `this.event.customId` once (cached after the first read) and throws
|
|
941
918
|
* `StaleCustomId` or `InvalidCustomId` when the wire no longer matches the current shape, which the
|
|
942
919
|
* controller boundary turns into a reply. On a handler registered for several routes this is
|
|
943
|
-
* `never
|
|
920
|
+
* `never`. Use {@link match} instead.
|
|
944
921
|
*/
|
|
945
922
|
get params() {
|
|
946
923
|
return this.route.params;
|
|
@@ -948,7 +925,7 @@ var ComponentHandler = class extends InteractionHandler {
|
|
|
948
925
|
/**
|
|
949
926
|
* Run the arm for whichever route the component was minted from. Use this only when the handler is
|
|
950
927
|
* registered for several routes. A single-route handler reads `this.params` directly. On a multi-route
|
|
951
|
-
* handler `this.params` is `never`,
|
|
928
|
+
* handler `this.params` is `never`, leaving match as the only way to read the decoded params.
|
|
952
929
|
*
|
|
953
930
|
* Provide one arm per registered route, keyed by its prefix, and each arm receives that route's own
|
|
954
931
|
* decoded params. The arms cover every registered route prefix, checked at compile time, and a prefix
|
|
@@ -1098,7 +1075,7 @@ var SelectMenuHandler = class extends ComponentHandler {};
|
|
|
1098
1075
|
* }
|
|
1099
1076
|
* ```
|
|
1100
1077
|
*/
|
|
1101
|
-
var EventHandler = class extends BaseHandler
|
|
1078
|
+
var EventHandler = class extends BaseHandler {
|
|
1102
1079
|
firedEvent;
|
|
1103
1080
|
constructor(event, core, eventName) {
|
|
1104
1081
|
super(event, core, void 0, "events");
|
|
@@ -1151,7 +1128,7 @@ var EventHandler = class extends BaseHandler$1 {
|
|
|
1151
1128
|
*
|
|
1152
1129
|
* @typeParam EventName - One or more `ClientEvents` keys. Defaults to every event (catchall).
|
|
1153
1130
|
*/
|
|
1154
|
-
var EventMiddleware = class extends BaseHandler
|
|
1131
|
+
var EventMiddleware = class extends BaseHandler {
|
|
1155
1132
|
firedEvent;
|
|
1156
1133
|
constructor(event, core, eventName) {
|
|
1157
1134
|
super(event, core, void 0, "events");
|
|
@@ -1352,14 +1329,6 @@ function eventGateContext(eventName, args, core) {
|
|
|
1352
1329
|
//#endregion
|
|
1353
1330
|
//#region src/miscellaneous/extractErrorResponse.ts
|
|
1354
1331
|
const logger$2 = new Logger("ErrorsHandling", { channel: "errors" });
|
|
1355
|
-
/**
|
|
1356
|
-
* Processes an error into a user-facing reply and routes its report.
|
|
1357
|
-
*
|
|
1358
|
-
* A {@link Notice} always renders its own reply. A reporting denial (`report: true`) additionally
|
|
1359
|
-
* publishes `handledException` on the interaction path. A raw, non-denial throw publishes
|
|
1360
|
-
* `unknownException` and renders the configured `defaultError` (or a generic {@link Fault}). One uuid is
|
|
1361
|
-
* threaded into both the reply and the bus payload.
|
|
1362
|
-
*/
|
|
1363
1332
|
function extractErrorResponse(error, core, origin) {
|
|
1364
1333
|
const uuid = crypto.randomUUID();
|
|
1365
1334
|
const developerUsername = core.config.notifications?.developerUsername;
|
|
@@ -1500,13 +1469,6 @@ function interactionKind(interaction) {
|
|
|
1500
1469
|
//#endregion
|
|
1501
1470
|
//#region src/bot/handleEventFault.ts
|
|
1502
1471
|
const logger$1 = new Logger("Faults", { channel: "errors" });
|
|
1503
|
-
/**
|
|
1504
|
-
* The event controller boundary. Reports a throw from an event handler and never replies, since a
|
|
1505
|
-
* generic event has no reply target. A {@link Silence} or a non-reporting {@link Notice} stops quietly, a
|
|
1506
|
-
* reporting denial or a raw error publishes a fault with a best-effort actor derived from the args.
|
|
1507
|
-
*
|
|
1508
|
-
* @internal
|
|
1509
|
-
*/
|
|
1510
1472
|
function handleEventFault(caught, eventName, handlerName, args, core) {
|
|
1511
1473
|
if (caught instanceof Silence) {
|
|
1512
1474
|
if (caught.reason !== void 0 && (core.config.errors?.logSilences ?? true)) logger$1.debug(`Silence: ${caught.reason}`);
|
|
@@ -1535,9 +1497,7 @@ function handleEventFault(caught, eventName, handlerName, args, core) {
|
|
|
1535
1497
|
//#endregion
|
|
1536
1498
|
//#region src/bot/controllers/EventDispatcher.ts
|
|
1537
1499
|
/**
|
|
1538
|
-
*
|
|
1539
|
-
* handlers for each fire. Interactions route through InteractionDispatcher. Multiple handlers can
|
|
1540
|
-
* point to one event.
|
|
1500
|
+
* Interactions route through InteractionDispatcher.
|
|
1541
1501
|
*
|
|
1542
1502
|
* @internal
|
|
1543
1503
|
*/
|
|
@@ -1625,7 +1585,7 @@ var EventDispatcher = class {
|
|
|
1625
1585
|
}
|
|
1626
1586
|
});
|
|
1627
1587
|
}
|
|
1628
|
-
/** @internal
|
|
1588
|
+
/** @internal */
|
|
1629
1589
|
async onHmr(event) {
|
|
1630
1590
|
await this.hmrHandler?.handle(event);
|
|
1631
1591
|
}
|
|
@@ -1763,9 +1723,6 @@ var EventDispatcher = class {
|
|
|
1763
1723
|
|
|
1764
1724
|
//#endregion
|
|
1765
1725
|
//#region src/bot/defaults/UnhandledRepliable.ts
|
|
1766
|
-
/**
|
|
1767
|
-
* @internal Default handler for unhandled repliable interactions.
|
|
1768
|
-
*/
|
|
1769
1726
|
var UnhandledRepliable = class extends InteractionHandler {
|
|
1770
1727
|
async execute() {
|
|
1771
1728
|
await this.reply("Feature not implemented yet.");
|
|
@@ -1774,9 +1731,6 @@ var UnhandledRepliable = class extends InteractionHandler {
|
|
|
1774
1731
|
|
|
1775
1732
|
//#endregion
|
|
1776
1733
|
//#region src/bot/defaults/UnhandledAutocomplete.ts
|
|
1777
|
-
/**
|
|
1778
|
-
* @internal Default handler for an autocomplete with no registered handler.
|
|
1779
|
-
*/
|
|
1780
1734
|
var UnhandledAutocomplete = class extends AutocompleteHandler {
|
|
1781
1735
|
async execute() {
|
|
1782
1736
|
await this.respond([]);
|
|
@@ -1800,14 +1754,6 @@ const HARMLESS_API_CODES = /* @__PURE__ */ new Set([
|
|
|
1800
1754
|
//#endregion
|
|
1801
1755
|
//#region src/bot/handleInteractionFault.ts
|
|
1802
1756
|
const logger = new Logger("Faults", { channel: "errors" });
|
|
1803
|
-
/**
|
|
1804
|
-
* The interaction controller boundary. Sorts a throw from any handler-lifecycle phase into the right
|
|
1805
|
-
* user reply plus the right bus event. When a handler is built its sender is passed in, so the boundary
|
|
1806
|
-
* sends from the current ack state. A middleware or pre-construction throw arrives with no sender, so the
|
|
1807
|
-
* boundary builds one from the interaction flags.
|
|
1808
|
-
*
|
|
1809
|
-
* @internal
|
|
1810
|
-
*/
|
|
1811
1757
|
async function handleInteractionFault(caught, interaction, core, routeId, sender) {
|
|
1812
1758
|
if (caught instanceof Silence) {
|
|
1813
1759
|
if (caught.reason !== void 0 && (core.config.errors?.logSilences ?? true)) logger.debug(`Silence: ${caught.reason}`);
|
|
@@ -1862,12 +1808,6 @@ async function sendGuarded(sender, response, ephemeral) {
|
|
|
1862
1808
|
|
|
1863
1809
|
//#endregion
|
|
1864
1810
|
//#region src/bot/controllers/InteractionDispatcher.ts
|
|
1865
|
-
/**
|
|
1866
|
-
* Scans handler directories, routes each interaction to its registered handler, and runs the handler.
|
|
1867
|
-
* One handler per interaction.
|
|
1868
|
-
*
|
|
1869
|
-
* @internal
|
|
1870
|
-
*/
|
|
1871
1811
|
var InteractionDispatcher = class {
|
|
1872
1812
|
core;
|
|
1873
1813
|
logger = new Logger("Interactions", { channel: "interactions" });
|
|
@@ -2048,7 +1988,6 @@ var InteractionDispatcher = class {
|
|
|
2048
1988
|
from
|
|
2049
1989
|
});
|
|
2050
1990
|
}
|
|
2051
|
-
/** @internal For use in dev mode */
|
|
2052
1991
|
async onHmr(event) {
|
|
2053
1992
|
await this.hmrHandler?.handle(event);
|
|
2054
1993
|
}
|
|
@@ -2352,7 +2291,7 @@ __decorate([Envapt("DISCORD_BOT_TOKEN", { converter: (raw) => validateDiscordTok
|
|
|
2352
2291
|
//#endregion
|
|
2353
2292
|
//#region src/version.ts
|
|
2354
2293
|
/** Package version */
|
|
2355
|
-
const version = "0.1.
|
|
2294
|
+
const version = "0.1.2";
|
|
2356
2295
|
|
|
2357
2296
|
//#endregion
|
|
2358
2297
|
//#region src/Seedcord.ts
|
|
@@ -2451,5 +2390,5 @@ var Seedcord = class Seedcord extends Pluggable {
|
|
|
2451
2390
|
};
|
|
2452
2391
|
|
|
2453
2392
|
//#endregion
|
|
2454
|
-
export { ArraySource, AutocompleteHandler, ButtonHandler, ContextMenuHandler, CursorSource, Emojis, EventHandler, EventMiddleware, Gated, IgnoreBots, InteractionHandler, InteractionMiddleware, Middleware, MiddlewareType, ModalHandler, Nsfw, Paginator, Plugin, RegisterEvent, RepliableHandler, Seedcord, SelectMenuHandler, SlashHandler, Subscriber, WebhookLog, checkBotPermissions, checkPermissions, getConfirmation, hasPermsToAssign, version };
|
|
2393
|
+
export { ArraySource, AutocompleteHandler, BaseHandler, ButtonHandler, ContextMenuHandler, CursorSource, Emojis, EventHandler, EventMiddleware, Gated, IgnoreBots, InteractionHandler, InteractionMiddleware, Middleware, MiddlewareType, ModalHandler, Nsfw, Paginator, Plugin, RegisterEvent, RepliableHandler, Seedcord, SelectMenuHandler, SlashHandler, Subscriber, WebhookLog, checkBotPermissions, checkPermissions, getConfirmation, hasPermsToAssign, version };
|
|
2455
2394
|
//# sourceMappingURL=index.mjs.map
|