@seedcord/gateway 0.3.0 → 0.4.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/index.d.mts CHANGED
@@ -1,11 +1,13 @@
1
1
  import "reflect-metadata";
2
- import { AnyCustomId, AutocompletableNames, AutocompleteRouteBrand, BaseReplySender, CacheFor, ChoiceValueOf, ComponentDefsBrand, ComponentKindBrand, ContextMenuKindBrand, ContextMenuNamesBrand, EntryFor, FocusedField, GateFitsWith, HasComponentDefs, MatchArms, MenuCacheFor, ModalLike, NamesFor, PageCursor, SingleParams, SlashOptions as SlashOptions$1, SlashRouteBrand } from "@seedcord/core/internal";
3
- import { ArraySource as ArraySource$1, AutocompleteOptions, BaseHandler as BaseHandler$1, Bus, CoreBase, CursorSource as CursorSource$1, DispatchContext, Gate, GateContextBase, GateNoticeOptions, GuildPermissionsContext, Initializeable, Notice, PaginatorBase, PaginatorConfig, PermissionNoticeOverrides, PermissionScope, RepliableHandler as RepliableHandler$1, RequiredOf, ResolvedEmoji, SelectMenuKind, SlashRegistry, Subscriber as Subscriber$1, SubscriptionKey, WebhookLog as WebhookLog$1 } from "@seedcord/core";
2
+ import { WinstonConsoleSink, WinstonFileSink } from "@seedcord/logger/node";
3
+ import { AnyCustomId, AutocompletableNames, AutocompleteRouteBrand, CacheFor, ChoiceValueOf, ComponentDefsBrand, ComponentKindBrand, ContextMenuKindBrand, ContextMenuLeaves, ContextMenuNamesBrand, EntryFor, FocusedField, GateFitsWith, HasComponentDefs, Initializeable, MatchArms, MenuCacheFor, NamesFor, PageCursor, SingleParams, SlashOptions as SlashOptions$1, SlashRouteBrand } from "@seedcord/core/internal";
4
+ import { ArraySourceBase, AutocompleteOptions, BaseHandler as BaseHandler$1, BaseReplySender, Bus, CoreBase, CursorSourceBase, DispatchContext, Gate, GateContextBase, GateNoticeOptions, GuildPermissionsContext, ModalLike, Notice, PageSourceBase, PaginatorBase, PaginatorConfig, PermissionNoticeOverrides, PermissionScope, RepliableHandler as RepliableHandler$1, RequiredOf, ResolvedEmoji, SelectMenuKind, SlashRegistry, Subscriber as Subscriber$1, SubscriptionKey, WebhookLog as WebhookLog$1 } from "@seedcord/core";
4
5
  import { Logger } from "@seedcord/logger";
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
+ 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, ModalSubmitFields, ModalSubmitInteraction, Role, RoleSelectMenuInteraction, StringSelectMenuInteraction, TextChannel, User, UserContextMenuCommandInteraction, UserSelectMenuInteraction } from "discord.js";
6
7
  import { Plugin as Plugin$1, PluginLifecycleSpec, PluginOptions, PluginOptions as PluginOptions$1 } from "@seedcord/core/plugin";
7
- import { CoordinatedShutdown, CoordinatedStartup, Pluggable } from "@seedcord/core/node/internal";
8
- import { SeedcordBrand, SeedcordInstance } from "@seedcord/types/internal";
8
+ import { CoordinatedShutdown, CoordinatedStartup, Pluggable } from "@seedcord/core/node";
9
+ import { CommandRegistry } from "@seedcord/core/node/internal";
10
+ import { HostAugmentTarget, HostVersion, SeedcordBrand, SeedcordInstance } from "@seedcord/types/internal";
9
11
  import { BotConfig, Config, DeferOpts, EmojiMap, EventFrequency, HealthCheckOption, HmrAware, HmrUpdateEvent, IRateLimiter, ReplyResponse, SendOpts, TypedOmit } from "@seedcord/types";
10
12
  import { REST } from "@discordjs/rest";
11
13
  export * from "@seedcord/errors";
@@ -22,8 +24,8 @@ declare module '@seedcord/core/internal' {
22
24
  unhandledEventError: {
23
25
  error: Error;
24
26
  };
25
- /** Triggered for every client event the bot receives, before its handlers run. */
26
- anyEvent: { [Name in keyof ClientEvents]: {
27
+ /** Triggered before an event's handlers run. An event that no handler registered never triggers it. */
28
+ eventDispatching: { [Name in keyof ClientEvents]: {
27
29
  name: Name;
28
30
  args: ClientEvents[Name];
29
31
  }; }[keyof ClientEvents];
@@ -76,37 +78,140 @@ interface GatewayConfig extends Config {
76
78
  healthCheck?: HealthCheckOption;
77
79
  }
78
80
  //#endregion
81
+ //#region src/bot/controllers/EventDispatcher.d.ts
82
+ /**
83
+ * Interactions route through InteractionDispatcher.
84
+ *
85
+ * @internal
86
+ */
87
+ declare class EventDispatcher implements Initializeable, HmrAware {
88
+ protected core: Core;
89
+ private readonly logger;
90
+ private isInitialized;
91
+ private readonly eventMap;
92
+ private readonly middlewares;
93
+ private readonly executedOnceHandlers;
94
+ private readonly attachedEvents;
95
+ private readonly inFlight;
96
+ private draining;
97
+ private loading;
98
+ private readonly loadedHandlers;
99
+ private readonly loadedMiddlewares;
100
+ private readonly hmrHandler?;
101
+ constructor(core: Core);
102
+ private getArtifacts;
103
+ init(): Promise<void>;
104
+ private reportLoad;
105
+ private loadHandlers;
106
+ private loadMiddlewares;
107
+ /** @internal */
108
+ onHmr(event: HmrUpdateEvent): Promise<void>;
109
+ private unregisterHandler;
110
+ private unregisterMiddleware;
111
+ private registerMiddleware;
112
+ private runMiddlewares;
113
+ private isEventHandlerClass;
114
+ private isMiddlewareClass;
115
+ private registerHandler;
116
+ private attachToClient;
117
+ private attachListener;
118
+ stopAccepting(): void;
119
+ drain(timeoutMs: number): Promise<void>;
120
+ private processEvent;
121
+ private processHandler;
122
+ }
123
+ //#endregion
124
+ //#region src/bot/controllers/InteractionDispatcher.d.ts
125
+ declare class InteractionDispatcher implements Initializeable, HmrAware {
126
+ protected core: Core;
127
+ private readonly logger;
128
+ private isInitialized;
129
+ private readonly slashMap;
130
+ private readonly buttonMap;
131
+ private readonly modalMap;
132
+ private readonly stringSelectMap;
133
+ private readonly userSelectMap;
134
+ private readonly roleSelectMap;
135
+ private readonly channelSelectMap;
136
+ private readonly mentionableSelectMap;
137
+ private readonly messageContextMenuMap;
138
+ private readonly userContextMenuMap;
139
+ private readonly autocompleteMap;
140
+ private readonly handlerFiles;
141
+ private readonly keysToIgnore;
142
+ private readonly middlewares;
143
+ private readonly inFlight;
144
+ private draining;
145
+ private loading;
146
+ private readonly loadedHandlers;
147
+ private readonly loadedMiddlewares;
148
+ private readonly hmrHandler?;
149
+ private readonly routeTypes;
150
+ constructor(core: Core);
151
+ warnUnhandledRoutes(commandLeaves: Iterable<string>): void;
152
+ warnUnhandledContextMenuRoutes(leaves: ContextMenuLeaves): void;
153
+ private getArtifacts;
154
+ init(): Promise<void>;
155
+ private reportLoad;
156
+ private loadHandlers;
157
+ private loadMiddlewares;
158
+ private registerMiddleware;
159
+ private isHandlerClass;
160
+ private isMiddlewareClass;
161
+ private registerHandler;
162
+ onHmr(event: HmrUpdateEvent): Promise<void>;
163
+ private unregisterHandler;
164
+ private unregisterMiddleware;
165
+ private attachToClient;
166
+ stopAccepting(): void;
167
+ drain(timeoutMs: number): Promise<void>;
168
+ private handleCustomIdInteraction;
169
+ private processInteraction;
170
+ private answer;
171
+ private buildHandler;
172
+ private runMiddlewares;
173
+ private gateRefusal;
174
+ private handleInteraction;
175
+ private handleSlashCommand;
176
+ private handleButton;
177
+ private handleModal;
178
+ private handleStringSelectMenu;
179
+ private handleUserSelectMenu;
180
+ private handleRoleSelectMenu;
181
+ private handleChannelSelectMenu;
182
+ private handleMentionableSelectMenu;
183
+ private handleMessageContextMenu;
184
+ private handleUserContextMenu;
185
+ private handleAutocomplete;
186
+ }
187
+ //#endregion
79
188
  //#region src/bot/Bot.d.ts
189
+ declare const loggerSlot: unique symbol;
190
+ declare const initSlot: unique symbol;
191
+ declare const controllersSlot: unique symbol;
192
+ interface Controllers {
193
+ readonly interactions?: InteractionDispatcher | undefined;
194
+ readonly events?: EventDispatcher | undefined;
195
+ readonly commandRegistry?: CommandRegistry | undefined;
196
+ }
80
197
  /**
81
198
  * The Discord client and its controllers. Access it through `core.bot`.
82
199
  */
83
- declare const loggerSlot: unique symbol;
84
- declare class Bot implements Initializeable, HmrAware {
200
+ declare class Bot implements HmrAware {
201
+ #private;
85
202
  readonly botToken: string;
86
- private readonly logger;
87
203
  /** @internal */
88
204
  readonly [loggerSlot]: Logger;
89
- private isInitialized;
90
- private readonly intents;
91
- private readonly _client;
92
- private readonly interactions?;
93
- private readonly events?;
94
- private readonly emojiInjector;
95
- private readonly commandRegistry?;
96
205
  /** @internal */
97
206
  onHmr(event: HmrUpdateEvent): Promise<void>;
98
207
  /** @internal */
99
208
  constructor(core: Core);
100
- private applicationId;
101
- private registerShutdownTasks;
102
- private stopAccepting;
103
- private drain;
104
209
  /** @internal */
105
- init(): Promise<void>;
210
+ get [controllersSlot](): Controllers;
106
211
  /** @internal */
107
- stop(): Promise<void>;
108
- private login;
109
- private logout;
212
+ get applicationId(): string;
213
+ /** @internal */
214
+ [initSlot](): Promise<void>;
110
215
  get client(): Client;
111
216
  }
112
217
  //#endregion
@@ -739,9 +844,15 @@ declare abstract class SlashHandler<Route extends keyof SlashRegistry, Cache ext
739
844
  /** @internal */
740
845
  readonly [SlashRouteBrand]?: Route;
741
846
  /**
742
- * The typed options for this command's route. Required options drop the null, choices narrow to their
743
- * literal union, and only the getters for kinds this command actually uses appear. Use `this.event.options`
744
- * directly for anything outside this view, such as narrowing a channel option by type.
847
+ * The typed options for this command's route. Only the getters for kinds this command declares appear.
848
+ * Each getter's name argument is restricted to that command's options of its kind.
849
+ *
850
+ * - A required option drops the null.
851
+ * - Choices narrow to their literal union.
852
+ * - A channel option declared with `addChannelTypes` narrows to those types.
853
+ *
854
+ * Use `this.event.options` directly for anything outside this view, such as `getSubcommand()`.
855
+ * However, for the common case, the methods in this would suffice.
745
856
  */
746
857
  protected get options(): SlashOptions<Route, Cache>;
747
858
  /**
@@ -761,8 +872,8 @@ declare abstract class SlashHandler<Route extends keyof SlashRegistry, Cache ext
761
872
  * class ModHandler extends SlashHandler<'ban' | 'kick'> {
762
873
  * async execute() {
763
874
  * await this.match({
764
- * ban: (options) => this.event.guild?.members.ban(options.getUser('target', true).id),
765
- * kick: (options) => this.event.guild?.members.kick(options.getUser('member', true).id)
875
+ * ban: (options) => this.event.guild?.members.ban(options.getUser('target').id),
876
+ * kick: (options) => this.event.guild?.members.kick(options.getUser('member').id)
766
877
  * });
767
878
  * }
768
879
  * }
@@ -772,6 +883,8 @@ declare abstract class SlashHandler<Route extends keyof SlashRegistry, Cache ext
772
883
  }
773
884
  //#endregion
774
885
  //#region src/handlers/interaction/ContextMenuHandler.d.ts
886
+ type UserMenuArms<Names extends NamesFor<ApplicationCommandType.User>, Ret> = { [Name in Names]: (target: User, member: CacheTypeReducer<MenuCacheFor<ApplicationCommandType.User, Name>, GuildMember, APIInteractionGuildMember> | null) => Promisable<Ret>; };
887
+ type MessageMenuArms<Names extends NamesFor<ApplicationCommandType.Message>, Ret> = { [Name in Names]: (target: Message<BooleanCache<MenuCacheFor<ApplicationCommandType.Message, Name>>>) => Promisable<Ret>; };
775
888
  /**
776
889
  * Base class for a user context-menu command handler (right-click a user).
777
890
  *
@@ -799,6 +912,34 @@ declare abstract class UserContextMenuHandler<Names extends NamesFor<Application
799
912
  protected get target(): User;
800
913
  /** The right-clicked user's guild member, null outside a guild. */
801
914
  protected get targetMember(): CacheTypeReducer<Cache, GuildMember, APIInteractionGuildMember> | null;
915
+ /** Which of the registered commands fired. */
916
+ protected get commandName(): Names;
917
+ /**
918
+ * Run the arm for whichever command fired. Use this only when the handler is registered for several
919
+ * names.
920
+ *
921
+ * Provide one arm per registered name, keyed by the name Discord shows in the right-click menu. Each
922
+ * arm receives the clicked user and that user's guild member, both narrowed to the cache state of that
923
+ * one command. The arms must cover every name in the generic. A missing name or an unknown key is a
924
+ * compile error.
925
+ *
926
+ * @param arms - One handler per registered command name.
927
+ * @returns The result of the arm that ran.
928
+ *
929
+ * @example
930
+ * ```ts
931
+ * \@UserContextMenuRoute('View Profile', 'Warn')
932
+ * class Moderation extends UserContextMenuHandler<'View Profile' | 'Warn'> {
933
+ * async execute() {
934
+ * await this.match({
935
+ * 'View Profile': (user) => this.reply(`Profile for ${user.tag}.`),
936
+ * Warn: (user, member) => this.reply(`Warned ${member?.displayName ?? user.tag}.`)
937
+ * });
938
+ * }
939
+ * }
940
+ * ```
941
+ */
942
+ protected match<Ret>(arms: UserMenuArms<Names, Ret>): Promise<Ret>;
802
943
  }
803
944
  /**
804
945
  * Base class for a message context-menu command handler (right-click a message).
@@ -825,6 +966,33 @@ declare abstract class MessageContextMenuHandler<Names extends NamesFor<Applicat
825
966
  /** @internal */
826
967
  readonly [ContextMenuNamesBrand]?: Names;
827
968
  protected get target(): Message<BooleanCache<Cache>>;
969
+ /** Which of the registered commands fired. */
970
+ protected get commandName(): Names;
971
+ /**
972
+ * Run the arm for whichever command fired. Use this only when the handler is registered for several
973
+ * names.
974
+ *
975
+ * Provide one arm per registered name, keyed by the name Discord shows in the right-click menu. Each
976
+ * arm receives the clicked message, narrowed to the cache state of that one command. The arms must
977
+ * cover every name in the generic. A missing name or an unknown key is a compile error.
978
+ *
979
+ * @param arms - One handler per registered command name.
980
+ * @returns The result of the arm that ran.
981
+ *
982
+ * @example
983
+ * ```ts
984
+ * \@MessageContextMenuRoute('Report Message', 'Pin Message')
985
+ * class MessageTools extends MessageContextMenuHandler<'Report Message' | 'Pin Message'> {
986
+ * async execute() {
987
+ * await this.match({
988
+ * 'Report Message': (message) => this.report(message),
989
+ * 'Pin Message': (message) => message.pin()
990
+ * });
991
+ * }
992
+ * }
993
+ * ```
994
+ */
995
+ protected match<Ret>(arms: MessageMenuArms<Names, Ret>): Promise<Ret>;
828
996
  }
829
997
  //#endregion
830
998
  //#region src/handlers/interaction/AutocompleteHandler.d.ts
@@ -991,8 +1159,8 @@ declare abstract class ButtonHandler<Defs extends readonly AnyCustomId[], Cache
991
1159
  *
992
1160
  * Register the customId definitions this handler decodes with `@ModalRoute`, list the same ones in the
993
1161
  * generic, then read `this.params` for a single route or `this.match` for several. Read the submitted
994
- * inputs from `this.event.fields`, and reply through the handler members. Discord forbids opening a modal in
995
- * response to a modal, so `showModal` fails compilation on this kind.
1162
+ * inputs from `this.fields`. Reply through the handler members. `showModal` fails compilation on this kind,
1163
+ * because Discord forbids opening a modal in response to a modal.
996
1164
  *
997
1165
  * @typeParam Defs - The customId definitions this handler decodes, e.g. `[typeof ConfigId]`.
998
1166
  * @typeParam Cache - The interaction cache state, `'cached'` by default.
@@ -1003,7 +1171,7 @@ declare abstract class ButtonHandler<Defs extends readonly AnyCustomId[], Cache
1003
1171
  * class ConfigModal extends ModalHandler<[typeof ConfigId]> {
1004
1172
  * async execute() {
1005
1173
  * const { guildId } = this.params;
1006
- * const name = this.event.fields.getTextInputValue('name');
1174
+ * const name = this.fields.getTextInputValue('name');
1007
1175
  * await this.reply(`saved ${name} for ${guildId}`);
1008
1176
  * }
1009
1177
  * }
@@ -1012,6 +1180,8 @@ declare abstract class ButtonHandler<Defs extends readonly AnyCustomId[], Cache
1012
1180
  declare abstract class ModalHandler<Defs extends readonly AnyCustomId[], Cache extends CacheType = 'cached'> extends ComponentHandler<ModalSubmitInteraction<Cache>, Defs> {
1013
1181
  /** @internal */
1014
1182
  readonly [ComponentKindBrand]?: 'modal';
1183
+ /** The fields this modal submitted, read by custom id. */
1184
+ protected get fields(): ModalSubmitFields<Cache>;
1015
1185
  /** Rewrite the message this modal was opened from. Throws when a command opened the modal. */
1016
1186
  protected update(response: GatewayReplyResponse | string): Promise<SentMessage>;
1017
1187
  /** Acknowledge the submit without changing the source message. Throws when a command opened the modal. */
@@ -1020,14 +1190,18 @@ declare abstract class ModalHandler<Defs extends readonly AnyCustomId[], Cache e
1020
1190
  }
1021
1191
  //#endregion
1022
1192
  //#region src/handlers/interaction/components/SelectMenuHandler.d.ts
1193
+ type SelectKey = 'values' | 'users' | 'members' | 'roles' | 'channels';
1194
+ type EventMember<Kind extends SelectMenuKind, Cache extends CacheType, Key extends SelectKey> = Key extends keyof SelectMenuInteractionFor<Kind, Cache> ? SelectMenuInteractionFor<Kind, Cache>[Key] : never;
1023
1195
  type SelectMenuInteractionFor<SelectMenu extends SelectMenuKind, Cache extends CacheType = CacheType> = SelectMenu extends SelectMenuKind.String ? StringSelectMenuInteraction<Cache> : SelectMenu extends SelectMenuKind.User ? UserSelectMenuInteraction<Cache> : SelectMenu extends SelectMenuKind.Role ? RoleSelectMenuInteraction<Cache> : SelectMenu extends SelectMenuKind.Channel ? ChannelSelectMenuInteraction<Cache> : SelectMenu extends SelectMenuKind.Mentionable ? MentionableSelectMenuInteraction<Cache> : never;
1024
1196
  /**
1025
1197
  * Base class for a select menu handler.
1026
1198
  *
1027
- * Pass the select kind first and the customId definitions second, the same order as `@SelectMenuRoute`,
1028
- * so `this.event` and `this.event.values` are narrowed to that kind. Read `this.params` for a single
1029
- * route or `this.match` for several, and reply through the handler members or rewrite the source message
1030
- * with `this.update`.
1199
+ * Pass the select kind first and the customId definitions second, the same order as `@SelectMenuRoute`.
1200
+ * Read the picked ids from `this.values`. The kind decides which of `this.users`, `this.members`,
1201
+ * `this.roles`, and `this.channels` this handler carries. The rest are `never`.
1202
+ *
1203
+ * Read `this.params` for a single route or `this.match` for several. Reply through the handler members, or
1204
+ * rewrite the source message with `this.update`.
1031
1205
  *
1032
1206
  * @typeParam Kind - The select kind from {@link SelectMenuKind}, e.g. `SelectMenuKind.User`.
1033
1207
  * @typeParam Defs - The customId definitions this handler decodes, e.g. `[typeof AssignId]`.
@@ -1039,7 +1213,7 @@ type SelectMenuInteractionFor<SelectMenu extends SelectMenuKind, Cache extends C
1039
1213
  * class AssignSelect extends SelectMenuHandler<SelectMenuKind.User, [typeof AssignId]> {
1040
1214
  * async execute() {
1041
1215
  * const { roleId } = this.params;
1042
- * await this.reply(`assigning ${this.event.values.length} member(s) to <@&${roleId}>`);
1216
+ * await this.reply(`assigning ${this.users.size} member(s) to <@&${roleId}>`);
1043
1217
  * }
1044
1218
  * }
1045
1219
  * ```
@@ -1047,6 +1221,17 @@ type SelectMenuInteractionFor<SelectMenu extends SelectMenuKind, Cache extends C
1047
1221
  declare abstract class SelectMenuHandler<Kind extends SelectMenuKind, Defs extends readonly AnyCustomId[], Cache extends CacheType = 'cached'> extends ComponentHandler<SelectMenuInteractionFor<Kind, Cache>, Defs> {
1048
1222
  /** @internal */
1049
1223
  readonly [ComponentKindBrand]?: Kind;
1224
+ private eventMember;
1225
+ /** The ids this select picked. */
1226
+ protected get values(): string[];
1227
+ /** The users this select picked. */
1228
+ protected get users(): EventMember<Kind, Cache, 'users'>;
1229
+ /** The guild members behind the picked users. Discord resolves these only inside a guild. */
1230
+ protected get members(): EventMember<Kind, Cache, 'members'>;
1231
+ /** The roles this select picked. */
1232
+ protected get roles(): EventMember<Kind, Cache, 'roles'>;
1233
+ /** The channels this select picked. */
1234
+ protected get channels(): EventMember<Kind, Cache, 'channels'>;
1050
1235
  }
1051
1236
  //#endregion
1052
1237
  //#region src/bot/decorators/Middlewares.d.ts
@@ -1152,7 +1337,7 @@ declare class GatewayEmoji<Source extends SavedEmojiType = SavedEmojiType> exten
1152
1337
  type InjectedEmojiMap = { [K in keyof EmojiMap]: EmojiMap[K] extends 'guild' ? GatewayEmoji<GuildEmoji> : GatewayEmoji<ApplicationEmoji>; };
1153
1338
  /**
1154
1339
  * The bot's resolved emojis, keyed by {@link EmojiMap}. Filled by {@link EmojiInjector} during startup.
1155
- * A read before that throws.
1340
+ * Throws if you read a key the injector did not fill.
1156
1341
  */
1157
1342
  declare const Emojis: InjectedEmojiMap;
1158
1343
  //#endregion
@@ -1344,7 +1529,7 @@ interface DefaultConfirmOptions extends ConfirmOptions {
1344
1529
  * \@SlashRoute('ban')
1345
1530
  * class BanHandler extends SlashHandler<'ban'> {
1346
1531
  * async execute() {
1347
- * const target = this.options.getUser('target', true);
1532
+ * const target = this.options.getUser('target');
1348
1533
  * if (!(await getConfirmation(this, `Ban ${target.tag}? This cannot be undone.`))) return;
1349
1534
  * await this.event.guild?.members.ban(target.id);
1350
1535
  * }
@@ -1395,7 +1580,7 @@ declare function getConfirmation(handler: RepliableHandler<NonModalInteraction>,
1395
1580
  * }
1396
1581
  * }
1397
1582
  *
1398
- * const target = this.options.getUser('target', true);
1583
+ * const target = this.options.getUser('target');
1399
1584
  * const confirmed = await getConfirmation(
1400
1585
  * this,
1401
1586
  * (ids) => ({ components: [new BanPrompt(`Ban ${target.tag}?`).component, new ConfirmRow(ids).component] }),
@@ -1452,15 +1637,29 @@ declare class Paginator<Item, const Prefix extends string> extends PaginatorBase
1452
1637
  readonly Handler: PaginatorHandlerCtor<Prefix>;
1453
1638
  constructor(config: PaginatorConfig<Item, Prefix, PageContext>);
1454
1639
  /**
1455
- * Render page 0 and send it through the handler's sender, which picks reply, edit, or followUp from its
1456
- * ack state.
1640
+ * Render a page as a {@link ReplyResponse} without sending anything.
1641
+ *
1642
+ * @param handler - The handler rendering the page, normally `this`.
1643
+ * @param n - The zero-based page.
1644
+ */
1645
+ page(handler: RepliableHandler<Repliables>, n: number): Promise<ReplyResponse>;
1646
+ /**
1647
+ * Send a page through the handler's sender. The sender picks reply, edit, or followUp from its ack state.
1457
1648
  *
1458
1649
  * @param handler - The handler starting the paginator, normally `this`.
1650
+ * @param n - The zero-based page to open on.
1459
1651
  */
1460
- start(handler: RepliableHandler<Repliables>): Promise<Message>;
1652
+ start(handler: RepliableHandler<Repliables>, n?: number): Promise<SentMessage>;
1461
1653
  }
1462
1654
  //#endregion
1463
1655
  //#region src/pagination/sources.d.ts
1656
+ /**
1657
+ * The one method a paginator calls on a source, once per click. Implement it for a source neither shipped
1658
+ * one covers.
1659
+ *
1660
+ * @typeParam Item - The item type the source pages over.
1661
+ */
1662
+ type PageSource<Item> = PageSourceBase<Item, PageContext>;
1464
1663
  /**
1465
1664
  * A source for a bounded list you can load whole. It loads the full list on every click, then slices the
1466
1665
  * page, so the real total is known (a real last button, "Page X of Y"). Cache inside your loader if the
@@ -1468,7 +1667,7 @@ declare class Paginator<Item, const Prefix extends string> extends PaginatorBase
1468
1667
  *
1469
1668
  * @typeParam Item - The item type, inferred from the loader's return.
1470
1669
  */
1471
- declare class ArraySource<Item> extends ArraySource$1<Item, PageContext> {}
1670
+ declare class ArraySource<Item> extends ArraySourceBase<Item, PageContext> {}
1472
1671
  /**
1473
1672
  * A source for a large or unknown-length set you fetch one page at a time (SQL LIMIT/OFFSET, a paged API).
1474
1673
  * The fetcher receives the page index and the page size and reports whether a next page exists. A cursor
@@ -1477,7 +1676,7 @@ declare class ArraySource<Item> extends ArraySource$1<Item, PageContext> {}
1477
1676
  *
1478
1677
  * @typeParam Item - The item type, inferred from the fetcher's slice.
1479
1678
  */
1480
- declare class CursorSource<Item> extends CursorSource$1<Item, PageContext> {}
1679
+ declare class CursorSource<Item> extends CursorSourceBase<Item, PageContext> {}
1481
1680
  //#endregion
1482
1681
  //#region src/subscribers/index.d.ts
1483
1682
  /**
@@ -1526,9 +1725,9 @@ declare class Seedcord extends Pluggable<'gateway', 'server'> implements Core, S
1526
1725
  /** @internal */
1527
1726
  readonly [SeedcordBrand] = true;
1528
1727
  /** @internal */
1529
- readonly augmentTarget = "@seedcord/gateway";
1728
+ readonly [HostAugmentTarget] = "@seedcord/gateway";
1530
1729
  /** @internal */
1531
- readonly version: string;
1730
+ readonly [HostVersion]: string;
1532
1731
  private readonly healthCheck?;
1533
1732
  private readonly hmrManager;
1534
1733
  /** @see {@link Bus} */
@@ -1538,6 +1737,8 @@ declare class Seedcord extends Pluggable<'gateway', 'server'> implements Core, S
1538
1737
  readonly bot: Bot;
1539
1738
  /** The discord.js client's REST client. Its token is set during the Login phase. */
1540
1739
  readonly rest: REST;
1740
+ /** The bot's Discord application id. Throws if you read it before login. */
1741
+ get applicationId(): string;
1541
1742
  /** @see {@link IRateLimiter} */
1542
1743
  readonly rateLimiter: IRateLimiter;
1543
1744
  /**
@@ -1547,7 +1748,7 @@ declare class Seedcord extends Pluggable<'gateway', 'server'> implements Core, S
1547
1748
  constructor(config: GatewayConfig);
1548
1749
  /** The bot's discord username, populated after login. */
1549
1750
  get username(): string | undefined;
1550
- protected static reset(): void;
1751
+ protected static reset(host?: object): boolean;
1551
1752
  private registerStartupTasks;
1552
1753
  /**
1553
1754
  * Starts the bot and runs all initialization tasks
@@ -1562,5 +1763,5 @@ declare class Seedcord extends Pluggable<'gateway', 'server'> implements Core, S
1562
1763
  /** Package version */
1563
1764
  declare const version: string;
1564
1765
  //#endregion
1565
- export { ArraySource, AssignRoleNoticeOverrides, AutocompleteHandler, BaseHandler, ButtonHandler, type CheckPermissionOptions, ComponentHandler, type ConfirmOptions, type Core, CursorSource, type DefaultConfirmOptions, Emojis, type EventGateContext, EventHandler, EventMiddleware, type EventSpec, type EventsConfig, type GateContext, Gated, type GatewayBotConfig, type GatewayConfig, GatewayEmoji, type GatewayFile, type GatewayPluginOptions, type GatewayReplyResponse, HasPermsToAssignOptions, IgnoreBots, type InjectedEmojiMap, type InteractionGateContext, InteractionHandler, InteractionMiddleware, MessageContextMenuHandler, 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, UserContextMenuHandler, type ValidEventTypes, type ValidInteractionTypes, type ValidNonInteractionKeys, WebhookLog, checkBotPermissions, checkPermissions, getConfirmation, hasPermsToAssign, version };
1766
+ export { ArraySource, AssignRoleNoticeOverrides, AutocompleteHandler, BaseHandler, ButtonHandler, type CheckPermissionOptions, ComponentHandler, type ConfirmOptions, type Core, CursorSource, type DefaultConfirmOptions, Emojis, type EventGateContext, EventHandler, EventMiddleware, type EventSpec, type EventsConfig, type GateContext, Gated, type GatewayBotConfig, type GatewayConfig, GatewayEmoji, type GatewayFile, type GatewayPluginOptions, type GatewayReplyResponse, HasPermsToAssignOptions, IgnoreBots, type InjectedEmojiMap, type InteractionGateContext, InteractionHandler, InteractionMiddleware, MessageContextMenuHandler, Middleware, type MiddlewareOptions, MiddlewareType, ModalHandler, Nsfw, type PageContext, type PageSource, Paginator, Plugin, type PluginLifecycleSpec, type PluginOptions, RegisterEvent, type RegisterEventOptions, RepliableHandler, type Repliables, ReplySender, Seedcord, SelectMenuHandler, type SentMessage, SlashHandler, type SlashOptions, Subscriber, UserContextMenuHandler, type ValidEventTypes, type ValidInteractionTypes, type ValidNonInteractionKeys, WebhookLog, WinstonConsoleSink, WinstonFileSink, checkBotPermissions, checkPermissions, getConfirmation, hasPermsToAssign, version };
1566
1767
  //# sourceMappingURL=index.d.mts.map