@seedcord/http 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{RouteManifest-DTxI4fS0.d.mts → RouteManifest-D7qXj8Ts.d.mts} +3 -3
- package/dist/{edge.index-B4x6VSJl.mjs → edge.index-CWUU_d_X.mjs} +172 -85
- package/dist/edge.index-CWUU_d_X.mjs.map +1 -0
- package/dist/{edge.index-LQtTs595.d.mts → edge.index-LAWTa6NI.d.mts} +153 -53
- package/dist/edge.index.d.mts +3 -3
- package/dist/edge.index.mjs +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +30 -84
- package/dist/index.mjs.map +1 -1
- package/dist/manifest.index.d.mts +1 -1
- package/package.json +16 -15
- package/dist/edge.index-B4x6VSJl.mjs.map +0 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { t as RouteManifest } from "./RouteManifest-
|
|
1
|
+
import { t as RouteManifest } from "./RouteManifest-D7qXj8Ts.mjs";
|
|
2
2
|
import "reflect-metadata";
|
|
3
|
-
import { AutocompletableNames, AutocompleteRouteBrand, ChoiceValueOf, ComponentDefsBrand, ComponentKindBrand, ContextMenuKindBrand, ContextMenuNamesBrand, EntryFor, FocusedField, GateFitsWith, HasComponentDefs,
|
|
3
|
+
import { AutocompletableNames, AutocompleteRouteBrand, ChoiceValueOf, ComponentDefsBrand, ComponentKindBrand, ContextMenuKindBrand, ContextMenuNamesBrand, EntryFor, FocusedField, GateFitsWith, HasComponentDefs, MatchArms, NamesFor, PageCursor, SingleParams, SlashOptions, SlashRouteBrand } from "@seedcord/core/internal";
|
|
4
4
|
import { REST } from "@discordjs/rest";
|
|
5
|
-
import { ArraySourceBase, AutocompleteOptions, BaseHandler, BaseReplySender, Bus, CoreBase, CursorSourceBase, DispatchContext, Gate, GateContextBase, GuildPermissionsContext, ModalLike, PageSourceBase, PaginatorBase, PaginatorConfig, RepliableHandler, RequiredOf, ResolvedEmoji,
|
|
5
|
+
import { ArraySourceBase, AutocompleteOptions, BaseHandler, BaseReplySender, Bus, CoreBase, CursorSourceBase, DispatchContext, Gate, GateContextBase, GuildPermissionsContext, InteractionKind, ModalLike, PageSourceBase, PaginatorBase, PaginatorConfig, RepliableHandler, RequiredOf, ResolvedEmoji, SlashRegistry, Subscriber, SubscriptionKey, WebhookLog } from "@seedcord/core";
|
|
6
6
|
import { APIApplicationCommandAutocompleteInteraction, APIApplicationCommandOptionChoice, APIAttachment, APIChatInputApplicationCommandInteraction, APIContextMenuInteraction, APIInteraction, APIInteractionDataResolvedChannel, APIInteractionDataResolvedChannelBase, APIInteractionDataResolvedGuildMember, APIInteractionGuildMember, APIMessage, APIMessageApplicationCommandInteraction, APIMessageChannelSelectInteractionData, APIMessageComponentButtonInteraction, APIMessageComponentInteraction, APIMessageComponentSelectMenuInteraction, APIMessageMentionableSelectInteractionData, APIMessageRoleSelectInteractionData, APIMessageStringSelectInteractionData, APIMessageUserSelectInteractionData, APIModalInteractionResponseCallbackData, APIModalSubmission, APIModalSubmitInteraction, APIRole, APIThreadChannel, APIUser, APIUserApplicationCommandInteraction, ApplicationCommandType, ChannelType, ModalSubmitComponent, ThreadChannelType } from "discord-api-types/v10";
|
|
7
7
|
import { API } from "@discordjs/core/http-only";
|
|
8
8
|
import { AnyCustomId } from "@seedcord/custom-id";
|
|
9
|
+
import { Collection } from "@discordjs/collection";
|
|
9
10
|
import { CoordinatedShutdown, CoordinatedStartup } from "@seedcord/core/node";
|
|
10
11
|
import { Config, DeferOpts, EmojiMap, ReplyResponse, SendOpts } from "@seedcord/types";
|
|
11
12
|
import { NonEmptyTuple, Promisable } from "type-fest";
|
|
@@ -39,6 +40,7 @@ interface HttpServerConfig extends Config {
|
|
|
39
40
|
interface HttpEdgeConfig extends Config {
|
|
40
41
|
runtime: 'edge';
|
|
41
42
|
port?: never;
|
|
43
|
+
lifecycle?: never;
|
|
42
44
|
}
|
|
43
45
|
/**
|
|
44
46
|
* The http transport's configuration, discriminated on `runtime`.
|
|
@@ -120,9 +122,9 @@ type SlashOptions$1<Route extends keyof SlashRegistry> = SlashOptions<Route, Htt
|
|
|
120
122
|
type FieldKind = ModalSubmitComponent['type'];
|
|
121
123
|
/** The users, members, and roles a mentionable select picked. */
|
|
122
124
|
interface SelectedMentionables {
|
|
123
|
-
users:
|
|
124
|
-
members:
|
|
125
|
-
roles:
|
|
125
|
+
users: Collection<string, APIUser>;
|
|
126
|
+
members: Collection<string, APIInteractionDataResolvedGuildMember>;
|
|
127
|
+
roles: Collection<string, APIRole>;
|
|
126
128
|
}
|
|
127
129
|
/**
|
|
128
130
|
* The fields a modal carries, read by custom id.
|
|
@@ -131,7 +133,7 @@ interface SelectedMentionables {
|
|
|
131
133
|
* kind that getter does not read. The message names the getter that does.
|
|
132
134
|
*
|
|
133
135
|
* A select getter resolves the ids its field picked against the interaction's `resolved` data and returns a
|
|
134
|
-
* `
|
|
136
|
+
* `Collection` keyed by id. A field that picked nothing returns null. Pass `required` to throw there instead.
|
|
135
137
|
*/
|
|
136
138
|
declare class ModalFields {
|
|
137
139
|
private readonly entries;
|
|
@@ -152,19 +154,19 @@ declare class ModalFields {
|
|
|
152
154
|
getField(customId: string): ModalSubmitComponent;
|
|
153
155
|
getTextInputValue(customId: string): string;
|
|
154
156
|
getStringSelectValues(customId: string): string[];
|
|
155
|
-
getSelectedUsers(customId: string, required: true):
|
|
156
|
-
getSelectedUsers(customId: string, required?: boolean):
|
|
157
|
+
getSelectedUsers(customId: string, required: true): Collection<string, APIUser>;
|
|
158
|
+
getSelectedUsers(customId: string, required?: boolean): Collection<string, APIUser> | null;
|
|
157
159
|
/** The guild members behind the picked users. Discord resolves these only inside a guild. */
|
|
158
|
-
getSelectedMembers(customId: string):
|
|
159
|
-
getSelectedRoles(customId: string, required: true):
|
|
160
|
-
getSelectedRoles(customId: string, required?: boolean):
|
|
160
|
+
getSelectedMembers(customId: string): Collection<string, APIInteractionDataResolvedGuildMember> | null;
|
|
161
|
+
getSelectedRoles(customId: string, required: true): Collection<string, APIRole>;
|
|
162
|
+
getSelectedRoles(customId: string, required?: boolean): Collection<string, APIRole> | null;
|
|
161
163
|
/** Pass `channelTypes` to throw when a pick falls outside those types. */
|
|
162
|
-
getSelectedChannels(customId: string, required: true, channelTypes?: readonly ChannelType[]):
|
|
163
|
-
getSelectedChannels(customId: string, required?: boolean, channelTypes?: readonly ChannelType[]):
|
|
164
|
+
getSelectedChannels(customId: string, required: true, channelTypes?: readonly ChannelType[]): Collection<string, APIInteractionDataResolvedChannel>;
|
|
165
|
+
getSelectedChannels(customId: string, required?: boolean, channelTypes?: readonly ChannelType[]): Collection<string, APIInteractionDataResolvedChannel> | null;
|
|
164
166
|
getSelectedMentionables(customId: string, required: true): SelectedMentionables;
|
|
165
167
|
getSelectedMentionables(customId: string, required?: boolean): SelectedMentionables | null;
|
|
166
|
-
getUploadedFiles(customId: string, required: true):
|
|
167
|
-
getUploadedFiles(customId: string, required?: boolean):
|
|
168
|
+
getUploadedFiles(customId: string, required: true): Collection<string, APIAttachment>;
|
|
169
|
+
getUploadedFiles(customId: string, required?: boolean): Collection<string, APIAttachment> | null;
|
|
168
170
|
getRadioGroup(customId: string, required: true): string;
|
|
169
171
|
getRadioGroup(customId: string, required?: boolean): string | null;
|
|
170
172
|
getCheckboxGroup(customId: string): string[];
|
|
@@ -222,8 +224,8 @@ type Repliables = Exclude<ValidInteractionTypes, APIApplicationCommandAutocomple
|
|
|
222
224
|
* Shared base the repliable HTTP interaction handlers extend.
|
|
223
225
|
*
|
|
224
226
|
* Not a public entry point. Extend {@link SlashHandler}, {@link ButtonHandler}, {@link ModalHandler},
|
|
225
|
-
* {@link
|
|
226
|
-
* to the http sender.
|
|
227
|
+
* {@link ContextMenuHandler}, or one of the select menu bases instead. This class binds the core
|
|
228
|
+
* reply base to the http sender.
|
|
227
229
|
*
|
|
228
230
|
* @typeParam Event - The repliable interaction type this handler processes
|
|
229
231
|
*/
|
|
@@ -244,8 +246,8 @@ declare abstract class RepliableHandler$1<Event extends Repliables> extends Repl
|
|
|
244
246
|
* Shared base the repliable interaction handlers extend.
|
|
245
247
|
*
|
|
246
248
|
* Not a public entry point. Extend {@link SlashHandler}, {@link ContextMenuHandler}, {@link ButtonHandler},
|
|
247
|
-
* {@link
|
|
248
|
-
* reply members.
|
|
249
|
+
* {@link ModalHandler}, or one of the select menu bases instead. This class adds `showModal` on top
|
|
250
|
+
* of the reply members.
|
|
249
251
|
*
|
|
250
252
|
* @typeParam Event - The repliable interaction type this handler processes
|
|
251
253
|
*/
|
|
@@ -443,9 +445,9 @@ declare abstract class AutocompleteHandler<Route extends keyof SlashRegistry> ex
|
|
|
443
445
|
/**
|
|
444
446
|
* Shared base the customId-routed component handlers extend on the HTTP transport.
|
|
445
447
|
*
|
|
446
|
-
* Not a public entry point. Extend {@link ButtonHandler}, {@link
|
|
447
|
-
* instead. This class defines the customId decode, the route matching, and the source-message
|
|
448
|
-
* `update` and `deferUpdate`.
|
|
448
|
+
* Not a public entry point. Extend {@link ButtonHandler}, {@link ModalHandler}, or one of the select menu
|
|
449
|
+
* bases instead. This class defines the customId decode, the route matching, and the source-message
|
|
450
|
+
* verbs `update` and `deferUpdate`.
|
|
449
451
|
*
|
|
450
452
|
* @typeParam Event - The component or modal interaction type this handler processes
|
|
451
453
|
* @typeParam Defs - The customId route definitions registered on the concrete handler
|
|
@@ -510,7 +512,7 @@ declare abstract class ComponentHandler<Event extends APIMessageComponentInterac
|
|
|
510
512
|
*/
|
|
511
513
|
declare abstract class ButtonHandler<Defs extends readonly AnyCustomId[]> extends ComponentHandler<APIMessageComponentButtonInteraction, Defs> {
|
|
512
514
|
/** @internal */
|
|
513
|
-
readonly [ComponentKindBrand]?:
|
|
515
|
+
readonly [ComponentKindBrand]?: InteractionKind.Button;
|
|
514
516
|
}
|
|
515
517
|
//#endregion
|
|
516
518
|
//#region src/handlers/interaction/components/ModalHandler.d.ts
|
|
@@ -537,7 +539,7 @@ declare abstract class ButtonHandler<Defs extends readonly AnyCustomId[]> extend
|
|
|
537
539
|
*/
|
|
538
540
|
declare abstract class ModalHandler<Defs extends readonly AnyCustomId[]> extends ComponentHandler<APIModalSubmitInteraction, Defs> {
|
|
539
541
|
/** @internal */
|
|
540
|
-
readonly [ComponentKindBrand]?:
|
|
542
|
+
readonly [ComponentKindBrand]?: InteractionKind.Modal;
|
|
541
543
|
private reader?;
|
|
542
544
|
/** The fields this modal submitted, read by custom id. */
|
|
543
545
|
protected get fields(): ModalFields;
|
|
@@ -549,29 +551,59 @@ declare abstract class ModalHandler<Defs extends readonly AnyCustomId[]> extends
|
|
|
549
551
|
}
|
|
550
552
|
//#endregion
|
|
551
553
|
//#region src/handlers/interaction/components/SelectMenuHandler.d.ts
|
|
552
|
-
type
|
|
553
|
-
|
|
554
|
-
type ResolvedFor<Kind extends SelectMenuKind, Allowed extends SelectMenuKind, Value> = [Kind] extends [Allowed] ? Map<string, Value> : never;
|
|
555
|
-
type SelectMenuInteractionFor<Kind extends SelectMenuKind> = APIMessageComponentSelectMenuInteraction & {
|
|
556
|
-
data: Kind extends SelectMenuKind.String ? APIMessageStringSelectInteractionData : Kind extends SelectMenuKind.User ? APIMessageUserSelectInteractionData : Kind extends SelectMenuKind.Role ? APIMessageRoleSelectInteractionData : Kind extends SelectMenuKind.Channel ? APIMessageChannelSelectInteractionData : Kind extends SelectMenuKind.Mentionable ? APIMessageMentionableSelectInteractionData : never;
|
|
554
|
+
type SelectInteraction<Data> = APIMessageComponentSelectMenuInteraction & {
|
|
555
|
+
data: Data;
|
|
557
556
|
};
|
|
558
557
|
/**
|
|
559
|
-
*
|
|
558
|
+
* Shared base the select menu handlers extend on the HTTP transport.
|
|
560
559
|
*
|
|
561
|
-
*
|
|
562
|
-
*
|
|
563
|
-
*
|
|
560
|
+
* Not a public entry point. Extend {@link StringMenuHandler}, {@link UserMenuHandler},
|
|
561
|
+
* {@link RoleMenuHandler}, {@link ChannelMenuHandler}, or {@link MentionableMenuHandler} instead. This
|
|
562
|
+
* class defines the `values` getter those bases share.
|
|
564
563
|
*
|
|
565
|
-
*
|
|
566
|
-
*
|
|
564
|
+
* @typeParam Event - The select menu interaction type this handler processes
|
|
565
|
+
* @typeParam Defs - The customId route definitions registered on the concrete handler
|
|
566
|
+
*/
|
|
567
|
+
declare abstract class SelectMenuHandler<Event extends APIMessageComponentSelectMenuInteraction, Defs extends readonly AnyCustomId[]> extends ComponentHandler<Event, Defs> {
|
|
568
|
+
/** The values this select picked. On every kind but the string menu they are snowflake ids. */
|
|
569
|
+
protected get values(): string[];
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Base class for a string select menu handler on the HTTP transport.
|
|
573
|
+
*
|
|
574
|
+
* Register the customId definitions with `@StringMenuRoute`, list the same ones in the generic, then read
|
|
575
|
+
* the chosen option values from `this.values`. Read `this.params` for a single route or `this.match` for
|
|
576
|
+
* several. Reply through the handler members, or rewrite the source message with `this.update`.
|
|
577
|
+
*
|
|
578
|
+
* @typeParam Defs - The customId definitions this handler decodes, e.g. `[typeof TopicsId]`.
|
|
579
|
+
*
|
|
580
|
+
* @example
|
|
581
|
+
* ```ts
|
|
582
|
+
* \@StringMenuRoute(TopicsId)
|
|
583
|
+
* class Topics extends StringMenuHandler<[typeof TopicsId]> {
|
|
584
|
+
* async execute() {
|
|
585
|
+
* const { userId } = this.params;
|
|
586
|
+
* await this.update(`<@${userId}> now follows ${this.values.join(', ')}`);
|
|
587
|
+
* }
|
|
588
|
+
* }
|
|
589
|
+
* ```
|
|
590
|
+
*/
|
|
591
|
+
declare abstract class StringMenuHandler<Defs extends readonly AnyCustomId[]> extends SelectMenuHandler<SelectInteraction<APIMessageStringSelectInteractionData>, Defs> {
|
|
592
|
+
/** @internal */
|
|
593
|
+
readonly [ComponentKindBrand]?: InteractionKind.StringMenu;
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Base class for a user select menu handler on the HTTP transport.
|
|
597
|
+
*
|
|
598
|
+
* Beside `this.values` this handler declares `this.users` and `this.members`. Register the customId
|
|
599
|
+
* definitions with `@UserMenuRoute` and list the same ones in the generic.
|
|
567
600
|
*
|
|
568
|
-
* @typeParam Kind - The select kind from {@link SelectMenuKind}, e.g. `SelectMenuKind.User`.
|
|
569
601
|
* @typeParam Defs - The customId definitions this handler decodes, e.g. `[typeof AssignId]`.
|
|
570
602
|
*
|
|
571
603
|
* @example
|
|
572
604
|
* ```ts
|
|
573
|
-
* \@
|
|
574
|
-
* class
|
|
605
|
+
* \@UserMenuRoute(AssignId)
|
|
606
|
+
* class Assign extends UserMenuHandler<[typeof AssignId]> {
|
|
575
607
|
* async execute() {
|
|
576
608
|
* const { roleId } = this.params;
|
|
577
609
|
* await this.reply(`assigning ${this.users.size} member(s) to <@&${roleId}>`);
|
|
@@ -579,21 +611,89 @@ type SelectMenuInteractionFor<Kind extends SelectMenuKind> = APIMessageComponent
|
|
|
579
611
|
* }
|
|
580
612
|
* ```
|
|
581
613
|
*/
|
|
582
|
-
declare abstract class
|
|
614
|
+
declare abstract class UserMenuHandler<Defs extends readonly AnyCustomId[]> extends SelectMenuHandler<SelectInteraction<APIMessageUserSelectInteractionData>, Defs> {
|
|
583
615
|
/** @internal */
|
|
584
|
-
readonly [ComponentKindBrand]?:
|
|
585
|
-
private get selection();
|
|
586
|
-
private resolvedMap;
|
|
587
|
-
/** The ids this select picked. */
|
|
588
|
-
protected get values(): string[];
|
|
616
|
+
readonly [ComponentKindBrand]?: InteractionKind.UserMenu;
|
|
589
617
|
/** The users this select picked. */
|
|
590
|
-
protected get users():
|
|
618
|
+
protected get users(): Collection<string, APIUser>;
|
|
591
619
|
/** The guild members behind the picked users. Discord resolves these only inside a guild. */
|
|
592
|
-
protected get members():
|
|
620
|
+
protected get members(): Collection<string, APIInteractionDataResolvedGuildMember>;
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Base class for a role select menu handler on the HTTP transport.
|
|
624
|
+
*
|
|
625
|
+
* Beside `this.values` this handler declares `this.roles`. Register the customId definitions with
|
|
626
|
+
* `@RoleMenuRoute` and list the same ones in the generic.
|
|
627
|
+
*
|
|
628
|
+
* @typeParam Defs - The customId definitions this handler decodes, e.g. `[typeof GrantId]`.
|
|
629
|
+
*
|
|
630
|
+
* @example
|
|
631
|
+
* ```ts
|
|
632
|
+
* \@RoleMenuRoute(GrantId)
|
|
633
|
+
* class Grant extends RoleMenuHandler<[typeof GrantId]> {
|
|
634
|
+
* async execute() {
|
|
635
|
+
* await this.update(`granting ${this.roles.size} role(s)`);
|
|
636
|
+
* }
|
|
637
|
+
* }
|
|
638
|
+
* ```
|
|
639
|
+
*/
|
|
640
|
+
declare abstract class RoleMenuHandler<Defs extends readonly AnyCustomId[]> extends SelectMenuHandler<SelectInteraction<APIMessageRoleSelectInteractionData>, Defs> {
|
|
641
|
+
/** @internal */
|
|
642
|
+
readonly [ComponentKindBrand]?: InteractionKind.RoleMenu;
|
|
593
643
|
/** The roles this select picked. */
|
|
594
|
-
protected get roles():
|
|
644
|
+
protected get roles(): Collection<string, APIRole>;
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Base class for a channel select menu handler on the HTTP transport.
|
|
648
|
+
*
|
|
649
|
+
* Beside `this.values` this handler declares `this.channels`. Register the customId definitions with
|
|
650
|
+
* `@ChannelMenuRoute` and list the same ones in the generic.
|
|
651
|
+
*
|
|
652
|
+
* @typeParam Defs - The customId definitions this handler decodes, e.g. `[typeof LogTargetId]`.
|
|
653
|
+
*
|
|
654
|
+
* @example
|
|
655
|
+
* ```ts
|
|
656
|
+
* \@ChannelMenuRoute(LogTargetId)
|
|
657
|
+
* class LogTarget extends ChannelMenuHandler<[typeof LogTargetId]> {
|
|
658
|
+
* async execute() {
|
|
659
|
+
* await this.update(`logging to ${this.channels.size} channel(s)`);
|
|
660
|
+
* }
|
|
661
|
+
* }
|
|
662
|
+
* ```
|
|
663
|
+
*/
|
|
664
|
+
declare abstract class ChannelMenuHandler<Defs extends readonly AnyCustomId[]> extends SelectMenuHandler<SelectInteraction<APIMessageChannelSelectInteractionData>, Defs> {
|
|
665
|
+
/** @internal */
|
|
666
|
+
readonly [ComponentKindBrand]?: InteractionKind.ChannelMenu;
|
|
595
667
|
/** The channels this select picked. */
|
|
596
|
-
protected get channels():
|
|
668
|
+
protected get channels(): Collection<string, APIInteractionDataResolvedChannel>;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Base class for a mentionable select menu handler on the HTTP transport.
|
|
672
|
+
*
|
|
673
|
+
* A mentionable menu accepts users and roles together. `this.users`, `this.members`, and `this.roles`
|
|
674
|
+
* can each come back empty.
|
|
675
|
+
*
|
|
676
|
+
* @typeParam Defs - The customId definitions this handler decodes, e.g. `[typeof InviteId]`.
|
|
677
|
+
*
|
|
678
|
+
* @example
|
|
679
|
+
* ```ts
|
|
680
|
+
* \@MentionableMenuRoute(InviteId)
|
|
681
|
+
* class Invite extends MentionableMenuHandler<[typeof InviteId]> {
|
|
682
|
+
* async execute() {
|
|
683
|
+
* await this.update(`inviting ${this.users.size} user(s) and ${this.roles.size} role(s)`);
|
|
684
|
+
* }
|
|
685
|
+
* }
|
|
686
|
+
* ```
|
|
687
|
+
*/
|
|
688
|
+
declare abstract class MentionableMenuHandler<Defs extends readonly AnyCustomId[]> extends SelectMenuHandler<SelectInteraction<APIMessageMentionableSelectInteractionData>, Defs> {
|
|
689
|
+
/** @internal */
|
|
690
|
+
readonly [ComponentKindBrand]?: InteractionKind.MentionableMenu;
|
|
691
|
+
/** The users this select picked. */
|
|
692
|
+
protected get users(): Collection<string, APIUser>;
|
|
693
|
+
/** The guild members behind the picked users. Discord resolves these only inside a guild. */
|
|
694
|
+
protected get members(): Collection<string, APIInteractionDataResolvedGuildMember>;
|
|
695
|
+
/** The roles this select picked. */
|
|
696
|
+
protected get roles(): Collection<string, APIRole>;
|
|
597
697
|
}
|
|
598
698
|
//#endregion
|
|
599
699
|
//#region src/subscribers/index.d.ts
|
|
@@ -739,8 +839,8 @@ interface Ungateable {
|
|
|
739
839
|
}
|
|
740
840
|
type ProvidedContext<TCtor extends AnyHandlerCtor> = InstanceType<TCtor> extends RepliableHandler$1<infer Event> ? InteractionGateContext<Event> : Ungateable;
|
|
741
841
|
type SelectData<Repliable> = Repliable extends APIMessageComponentSelectMenuInteraction ? Repliable['data'] : never;
|
|
742
|
-
type SelectKindName<Data> = Data extends APIMessageStringSelectInteractionData ? '
|
|
743
|
-
type KindName<Ctx> = Ctx extends Ungateable ? 'autocomplete' : Ctx extends GuildPermissionsContext ? 'gateway (guild permissions)' : Ctx extends InteractionGateContext<infer Repliable> ? Repliable extends APIChatInputApplicationCommandInteraction ? 'Slash' : Repliable extends APIMessageApplicationCommandInteraction ? '
|
|
842
|
+
type SelectKindName<Data> = Data extends APIMessageStringSelectInteractionData ? 'StringMenu' : Data extends APIMessageUserSelectInteractionData ? 'UserMenu' : Data extends APIMessageRoleSelectInteractionData ? 'RoleMenu' : Data extends APIMessageChannelSelectInteractionData ? 'ChannelMenu' : Data extends APIMessageMentionableSelectInteractionData ? 'MentionableMenu' : 'an interaction';
|
|
843
|
+
type KindName<Ctx> = Ctx extends Ungateable ? 'autocomplete' : Ctx extends GuildPermissionsContext ? 'gateway (guild permissions)' : Ctx extends InteractionGateContext<infer Repliable> ? Repliable extends APIChatInputApplicationCommandInteraction ? 'Slash' : Repliable extends APIMessageApplicationCommandInteraction ? 'MessageContextMenu' : Repliable extends APIUserApplicationCommandInteraction ? 'UserContextMenu' : Repliable extends APIMessageComponentSelectMenuInteraction ? SelectKindName<SelectData<Repliable>> : Repliable extends APIMessageComponentButtonInteraction ? 'Button' : Repliable extends APIModalSubmitInteraction ? 'Modal' : 'an interaction' : 'an agnostic';
|
|
744
844
|
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]>>>; };
|
|
745
845
|
//#endregion
|
|
746
846
|
//#region src/gates/Gated.d.ts
|
|
@@ -781,5 +881,5 @@ declare function Gated<const Gates extends NonEmptyTuple<Gate<GateContextBase>>>
|
|
|
781
881
|
//#region src/version.d.ts
|
|
782
882
|
declare const version: string;
|
|
783
883
|
//#endregion
|
|
784
|
-
export {
|
|
785
|
-
//# sourceMappingURL=edge.index-
|
|
884
|
+
export { InjectedEmojiMap as A, SlashHandler as C, ReplySender as D, InteractionRef as E, EngineContext as F, Core as I, HttpConfig as L, SelectedMentionables as M, SlashOptions$1 as N, SentMessage as O, createSeedcord as P, HttpEdgeConfig as R, UserContextMenuHandler as S, RepliableHandler$1 as T, ModalHandler as _, CursorSource as a, AutocompleteHandler as b, PageContext as c, ChannelMenuHandler as d, MentionableMenuHandler as f, UserMenuHandler as g, StringMenuHandler as h, ArraySource as i, ModalFields as j, Emojis as k, Subscriber$1 as l, SelectMenuHandler as m, Gated as n, PageSource as o, RoleMenuHandler as p, InteractionGateContext as r, Paginator as s, version as t, WebhookLog$1 as u, ButtonHandler as v, InteractionHandler as w, MessageContextMenuHandler as x, ComponentHandler as y, HttpServerConfig as z };
|
|
885
|
+
//# sourceMappingURL=edge.index-LAWTa6NI.d.mts.map
|
package/dist/edge.index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { t as RouteManifest } from "./RouteManifest-
|
|
1
|
+
import { A as InjectedEmojiMap, C as SlashHandler, D as ReplySender, E as InteractionRef, F as EngineContext, I as Core, L as HttpConfig, M as SelectedMentionables, N as SlashOptions, O as SentMessage, P as createSeedcord, R as HttpEdgeConfig, S as UserContextMenuHandler, T as RepliableHandler, _ as ModalHandler, a as CursorSource, b as AutocompleteHandler, c as PageContext, d as ChannelMenuHandler, f as MentionableMenuHandler, g as UserMenuHandler, h as StringMenuHandler, i as ArraySource, j as ModalFields, k as Emojis, l as Subscriber, m as SelectMenuHandler, n as Gated, o as PageSource, p as RoleMenuHandler, r as InteractionGateContext, s as Paginator, t as version, u as WebhookLog, v as ButtonHandler, w as InteractionHandler, x as MessageContextMenuHandler, y as ComponentHandler, z as HttpServerConfig } from "./edge.index-LAWTa6NI.mjs";
|
|
2
|
+
import { t as RouteManifest } from "./RouteManifest-D7qXj8Ts.mjs";
|
|
3
3
|
export * from "@seedcord/logger";
|
|
4
4
|
export * from "@seedcord/core";
|
|
5
5
|
export * from "@seedcord/errors";
|
|
@@ -7,4 +7,4 @@ export * from "@seedcord/rate-limiter";
|
|
|
7
7
|
export * from "@seedcord/event-emitter";
|
|
8
8
|
export * from "@seedcord/utils";
|
|
9
9
|
export type * from "@seedcord/types";
|
|
10
|
-
export { ArraySource, AutocompleteHandler, ButtonHandler, ComponentHandler, type Core, CursorSource, Emojis, type EngineContext, Gated, type HttpConfig, type HttpEdgeConfig, type HttpServerConfig, type InjectedEmojiMap, type InteractionGateContext, InteractionHandler, type InteractionRef, MessageContextMenuHandler, ModalFields, ModalHandler, type PageContext, type PageSource, Paginator, RepliableHandler, ReplySender, type RouteManifest, SelectMenuHandler, type SelectedMentionables, type SentMessage, SlashHandler, type SlashOptions, Subscriber, UserContextMenuHandler, WebhookLog, createSeedcord, version };
|
|
10
|
+
export { ArraySource, AutocompleteHandler, ButtonHandler, ChannelMenuHandler, ComponentHandler, type Core, CursorSource, Emojis, type EngineContext, Gated, type HttpConfig, type HttpEdgeConfig, type HttpServerConfig, type InjectedEmojiMap, type InteractionGateContext, InteractionHandler, type InteractionRef, MentionableMenuHandler, MessageContextMenuHandler, ModalFields, ModalHandler, type PageContext, type PageSource, Paginator, RepliableHandler, ReplySender, RoleMenuHandler, type RouteManifest, SelectMenuHandler, type SelectedMentionables, type SentMessage, SlashHandler, type SlashOptions, StringMenuHandler, Subscriber, UserContextMenuHandler, UserMenuHandler, WebhookLog, createSeedcord, version };
|
package/dist/edge.index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as RepliableHandler, S as
|
|
1
|
+
import { C as createSeedcord, D as AutocompleteHandler, E as InteractionHandler, O as RepliableHandler, S as ModalFields, _ as MessageContextMenuHandler, a as Paginator, c as ChannelMenuHandler, d as SelectMenuHandler, f as StringMenuHandler, g as ComponentHandler, h as ButtonHandler, i as CursorSource, k as ReplySender, l as MentionableMenuHandler, m as ModalHandler, n as Gated, o as Subscriber, p as UserMenuHandler, r as ArraySource, s as WebhookLog, t as version, u as RoleMenuHandler, v as UserContextMenuHandler, x as Emojis, y as SlashHandler } from "./edge.index-CWUU_d_X.mjs";
|
|
2
2
|
|
|
3
3
|
export * from "@seedcord/logger"
|
|
4
4
|
|
|
@@ -12,4 +12,4 @@ export * from "@seedcord/event-emitter"
|
|
|
12
12
|
|
|
13
13
|
export * from "@seedcord/utils"
|
|
14
14
|
|
|
15
|
-
export { ArraySource, AutocompleteHandler, ButtonHandler, ComponentHandler, CursorSource, Emojis, Gated, InteractionHandler, MessageContextMenuHandler, ModalFields, ModalHandler, Paginator, RepliableHandler, ReplySender, SelectMenuHandler, SlashHandler, Subscriber, UserContextMenuHandler, WebhookLog, createSeedcord, version };
|
|
15
|
+
export { ArraySource, AutocompleteHandler, ButtonHandler, ChannelMenuHandler, ComponentHandler, CursorSource, Emojis, Gated, InteractionHandler, MentionableMenuHandler, MessageContextMenuHandler, ModalFields, ModalHandler, Paginator, RepliableHandler, ReplySender, RoleMenuHandler, SelectMenuHandler, SlashHandler, StringMenuHandler, Subscriber, UserContextMenuHandler, UserMenuHandler, WebhookLog, createSeedcord, version };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { t as RouteManifest } from "./RouteManifest-
|
|
1
|
+
import { A as InjectedEmojiMap, C as SlashHandler, D as ReplySender, E as InteractionRef, F as EngineContext, I as Core, L as HttpConfig, M as SelectedMentionables, N as SlashOptions, O as SentMessage, P as createSeedcord, R as HttpEdgeConfig, S as UserContextMenuHandler, T as RepliableHandler, _ as ModalHandler, a as CursorSource, b as AutocompleteHandler, c as PageContext, d as ChannelMenuHandler, f as MentionableMenuHandler, g as UserMenuHandler, h as StringMenuHandler, i as ArraySource, j as ModalFields, k as Emojis, l as Subscriber, m as SelectMenuHandler, n as Gated, o as PageSource, p as RoleMenuHandler, r as InteractionGateContext, s as Paginator, t as version, u as WebhookLog, v as ButtonHandler, w as InteractionHandler, x as MessageContextMenuHandler, y as ComponentHandler, z as HttpServerConfig } from "./edge.index-LAWTa6NI.mjs";
|
|
2
|
+
import { t as RouteManifest } from "./RouteManifest-D7qXj8Ts.mjs";
|
|
3
3
|
import "reflect-metadata";
|
|
4
4
|
import { REST } from "@discordjs/rest";
|
|
5
5
|
import { Bus } from "@seedcord/core";
|
|
@@ -87,5 +87,5 @@ declare abstract class Plugin<Opts extends HttpPluginOptions = {
|
|
|
87
87
|
transport: 'http';
|
|
88
88
|
}> extends Plugin$1<Opts, Core> {}
|
|
89
89
|
//#endregion
|
|
90
|
-
export { ArraySource, AutocompleteHandler, ButtonHandler, ComponentHandler, type Core, CursorSource, Emojis, type EngineContext, Gated, type HttpConfig, type HttpEdgeConfig, type HttpPluginOptions, type HttpServerConfig, type InjectedEmojiMap, type InteractionGateContext, InteractionHandler, type InteractionRef, MessageContextMenuHandler, ModalFields, ModalHandler, type PageContext, type PageSource, Paginator, Plugin, type PluginLifecycleSpec, type PluginOptions, RepliableHandler, ReplySender, type RouteManifest, Seedcord, SelectMenuHandler, type SelectedMentionables, type SentMessage, SlashHandler, type SlashOptions, Subscriber, UserContextMenuHandler, WebhookLog, WinstonConsoleSink, WinstonFileSink, createSeedcord, version };
|
|
90
|
+
export { ArraySource, AutocompleteHandler, ButtonHandler, ChannelMenuHandler, ComponentHandler, type Core, CursorSource, Emojis, type EngineContext, Gated, type HttpConfig, type HttpEdgeConfig, type HttpPluginOptions, type HttpServerConfig, type InjectedEmojiMap, type InteractionGateContext, InteractionHandler, type InteractionRef, MentionableMenuHandler, MessageContextMenuHandler, ModalFields, ModalHandler, type PageContext, type PageSource, Paginator, Plugin, type PluginLifecycleSpec, type PluginOptions, RepliableHandler, ReplySender, RoleMenuHandler, type RouteManifest, Seedcord, SelectMenuHandler, type SelectedMentionables, type SentMessage, SlashHandler, type SlashOptions, StringMenuHandler, Subscriber, UserContextMenuHandler, UserMenuHandler, WebhookLog, WinstonConsoleSink, WinstonFileSink, createSeedcord, version };
|
|
91
91
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { C as RepliableHandler, S as
|
|
1
|
+
import { C as createSeedcord, D as AutocompleteHandler, E as InteractionHandler, O as RepliableHandler, S as ModalFields, T as buildRouteMaps, _ as MessageContextMenuHandler, a as Paginator, b as EmojiInjector, c as ChannelMenuHandler, d as SelectMenuHandler, f as StringMenuHandler, g as ComponentHandler, h as ButtonHandler, i as CursorSource, k as ReplySender, l as MentionableMenuHandler, m as ModalHandler, n as Gated, o as Subscriber, p as UserMenuHandler, r as ArraySource, s as WebhookLog, t as version, u as RoleMenuHandler, v as UserContextMenuHandler, w as buildEngine, x as Emojis, y as SlashHandler } from "./edge.index-CWUU_d_X.mjs";
|
|
2
2
|
import "reflect-metadata";
|
|
3
|
-
import { HmrManager, InteractionMetadataKey,
|
|
3
|
+
import { HmrManager, InteractionMetadataKey, busLoggerOf, getDevChannel, interactionRoutesOf, setBotColor } from "@seedcord/core/internal";
|
|
4
4
|
import { SeedcordError, applicationIdFromToken, validateDiscordToken } from "@seedcord/errors/internal";
|
|
5
5
|
import { Logger, LoggerChannelRegistry } from "@seedcord/logger";
|
|
6
6
|
import { Envapter } from "envapt";
|
|
7
7
|
import { REST } from "@discordjs/rest";
|
|
8
|
-
import { Bus } from "@seedcord/core";
|
|
8
|
+
import { Bus, InteractionKind } from "@seedcord/core";
|
|
9
9
|
import { SeedcordErrorCode, paint } from "@seedcord/errors";
|
|
10
10
|
import { MemoryRateLimiter } from "@seedcord/rate-limiter";
|
|
11
11
|
import { Routes } from "discord-api-types/v10";
|
|
@@ -13,7 +13,7 @@ import { formatFilePath } from "@seedcord/utils";
|
|
|
13
13
|
import { once } from "node:events";
|
|
14
14
|
import { createServer } from "node:http";
|
|
15
15
|
import { CoordinatedShutdown, CoordinatedStartup, Pluggable } from "@seedcord/core/node";
|
|
16
|
-
import { CommandRegistry, ShutdownPhase, StartupPhase, SubscriberLoader, shutdownOf } from "@seedcord/core/node/internal";
|
|
16
|
+
import { CommandRegistry, DRAIN_TASK_TIMEOUT_MS, DRAIN_WINDOW_MS, ShutdownPhase, StartupPhase, SubscriberLoader, drainInFlight, shutdownOf } from "@seedcord/core/node/internal";
|
|
17
17
|
import { WinstonConsoleSink, WinstonFileSink, installNodeDefaults } from "@seedcord/logger/node";
|
|
18
18
|
import { HostAugmentTarget, HostVersion, SeedcordBrand } from "@seedcord/types/internal";
|
|
19
19
|
import { HmrModuleHandler } from "@seedcord/core/hmr";
|
|
@@ -47,7 +47,6 @@ const EMPTY_MANIFEST = {
|
|
|
47
47
|
var InteractionDispatcher = class {
|
|
48
48
|
handlersDir;
|
|
49
49
|
maps;
|
|
50
|
-
targets;
|
|
51
50
|
/** @internal */
|
|
52
51
|
logger = new Logger("Interactions", { channel: "interactions" });
|
|
53
52
|
isInitialized = false;
|
|
@@ -58,7 +57,6 @@ var InteractionDispatcher = class {
|
|
|
58
57
|
constructor(handlersDir) {
|
|
59
58
|
this.handlersDir = handlersDir;
|
|
60
59
|
this.maps = buildRouteMaps(EMPTY_MANIFEST);
|
|
61
|
-
this.targets = this.buildTargets();
|
|
62
60
|
if (!Envapter.isDevelopment && !Envapter.isTest) return;
|
|
63
61
|
this.hmrHandler = new HmrModuleHandler({
|
|
64
62
|
handlersDir,
|
|
@@ -93,11 +91,13 @@ var InteractionDispatcher = class {
|
|
|
93
91
|
await this.hmrHandler?.handle(event);
|
|
94
92
|
}
|
|
95
93
|
warnUnhandledRoutes(commandLeaves) {
|
|
96
|
-
this.warnMissing(commandLeaves, this.maps.
|
|
94
|
+
this.warnMissing(commandLeaves, this.maps[InteractionKind.Slash], "Slash route", "@SlashRoute");
|
|
97
95
|
}
|
|
98
96
|
warnUnhandledContextMenuRoutes(leaves) {
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
const user = this.maps[InteractionKind.UserContextMenu];
|
|
98
|
+
const message = this.maps[InteractionKind.MessageContextMenu];
|
|
99
|
+
this.warnMissing(leaves.user, user, "User context menu", "@ContextMenuRoute");
|
|
100
|
+
this.warnMissing(leaves.message, message, "Message context menu", "@ContextMenuRoute");
|
|
101
101
|
}
|
|
102
102
|
warnMissing(names, map, label, decorator) {
|
|
103
103
|
for (const name of names) {
|
|
@@ -114,84 +114,33 @@ var InteractionDispatcher = class {
|
|
|
114
114
|
for (const [routeId, owner] of this.rowOwners) if (owner.ctor === ctor) routeIds.push(routeId);
|
|
115
115
|
return routeIds;
|
|
116
116
|
}
|
|
117
|
-
targetFor(route) {
|
|
118
|
-
return this.targets[route];
|
|
119
|
-
}
|
|
120
|
-
buildTargets() {
|
|
121
|
-
return {
|
|
122
|
-
[InteractionRoutes.Slash]: {
|
|
123
|
-
map: this.maps.slash,
|
|
124
|
-
kind: "slash"
|
|
125
|
-
},
|
|
126
|
-
[InteractionRoutes.UserContextMenu]: {
|
|
127
|
-
map: this.maps.userContextMenu,
|
|
128
|
-
kind: "userContextMenu"
|
|
129
|
-
},
|
|
130
|
-
[InteractionRoutes.MessageContextMenu]: {
|
|
131
|
-
map: this.maps.messageContextMenu,
|
|
132
|
-
kind: "messageContextMenu"
|
|
133
|
-
},
|
|
134
|
-
[InteractionRoutes.Autocomplete]: {
|
|
135
|
-
map: this.maps.autocomplete,
|
|
136
|
-
kind: "autocomplete"
|
|
137
|
-
},
|
|
138
|
-
[InteractionRoutes.Button]: {
|
|
139
|
-
map: this.maps.components.button,
|
|
140
|
-
kind: "button"
|
|
141
|
-
},
|
|
142
|
-
[InteractionRoutes.StringMenu]: {
|
|
143
|
-
map: this.maps.components.stringSelect,
|
|
144
|
-
kind: "stringMenu"
|
|
145
|
-
},
|
|
146
|
-
[InteractionRoutes.UserMenu]: {
|
|
147
|
-
map: this.maps.components.userSelect,
|
|
148
|
-
kind: "userMenu"
|
|
149
|
-
},
|
|
150
|
-
[InteractionRoutes.RoleMenu]: {
|
|
151
|
-
map: this.maps.components.roleSelect,
|
|
152
|
-
kind: "roleMenu"
|
|
153
|
-
},
|
|
154
|
-
[InteractionRoutes.ChannelMenu]: {
|
|
155
|
-
map: this.maps.components.channelSelect,
|
|
156
|
-
kind: "channelMenu"
|
|
157
|
-
},
|
|
158
|
-
[InteractionRoutes.MentionableMenu]: {
|
|
159
|
-
map: this.maps.components.mentionableSelect,
|
|
160
|
-
kind: "mentionableMenu"
|
|
161
|
-
},
|
|
162
|
-
[InteractionRoutes.Modal]: {
|
|
163
|
-
map: this.maps.components.modal,
|
|
164
|
-
kind: "modal"
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
117
|
registerHandler(ctor, relativePath) {
|
|
169
118
|
const from = formatFilePath(relativePath);
|
|
170
119
|
const writes = [];
|
|
171
|
-
for (const [
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
120
|
+
for (const [kind, keys] of interactionRoutesOf(ctor)) for (const key of keys) {
|
|
121
|
+
const routeId = `${kind}:${key}`;
|
|
122
|
+
const existing = this.rowOwners.get(routeId);
|
|
123
|
+
if (existing && existing.ctor !== ctor) throw new SeedcordError(SeedcordErrorCode.InteractionDuplicateRoute, [
|
|
124
|
+
routeId,
|
|
125
|
+
`${existing.ctor.name} (${existing.from})`,
|
|
126
|
+
`${ctor.name} (${from})`
|
|
127
|
+
]);
|
|
128
|
+
writes.push({
|
|
129
|
+
kind,
|
|
130
|
+
key
|
|
131
|
+
});
|
|
183
132
|
}
|
|
184
133
|
if (writes.length === 0) return;
|
|
185
|
-
for (const
|
|
186
|
-
const routeId = `${
|
|
187
|
-
|
|
188
|
-
kind
|
|
134
|
+
for (const { kind, key } of writes) {
|
|
135
|
+
const routeId = `${kind}:${key}`;
|
|
136
|
+
this.maps[kind].set(key, {
|
|
137
|
+
kind,
|
|
189
138
|
routeId,
|
|
190
139
|
load: () => Promise.resolve(ctor)
|
|
191
140
|
});
|
|
192
141
|
this.rowOwners.set(routeId, {
|
|
193
142
|
ctor,
|
|
194
|
-
|
|
143
|
+
kind,
|
|
195
144
|
key,
|
|
196
145
|
from
|
|
197
146
|
});
|
|
@@ -207,7 +156,7 @@ var InteractionDispatcher = class {
|
|
|
207
156
|
const owner = this.rowOwners.get(routeId);
|
|
208
157
|
if (owner?.ctor !== ctor) continue;
|
|
209
158
|
this.rowOwners.delete(routeId);
|
|
210
|
-
owner.
|
|
159
|
+
this.maps[owner.kind].delete(owner.key);
|
|
211
160
|
}
|
|
212
161
|
}
|
|
213
162
|
};
|
|
@@ -246,7 +195,6 @@ async function writeWebResponse(response, out) {
|
|
|
246
195
|
//#region src/node/Seedcord.ts
|
|
247
196
|
const DEFAULT_PORT = 3e3;
|
|
248
197
|
const SERVER_SHUTDOWN_TIMEOUT_MS = 5e3;
|
|
249
|
-
const DRAIN_TIMEOUT_MS = 1e4;
|
|
250
198
|
/**
|
|
251
199
|
* The HTTP-interactions bot host, a long-running node server around the engine.
|
|
252
200
|
*
|
|
@@ -279,7 +227,7 @@ var Seedcord = class Seedcord extends Pluggable {
|
|
|
279
227
|
boundPort;
|
|
280
228
|
fetchedUsername;
|
|
281
229
|
constructor(config) {
|
|
282
|
-
super(new CoordinatedShutdown(), new CoordinatedStartup());
|
|
230
|
+
super(new CoordinatedShutdown(config.lifecycle?.shutdownDeadline), new CoordinatedStartup());
|
|
283
231
|
this.config = config;
|
|
284
232
|
installNodeDefaults(config.logger);
|
|
285
233
|
setBotColor(config.botColor);
|
|
@@ -382,9 +330,7 @@ var Seedcord = class Seedcord extends Pluggable {
|
|
|
382
330
|
this.logger.info(`Interactions server listening on port ${paint.sky.bold(String(this.boundPort))}`);
|
|
383
331
|
getDevChannel()?.send("seedcord:server-listening", { port: this.boundPort });
|
|
384
332
|
this.shutdown.addTask(ShutdownPhase.Unbind, "stop-http-server", () => this.stopServer(), SERVER_SHUTDOWN_TIMEOUT_MS);
|
|
385
|
-
this.shutdown.addTask(ShutdownPhase.Drain, "drain-inflight",
|
|
386
|
-
await Promise.allSettled(inFlight);
|
|
387
|
-
}, DRAIN_TIMEOUT_MS);
|
|
333
|
+
this.shutdown.addTask(ShutdownPhase.Drain, "drain-inflight", () => drainInFlight(inFlight, DRAIN_WINDOW_MS, this.logger, "Interactions"), DRAIN_TASK_TIMEOUT_MS);
|
|
388
334
|
}
|
|
389
335
|
async fetchUsername() {
|
|
390
336
|
try {
|
|
@@ -425,5 +371,5 @@ var Seedcord = class Seedcord extends Pluggable {
|
|
|
425
371
|
var Plugin = class extends Plugin$1 {};
|
|
426
372
|
|
|
427
373
|
//#endregion
|
|
428
|
-
export { ArraySource, AutocompleteHandler, ButtonHandler, ComponentHandler, CursorSource, Emojis, Gated, InteractionHandler, MessageContextMenuHandler, ModalFields, ModalHandler, Paginator, Plugin, RepliableHandler, ReplySender, Seedcord, SelectMenuHandler, SlashHandler, Subscriber, UserContextMenuHandler, WebhookLog, WinstonConsoleSink, WinstonFileSink, createSeedcord, version };
|
|
374
|
+
export { ArraySource, AutocompleteHandler, ButtonHandler, ChannelMenuHandler, ComponentHandler, CursorSource, Emojis, Gated, InteractionHandler, MentionableMenuHandler, MessageContextMenuHandler, ModalFields, ModalHandler, Paginator, Plugin, RepliableHandler, ReplySender, RoleMenuHandler, Seedcord, SelectMenuHandler, SlashHandler, StringMenuHandler, Subscriber, UserContextMenuHandler, UserMenuHandler, WebhookLog, WinstonConsoleSink, WinstonFileSink, createSeedcord, version };
|
|
429
375
|
//# sourceMappingURL=index.mjs.map
|