@seedcord/gateway 0.7.5 → 0.8.0-next.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/README.md +57 -10
- package/dist/index.d.mts +43 -37
- package/dist/index.mjs +199 -180
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<a href="https://seedcord.org">Website</a> ·
|
|
11
11
|
<a href="https://seedcord.org/guide">Guide</a> ·
|
|
12
12
|
<a href="https://seedcord.org/docs">Reference</a> ·
|
|
13
|
-
<a href="https://
|
|
13
|
+
<a href="https://seedcord.org/chat/">Discord</a>
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
<br />
|
|
@@ -23,23 +23,70 @@
|
|
|
23
23
|
|
|
24
24
|
## About
|
|
25
25
|
|
|
26
|
-
`@seedcord/gateway`
|
|
26
|
+
`@seedcord/gateway` is the transport for a gateway bot. It holds a websocket connection to Discord through the discord.js client, which also keeps the cache. That connection carries message, member, voice, and reaction events, and Discord only sends those over a websocket. Pick this transport when your bot reacts to any of them.
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
A bot that only answers commands and components can use [`@seedcord/http`](https://www.npmjs.com/package/@seedcord/http) instead, which keeps no connection open and also runs on Cloudflare Workers.
|
|
29
|
+
|
|
30
|
+
seedcord is pre-1.0, so a minor version can break your bot. Each release's changelog says what changed and how to update.
|
|
29
31
|
|
|
30
32
|
## Installation
|
|
31
33
|
|
|
34
|
+
`pnpm create seedcord` sets up a new bot. To add seedcord to an existing project:
|
|
35
|
+
|
|
32
36
|
```sh
|
|
33
|
-
pnpm add @seedcord/gateway discord.js
|
|
37
|
+
pnpm add @seedcord/gateway discord.js @discordjs/builders envapt
|
|
38
|
+
pnpm add -D seedcord vite typescript
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`discord.js`, `envapt`, and `typescript` are peer dependencies. `seedcord` is the CLI that runs the bot in dev and builds it.
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
`bot.ts` creates the bot and tells it where your handlers are:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { Seedcord } from '@seedcord/gateway';
|
|
49
|
+
import { GatewayIntentBits } from 'discord.js';
|
|
50
|
+
import { Converters, Envapter } from 'envapt';
|
|
51
|
+
|
|
52
|
+
export default new Seedcord({
|
|
53
|
+
bot: {
|
|
54
|
+
clientOptions: { intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] },
|
|
55
|
+
interactions: { path: './handlers' },
|
|
56
|
+
commands: {
|
|
57
|
+
path: './commands',
|
|
58
|
+
guilds: Envapter.getAs('TESTING_GUILD_IDS', Converters.array(), [])
|
|
59
|
+
},
|
|
60
|
+
events: { path: './events' }
|
|
61
|
+
},
|
|
62
|
+
subscribers: { path: null }
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Read your environment through [envapt](https://envapt.materwelon.dev), the way `TESTING_GUILD_IDS` is read above. seedcord loads your `.env` files into envapt, and reads `DISCORD_BOT_TOKEN` from it too. envapt also reads your shell's variables, while `process.env` misses everything in your `.env` files.
|
|
67
|
+
|
|
68
|
+
A file in `events/` reacts to any discord.js client event. Its handler reads the same arguments discord.js passes to `client.on()`:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { EventHandler, RegisterEvent } from '@seedcord/gateway';
|
|
72
|
+
import { Events } from 'discord.js';
|
|
73
|
+
|
|
74
|
+
@RegisterEvent([Events.MessageCreate])
|
|
75
|
+
export class Mentioned extends EventHandler<Events.MessageCreate> {
|
|
76
|
+
public async execute(): Promise<void> {
|
|
77
|
+
const [message] = this.event;
|
|
78
|
+
if (message.mentions.users.has(message.client.user.id)) await message.reply('hey');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
34
81
|
```
|
|
35
82
|
|
|
36
|
-
|
|
83
|
+
Slash commands, components, checks, and plugins work the same way as on http. The [guide](https://seedcord.org/guide) covers them.
|
|
37
84
|
|
|
38
85
|
## What it adds over the core
|
|
39
86
|
|
|
40
|
-
Everything in `@seedcord/core
|
|
87
|
+
Everything in [`@seedcord/core`](https://www.npmjs.com/package/@seedcord/core), plus:
|
|
41
88
|
|
|
42
|
-
- `Seedcord`,
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
89
|
+
- `Seedcord`, which connects to Discord and holds the discord.js client
|
|
90
|
+
- handlers that read discord.js objects, like a `ChatInputCommandInteraction`
|
|
91
|
+
- event handlers for every discord.js client event, through `EventHandler` and `@RegisterEvent`
|
|
92
|
+
- `getConfirmation`, which shows buttons and waits for the answer in one `await`
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import { WinstonConsoleSink, WinstonFileSink } from "@seedcord/logger/node";
|
|
3
|
-
import { AutocompletableNames, AutocompleteRouteBrand, CacheFor, ChoiceValueOf, ComponentDefsBrand, ComponentKindBrand, ContextMenuKindBrand, ContextMenuLeaves, ContextMenuNamesBrand, EntryFor, FocusedField, GateFitsWith, HasComponentDefs, Initializeable, MatchArms, MenuCacheFor, MiddlewareKindsBrand, NamesFor, PageCursor, SingleParams, SlashOptions as SlashOptions$1, SlashRouteBrand } from "@seedcord/core/internal";
|
|
3
|
+
import { AutocompletableNames, AutocompleteRouteBrand, CacheFor, ChoiceValueOf, CommandRegistry, ComponentDefsBrand, ComponentKindBrand, ContextMenuKindBrand, ContextMenuLeaves, ContextMenuNamesBrand, EntryFor, FixedScope, FocusedField, GateFitsWith, HasComponentDefs, Initializeable, MatchArms, MenuCacheFor, MiddlewareKindsBrand, NamesFor, PageCursor, SingleParams, SlashOptions as SlashOptions$1, SlashRouteBrand } from "@seedcord/core/internal";
|
|
4
4
|
import { ArraySourceBase, AutocompleteOptions, BaseHandler as BaseHandler$1, BaseReplySender, Bus, CoreBase, CursorSourceBase, DispatchContext, DispatchOutcome, DispatchResult, EventDispatchResult, Gate, GateContextBase, GateNoticeOptions, GuildPermissionsContext, HandlerOutcome, InteractionKind, MiddlewareKind, ModalLike, Notice, PageSourceBase, PaginatorBase, PaginatorConfig, PermissionNoticeOverrides, PermissionScope, RepliableHandler as RepliableHandler$1, RequiredOf, ResolvedEmoji, SlashRegistry, Subscriber as Subscriber$1, SubscriptionKey, WebhookLog as WebhookLog$1 } from "@seedcord/core";
|
|
5
5
|
import { Logger } from "@seedcord/logger";
|
|
6
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";
|
|
7
7
|
import { Plugin as Plugin$1, PluginLifecycleSpec, PluginOptions, PluginOptions as PluginOptions$1 } from "@seedcord/core/plugin";
|
|
8
|
-
import { CoordinatedShutdown, CoordinatedStartup,
|
|
9
|
-
import { CommandRegistry } from "@seedcord/core/node/internal";
|
|
8
|
+
import { CoordinatedShutdown, CoordinatedStartup, ServerHost } from "@seedcord/core/node";
|
|
10
9
|
import { HostAugmentTarget, HostVersion, SeedcordBrand, SeedcordInstance } from "@seedcord/types/internal";
|
|
10
|
+
import { HmrModuleHandler } from "@seedcord/core/hmr";
|
|
11
11
|
import { AnyCustomId } from "@seedcord/custom-id";
|
|
12
12
|
import { BotConfig, Config, DeferOpts, EmojiMap, EventFrequency, HealthCheckOption, HmrAware, HmrUpdateEvent, IRateLimiter, ReplyResponse, SendOpts, TypedOmit } from "@seedcord/types";
|
|
13
13
|
import { Constructor, IsUnion, NonEmptyTuple, Promisable } from "type-fest";
|
|
@@ -87,8 +87,6 @@ interface GatewayBotConfig extends BotConfig {
|
|
|
87
87
|
*/
|
|
88
88
|
interface GatewayConfig extends Config {
|
|
89
89
|
bot: GatewayBotConfig;
|
|
90
|
-
/** The gateway websocket requires a persistent process. */
|
|
91
|
-
runtime?: 'server';
|
|
92
90
|
/**
|
|
93
91
|
* The health-check server. `false` disables it, `true` or omit for the defaults, an object
|
|
94
92
|
* configures it.
|
|
@@ -111,7 +109,6 @@ declare class EventDispatcher implements Initializeable, HmrAware {
|
|
|
111
109
|
private readonly executedOnceHandlers;
|
|
112
110
|
private readonly attachedEvents;
|
|
113
111
|
private readonly inFlight;
|
|
114
|
-
private draining;
|
|
115
112
|
private loading;
|
|
116
113
|
private readonly loadedHandlers;
|
|
117
114
|
private readonly loadedMiddlewares;
|
|
@@ -149,7 +146,6 @@ declare class InteractionDispatcher implements Initializeable, HmrAware {
|
|
|
149
146
|
private readonly keysToIgnore;
|
|
150
147
|
private readonly middlewares;
|
|
151
148
|
private readonly inFlight;
|
|
152
|
-
private draining;
|
|
153
149
|
private loading;
|
|
154
150
|
private readonly loadedHandlers;
|
|
155
151
|
private readonly loadedMiddlewares;
|
|
@@ -196,7 +192,6 @@ declare class InteractionDispatcher implements Initializeable, HmrAware {
|
|
|
196
192
|
//#endregion
|
|
197
193
|
//#region src/bot/Bot.d.ts
|
|
198
194
|
declare const loggerSlot: unique symbol;
|
|
199
|
-
declare const initSlot: unique symbol;
|
|
200
195
|
declare const controllersSlot: unique symbol;
|
|
201
196
|
interface Controllers {
|
|
202
197
|
readonly interactions?: InteractionDispatcher | undefined;
|
|
@@ -208,7 +203,7 @@ interface Controllers {
|
|
|
208
203
|
*/
|
|
209
204
|
declare class Bot implements HmrAware {
|
|
210
205
|
#private;
|
|
211
|
-
|
|
206
|
+
get botToken(): string;
|
|
212
207
|
/** @internal */
|
|
213
208
|
readonly [loggerSlot]: Logger;
|
|
214
209
|
/** @internal */
|
|
@@ -219,8 +214,6 @@ declare class Bot implements HmrAware {
|
|
|
219
214
|
get [controllersSlot](): Controllers;
|
|
220
215
|
/** @internal */
|
|
221
216
|
get applicationId(): string;
|
|
222
|
-
/** @internal */
|
|
223
|
-
[initSlot](): Promise<void>;
|
|
224
217
|
get client(): Client;
|
|
225
218
|
}
|
|
226
219
|
//#endregion
|
|
@@ -667,7 +660,7 @@ interface EventMiddlewareOptions<Events extends NonEmptyTuple<ValidNonInteractio
|
|
|
667
660
|
* }
|
|
668
661
|
* ```
|
|
669
662
|
*
|
|
670
|
-
* @throws A **SeedcordTypeError**
|
|
663
|
+
* @throws A **SeedcordTypeError** when `priority` is not a finite number.
|
|
671
664
|
*/
|
|
672
665
|
export declare function RegisterEventMiddleware<const Events extends NonEmptyTuple<ValidNonInteractionKeys> = NonEmptyTuple<ValidNonInteractionKeys>>(options?: EventMiddlewareOptions<Events>): (ctor: Constructor<EventMiddleware<Events[number]>>) => void;
|
|
673
666
|
//#endregion
|
|
@@ -733,7 +726,8 @@ export declare class GatewayEmoji<Source extends SavedEmojiType = SavedEmojiType
|
|
|
733
726
|
type InjectedEmojiMap = { [K in keyof EmojiMap]: EmojiMap[K] extends 'guild' ? GatewayEmoji<GuildEmoji> : GatewayEmoji<ApplicationEmoji>; };
|
|
734
727
|
/**
|
|
735
728
|
* The bot's resolved emojis, keyed by {@link EmojiMap}. Filled by {@link EmojiInjector} during startup.
|
|
736
|
-
*
|
|
729
|
+
*
|
|
730
|
+
* @throws A **SeedcordError** when you read a key the injector did not fill.
|
|
737
731
|
*/
|
|
738
732
|
export declare const Emojis: InjectedEmojiMap;
|
|
739
733
|
//#endregion
|
|
@@ -839,7 +833,8 @@ export interface HasPermsToAssignOptions {
|
|
|
839
833
|
* Validates that the bot can assign a target role. Refuses when the target role is above the bot's, is managed, or the bot lacks Manage Roles.
|
|
840
834
|
*
|
|
841
835
|
* @param roleOrOptions - Target role or complete options for the check
|
|
842
|
-
* @throws A
|
|
836
|
+
* @throws A {@link Notice} when the check refuses.
|
|
837
|
+
* @throws A **SeedcordError** when the bot has no role in the guild's role cache.
|
|
843
838
|
*
|
|
844
839
|
* @example
|
|
845
840
|
* ```ts
|
|
@@ -909,14 +904,14 @@ interface DefaultConfirmOptions extends ConfirmOptions {
|
|
|
909
904
|
/**
|
|
910
905
|
* Shows a confirm/cancel prompt with built-in Confirm and Cancel buttons and resolves to `true` only if the
|
|
911
906
|
* invoking user clicks confirm. A cancel click or a timeout resolves to `false`. Gate the action behind it
|
|
912
|
-
* with an early return. A
|
|
913
|
-
* excluded at compile time.
|
|
907
|
+
* with an early return. A {@link ModalHandler} is excluded at compile time.
|
|
914
908
|
*
|
|
915
909
|
* @param handler - The handler to prompt from, `this` inside a non-modal handler.
|
|
916
910
|
* @param prompt - The message shown above the Confirm and Cancel buttons.
|
|
917
911
|
* @param options - Ephemeral flag, timeout, the built-in buttons' labels and style, and the optional
|
|
918
912
|
* `onConfirm`/`onCancel`/`onTimeout` outcome replies that edit the prompt in place.
|
|
919
913
|
* @returns `true` if confirmed, `false` on cancel or timeout.
|
|
914
|
+
* @throws The send error when the prompt fails to send. The handler's fault boundary catches it.
|
|
920
915
|
*
|
|
921
916
|
* @example
|
|
922
917
|
* ```ts
|
|
@@ -936,8 +931,7 @@ export declare function getConfirmation(handler: RepliableHandler<NonModalIntera
|
|
|
936
931
|
/**
|
|
937
932
|
* Shows a confirm/cancel prompt you build yourself and resolves to `true` only if the invoking user clicks
|
|
938
933
|
* confirm. The factory receives the two minted button ids. Set them on your own buttons. A cancel click or a
|
|
939
|
-
* timeout resolves to `false`. A
|
|
940
|
-
* excluded at compile time.
|
|
934
|
+
* timeout resolves to `false`. A {@link ModalHandler} is excluded at compile time.
|
|
941
935
|
*
|
|
942
936
|
* @param handler - The handler to prompt from, `this` inside a non-modal handler.
|
|
943
937
|
* @param prompt - A factory given the minted `{ confirm, cancel }` ids that returns the reply to show. Build
|
|
@@ -945,6 +939,7 @@ export declare function getConfirmation(handler: RepliableHandler<NonModalIntera
|
|
|
945
939
|
* @param options - Ephemeral flag, timeout, and the optional `onConfirm`/`onCancel`/`onTimeout` outcome
|
|
946
940
|
* replies that edit the prompt in place.
|
|
947
941
|
* @returns `true` if confirmed, `false` on cancel or timeout.
|
|
942
|
+
* @throws The send error when the prompt fails to send. The handler's fault boundary catches it.
|
|
948
943
|
*
|
|
949
944
|
* @remarks
|
|
950
945
|
* The prompt is collected in-process, so it does not survive a bot restart. Without an outcome hook the
|
|
@@ -1293,11 +1288,11 @@ export declare abstract class AutocompleteHandler<Route extends keyof SlashRegis
|
|
|
1293
1288
|
*
|
|
1294
1289
|
* Provide one arm per autocompletable field across the registered commands, keyed by field name. Each
|
|
1295
1290
|
* arm receives the focused partial value and a `respond` typed to that field's choice value. The
|
|
1296
|
-
* arms must cover every autocompletable field
|
|
1297
|
-
* focused field with no arm, only reachable from a stale-deployed command, throws at runtime.
|
|
1291
|
+
* arms must cover every autocompletable field. A missing field or an unknown key is a compile error.
|
|
1298
1292
|
*
|
|
1299
1293
|
* @param arms - One handler per autocompletable field, keyed by field name.
|
|
1300
1294
|
* @returns The result of the arm that ran.
|
|
1295
|
+
* @throws A **SeedcordTypeError** with `MatchArmMissing` when the focused field has no arm. Only a stale-deployed command can send one.
|
|
1301
1296
|
*
|
|
1302
1297
|
* @example
|
|
1303
1298
|
* ```ts
|
|
@@ -1348,10 +1343,11 @@ export declare abstract class ComponentHandler<Event extends ComponentInteractio
|
|
|
1348
1343
|
/**
|
|
1349
1344
|
* The decoded params of the single route this handler is registered for.
|
|
1350
1345
|
*
|
|
1351
|
-
* Reading this decodes `this.event.customId` once
|
|
1352
|
-
*
|
|
1353
|
-
*
|
|
1354
|
-
*
|
|
1346
|
+
* Reading this decodes `this.event.customId` once and caches the result. On a handler registered
|
|
1347
|
+
* for several routes this is `never`. Use {@link match} instead.
|
|
1348
|
+
*
|
|
1349
|
+
* @throws A **StaleCustomId** when the wire was encoded under an older shape. The controller boundary turns it into a reply.
|
|
1350
|
+
* @throws An **InvalidCustomId** when the wire is corrupt. The controller boundary turns it into a reply.
|
|
1355
1351
|
*/
|
|
1356
1352
|
protected get params(): SingleParams<Defs>;
|
|
1357
1353
|
/**
|
|
@@ -1360,12 +1356,14 @@ export declare abstract class ComponentHandler<Event extends ComponentInteractio
|
|
|
1360
1356
|
* handler `this.params` is `never`, leaving match as the only way to read the decoded params.
|
|
1361
1357
|
*
|
|
1362
1358
|
* Provide one arm per registered route, keyed by its prefix, and each arm receives that route's own
|
|
1363
|
-
* decoded params. The arms cover every registered route prefix
|
|
1364
|
-
*
|
|
1365
|
-
* corrupt wire throws before an arm body executes.
|
|
1359
|
+
* decoded params. The compiler checks that the arms cover every registered route prefix. `match`
|
|
1360
|
+
* decodes the wire before it runs an arm.
|
|
1366
1361
|
*
|
|
1367
1362
|
* @param arms - One callback per registered route, keyed by prefix.
|
|
1368
1363
|
* @returns The result of the arm that ran.
|
|
1364
|
+
* @throws A **SeedcordTypeError** with `MatchArmMissing` when the wire's prefix has no arm.
|
|
1365
|
+
* @throws A **StaleCustomId** when the wire was encoded under an older shape.
|
|
1366
|
+
* @throws An **InvalidCustomId** when the wire is corrupt.
|
|
1369
1367
|
*
|
|
1370
1368
|
* @example
|
|
1371
1369
|
* ```ts
|
|
@@ -1703,6 +1701,10 @@ type GatewayPluginOptions = TypedOmit<PluginOptions$1, 'transport' | 'runtime'>
|
|
|
1703
1701
|
transport?: 'gateway';
|
|
1704
1702
|
runtime?: 'server';
|
|
1705
1703
|
};
|
|
1704
|
+
declare const GATEWAY_SCOPE: {
|
|
1705
|
+
readonly transport: "gateway";
|
|
1706
|
+
readonly runtime: "server";
|
|
1707
|
+
};
|
|
1706
1708
|
/**
|
|
1707
1709
|
* Base class for a gateway plugin, binding `this.core` to the gateway {@link Core}.
|
|
1708
1710
|
*
|
|
@@ -1714,14 +1716,21 @@ type GatewayPluginOptions = TypedOmit<PluginOptions$1, 'transport' | 'runtime'>
|
|
|
1714
1716
|
export declare abstract class Plugin<Opts extends GatewayPluginOptions = {
|
|
1715
1717
|
transport: 'gateway';
|
|
1716
1718
|
runtime: 'server';
|
|
1717
|
-
}> extends Plugin$1<Opts, Core> {
|
|
1719
|
+
}> extends Plugin$1<Opts, Core, keyof typeof GATEWAY_SCOPE> {
|
|
1720
|
+
/** @internal */
|
|
1721
|
+
protected static readonly [FixedScope]: {
|
|
1722
|
+
readonly transport: "gateway";
|
|
1723
|
+
readonly runtime: "server";
|
|
1724
|
+
};
|
|
1725
|
+
}
|
|
1718
1726
|
//#endregion
|
|
1719
1727
|
//#region src/Seedcord.d.ts
|
|
1720
1728
|
/**
|
|
1721
1729
|
* The gateway bot host. Opens a discord.js gateway session, discovers handlers, and runs
|
|
1722
1730
|
* coordinated startup and shutdown. Attach plugins with `attach()`.
|
|
1723
1731
|
*/
|
|
1724
|
-
export declare class Seedcord extends
|
|
1732
|
+
export declare class Seedcord extends ServerHost<'gateway'> implements SeedcordInstance {
|
|
1733
|
+
#private;
|
|
1725
1734
|
readonly config: GatewayConfig;
|
|
1726
1735
|
/** @internal */
|
|
1727
1736
|
readonly [SeedcordBrand] = true;
|
|
@@ -1729,11 +1738,8 @@ export declare class Seedcord extends Pluggable<'gateway', 'server'> implements
|
|
|
1729
1738
|
readonly [HostAugmentTarget] = "@seedcord/gateway";
|
|
1730
1739
|
/** @internal */
|
|
1731
1740
|
readonly [HostVersion]: string;
|
|
1732
|
-
private readonly healthCheck?;
|
|
1733
|
-
private readonly hmrManager;
|
|
1734
1741
|
/** @see {@link Bus} */
|
|
1735
1742
|
readonly bus: Bus;
|
|
1736
|
-
private readonly subscribers;
|
|
1737
1743
|
/** @see {@link Bot} */
|
|
1738
1744
|
readonly bot: Bot;
|
|
1739
1745
|
/** The discord.js client's REST client. Its token is set during the Login phase. */
|
|
@@ -1744,25 +1750,25 @@ export declare class Seedcord extends Pluggable<'gateway', 'server'> implements
|
|
|
1744
1750
|
readonly rateLimiter: IRateLimiter;
|
|
1745
1751
|
/**
|
|
1746
1752
|
* @param config - Bot configuration including paths and Discord client options
|
|
1747
|
-
* @throws A **SeedcordError**
|
|
1753
|
+
* @throws A **SeedcordError** when another `Seedcord` exists in this process and has not shut down.
|
|
1754
|
+
* @throws A **SeedcordError** when the running Node or Bun is older than the range in `engines`.
|
|
1748
1755
|
*/
|
|
1749
1756
|
constructor(config: GatewayConfig);
|
|
1750
1757
|
/** The bot's discord username, populated after login. */
|
|
1751
1758
|
get username(): string | undefined;
|
|
1752
|
-
|
|
1753
|
-
|
|
1759
|
+
/** @internal */
|
|
1760
|
+
protected openHealth(): Promise<void>;
|
|
1754
1761
|
/**
|
|
1755
1762
|
* Starts the bot and runs all initialization tasks
|
|
1756
1763
|
*
|
|
1757
1764
|
* @returns This Seedcord instance when initialized
|
|
1758
1765
|
*/
|
|
1759
1766
|
start(): Promise<this>;
|
|
1760
|
-
private registerHmrAwareModules;
|
|
1761
1767
|
}
|
|
1762
1768
|
//#endregion
|
|
1763
1769
|
//#region src/version.d.ts
|
|
1764
1770
|
/** Package version */
|
|
1765
1771
|
export declare const version: string;
|
|
1766
1772
|
//#endregion
|
|
1767
|
-
export { type CheckPermissionOptions, type ConfirmOptions, type Core, type DefaultConfirmOptions, type EventGateContext, type EventMiddlewareOptions, type EventSpec, type EventsConfig, type GateContext, type GatewayBotConfig, type GatewayConfig, type GatewayFile, type GatewayPluginOptions, type GatewayReplyResponse, type InjectedEmojiMap, type InteractionGateContext, type PageContext, type PageSource, type PluginLifecycleSpec, type PluginOptions, type RegisterEventOptions, type Repliables, type SentMessage, type SlashOptions, type ValidEventTypes, type ValidInteractionTypes, type ValidNonInteractionKeys, WinstonConsoleSink, WinstonFileSink };
|
|
1773
|
+
export { type CheckPermissionOptions, type ConfirmOptions, type Core, type DefaultConfirmOptions, type EventGateContext, type EventMiddlewareOptions, type EventSpec, type EventsConfig, type GateContext, type GatewayBotConfig, type GatewayConfig, type GatewayFile, type GatewayPluginOptions, type GatewayReplyResponse, HmrModuleHandler, type InjectedEmojiMap, type InteractionGateContext, type PageContext, type PageSource, type PluginLifecycleSpec, type PluginOptions, type RegisterEventOptions, type Repliables, type SentMessage, type SlashOptions, type ValidEventTypes, type ValidInteractionTypes, type ValidNonInteractionKeys, WinstonConsoleSink, WinstonFileSink };
|
|
1768
1774
|
//# sourceMappingURL=index.d.mts.map
|