@seedcord/gateway 0.7.1 → 0.7.3
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 +4 -4
- package/dist/index.d.mts +46 -216
- package/dist/index.mjs +17 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
</div>
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
|
-
<h3>The whole Discord bot,
|
|
9
|
+
<h3>The whole Discord bot, typed end to end</h3>
|
|
10
10
|
<a href="https://seedcord.org">Website</a> ·
|
|
11
|
-
<a href="https://
|
|
12
|
-
<a href="https://
|
|
11
|
+
<a href="https://seedcord.org/guide">Guide</a> ·
|
|
12
|
+
<a href="https://seedcord.org/docs">Reference</a> ·
|
|
13
13
|
<a href="https://discord.gg/DzFxY58WXf">Discord</a>
|
|
14
14
|
</div>
|
|
15
15
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
## About
|
|
25
25
|
|
|
26
|
-
`@seedcord/gateway` runs a seedcord bot over a websocket connection
|
|
26
|
+
`@seedcord/gateway` runs a seedcord bot over a websocket connection through the discord.js client, which also keeps the cache. A gateway connection carries message, member, voice, and reaction events. Discord never posts those to an interactions endpoint. Pick this transport when the bot reacts to any of them.
|
|
27
27
|
|
|
28
28
|
Until v1.0.0, minor versions can break.
|
|
29
29
|
|
package/dist/index.d.mts
CHANGED
|
@@ -10,6 +10,7 @@ import { CommandRegistry } from "@seedcord/core/node/internal";
|
|
|
10
10
|
import { HostAugmentTarget, HostVersion, SeedcordBrand, SeedcordInstance } from "@seedcord/types/internal";
|
|
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
|
+
import { Constructor, IsUnion, NonEmptyTuple, Promisable } from "type-fest";
|
|
13
14
|
import { REST } from "@discordjs/rest";
|
|
14
15
|
export * from "@seedcord/errors";
|
|
15
16
|
export * from "@seedcord/core";
|
|
@@ -282,181 +283,10 @@ type NonModalInteraction = Exclude<Repliables, ModalSubmitInteraction>;
|
|
|
282
283
|
* The gateway base, fixes the core base's `TCore` to the gateway {@link Core} and adds the `getEvent`
|
|
283
284
|
* gate hook.
|
|
284
285
|
*/
|
|
285
|
-
declare abstract class BaseHandler<ValidEvent extends ValidEventTypes> extends BaseHandler$1<ValidEvent, Core> {
|
|
286
|
+
export declare abstract class BaseHandler<ValidEvent extends ValidEventTypes> extends BaseHandler$1<ValidEvent, Core> {
|
|
286
287
|
getEvent(): ValidEvent;
|
|
287
288
|
}
|
|
288
289
|
//#endregion
|
|
289
|
-
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/basic.d.ts
|
|
290
|
-
/**
|
|
291
|
-
Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
|
292
|
-
|
|
293
|
-
@category Class
|
|
294
|
-
*/
|
|
295
|
-
type Constructor<T, Arguments extends unknown[] = any[]> = new (...arguments_: Arguments) => T;
|
|
296
|
-
//#endregion
|
|
297
|
-
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-never.d.ts
|
|
298
|
-
/**
|
|
299
|
-
Returns a boolean for whether the given type is `never`.
|
|
300
|
-
|
|
301
|
-
@link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
|
|
302
|
-
@link https://stackoverflow.com/a/53984913/10292952
|
|
303
|
-
@link https://www.zhenghao.io/posts/ts-never
|
|
304
|
-
|
|
305
|
-
Useful in type utilities, such as checking if something does not occur.
|
|
306
|
-
|
|
307
|
-
@example
|
|
308
|
-
```
|
|
309
|
-
import type {IsNever, And} from 'type-fest';
|
|
310
|
-
|
|
311
|
-
type A = IsNever<never>;
|
|
312
|
-
//=> true
|
|
313
|
-
|
|
314
|
-
type B = IsNever<any>;
|
|
315
|
-
//=> false
|
|
316
|
-
|
|
317
|
-
type C = IsNever<unknown>;
|
|
318
|
-
//=> false
|
|
319
|
-
|
|
320
|
-
type D = IsNever<never[]>;
|
|
321
|
-
//=> false
|
|
322
|
-
|
|
323
|
-
type E = IsNever<object>;
|
|
324
|
-
//=> false
|
|
325
|
-
|
|
326
|
-
type F = IsNever<string>;
|
|
327
|
-
//=> false
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
@example
|
|
331
|
-
```
|
|
332
|
-
import type {IsNever} from 'type-fest';
|
|
333
|
-
|
|
334
|
-
type IsTrue<T> = T extends true ? true : false;
|
|
335
|
-
|
|
336
|
-
// When a distributive conditional is instantiated with `never`, the entire conditional results in `never`.
|
|
337
|
-
type A = IsTrue<never>;
|
|
338
|
-
//=> never
|
|
339
|
-
|
|
340
|
-
// If you don't want that behaviour, you can explicitly add an `IsNever` check before the distributive conditional.
|
|
341
|
-
type IsTrueFixed<T> =
|
|
342
|
-
IsNever<T> extends true ? false : T extends true ? true : false;
|
|
343
|
-
|
|
344
|
-
type B = IsTrueFixed<never>;
|
|
345
|
-
//=> false
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
@category Type Guard
|
|
349
|
-
@category Utilities
|
|
350
|
-
*/
|
|
351
|
-
type IsNever<T> = [T] extends [never] ? true : false;
|
|
352
|
-
//#endregion
|
|
353
|
-
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-equal.d.ts
|
|
354
|
-
/**
|
|
355
|
-
Returns a boolean for whether the two given types are equal.
|
|
356
|
-
|
|
357
|
-
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
358
|
-
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
359
|
-
|
|
360
|
-
Use-cases:
|
|
361
|
-
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
362
|
-
|
|
363
|
-
@example
|
|
364
|
-
```
|
|
365
|
-
import type {IsEqual} from 'type-fest';
|
|
366
|
-
|
|
367
|
-
// This type returns a boolean for whether the given array includes the given item.
|
|
368
|
-
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
369
|
-
type Includes<Value extends readonly any[], Item> =
|
|
370
|
-
Value extends readonly [Value[0], ...infer rest]
|
|
371
|
-
? IsEqual<Value[0], Item> extends true
|
|
372
|
-
? true
|
|
373
|
-
: Includes<rest, Item>
|
|
374
|
-
: false;
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
@category Type Guard
|
|
378
|
-
@category Utilities
|
|
379
|
-
*/
|
|
380
|
-
type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false : false;
|
|
381
|
-
// This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
|
|
382
|
-
type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
|
|
383
|
-
//#endregion
|
|
384
|
-
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/non-empty-tuple.d.ts
|
|
385
|
-
/**
|
|
386
|
-
Matches any non-empty tuple.
|
|
387
|
-
|
|
388
|
-
@example
|
|
389
|
-
```
|
|
390
|
-
import type {NonEmptyTuple} from 'type-fest';
|
|
391
|
-
|
|
392
|
-
const sum = (...numbers: NonEmptyTuple<number>) => numbers.reduce((total, value) => total + value, 0);
|
|
393
|
-
|
|
394
|
-
sum(1, 2, 3);
|
|
395
|
-
// Ok
|
|
396
|
-
|
|
397
|
-
// @ts-expect-error
|
|
398
|
-
sum();
|
|
399
|
-
// Error: Expected at least 1 arguments, but got 0.
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
@see {@link RequireAtLeastOne} for objects
|
|
403
|
-
|
|
404
|
-
@category Array
|
|
405
|
-
*/
|
|
406
|
-
type NonEmptyTuple<T = unknown> = readonly [T, ...T[]];
|
|
407
|
-
//#endregion
|
|
408
|
-
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-union.d.ts
|
|
409
|
-
/**
|
|
410
|
-
Returns a boolean for whether the given type is a union.
|
|
411
|
-
|
|
412
|
-
@example
|
|
413
|
-
```
|
|
414
|
-
import type {IsUnion} from 'type-fest';
|
|
415
|
-
|
|
416
|
-
type A = IsUnion<string | number>;
|
|
417
|
-
//=> true
|
|
418
|
-
|
|
419
|
-
type B = IsUnion<string>;
|
|
420
|
-
//=> false
|
|
421
|
-
```
|
|
422
|
-
*/
|
|
423
|
-
type IsUnion<T> = InternalIsUnion<T>;
|
|
424
|
-
/**
|
|
425
|
-
The actual implementation of `IsUnion`.
|
|
426
|
-
*/
|
|
427
|
-
type InternalIsUnion<T, U = T> = (IsNever<T> extends true ? false : T extends any ? IsEqual<U, T> extends true ? false : true : never) extends (infer Result) ?
|
|
428
|
-
// In some cases `Result` will return `false | true` which is `boolean`,
|
|
429
|
-
// that means `T` has at least two types and it's a union type,
|
|
430
|
-
// so we will return `true` instead of `boolean`.
|
|
431
|
-
boolean extends Result ? true : Result : never; // Should never happen
|
|
432
|
-
//#endregion
|
|
433
|
-
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/promisable.d.ts
|
|
434
|
-
/**
|
|
435
|
-
Create a type that represents either the value or the value wrapped in `PromiseLike`.
|
|
436
|
-
|
|
437
|
-
Use-cases:
|
|
438
|
-
- A function accepts a callback that may either return a value synchronously or may return a promised value.
|
|
439
|
-
- This type could be the return type of `Promise#then()`, `Promise#catch()`, and `Promise#finally()` callbacks.
|
|
440
|
-
|
|
441
|
-
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/31394) if you want to have this type as a built-in in TypeScript.
|
|
442
|
-
|
|
443
|
-
@example
|
|
444
|
-
```
|
|
445
|
-
import type {Promisable} from 'type-fest';
|
|
446
|
-
|
|
447
|
-
async function logger(getLogEntry: () => Promisable<string>): Promise<void> {
|
|
448
|
-
const entry = await getLogEntry();
|
|
449
|
-
console.log(entry);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
await logger(() => 'foo');
|
|
453
|
-
await logger(() => Promise.resolve('bar'));
|
|
454
|
-
```
|
|
455
|
-
|
|
456
|
-
@category Async
|
|
457
|
-
*/
|
|
458
|
-
type Promisable<T> = T | PromiseLike<T>;
|
|
459
|
-
//#endregion
|
|
460
290
|
//#region src/handlers/event/payload.d.ts
|
|
461
291
|
/** @internal */
|
|
462
292
|
type SingleEventPayload<Names extends ValidNonInteractionKeys> = IsUnion<Names> extends true ? never : ClientEvents[Names];
|
|
@@ -485,7 +315,7 @@ type EventMatchArms<Names extends ValidNonInteractionKeys, Ret> = { [Name in Nam
|
|
|
485
315
|
* }
|
|
486
316
|
* ```
|
|
487
317
|
*/
|
|
488
|
-
declare abstract class EventHandler<in out Names extends ValidNonInteractionKeys> extends BaseHandler<ClientEvents[Names]> {
|
|
318
|
+
export declare abstract class EventHandler<in out Names extends ValidNonInteractionKeys> extends BaseHandler<ClientEvents[Names]> {
|
|
489
319
|
private readonly firedEvent;
|
|
490
320
|
constructor(event: ClientEvents[Names], core: Core, dispatch: DispatchContext, eventName?: Names);
|
|
491
321
|
protected readonly event: SingleEventPayload<Names>;
|
|
@@ -529,7 +359,7 @@ declare abstract class EventHandler<in out Names extends ValidNonInteractionKeys
|
|
|
529
359
|
*
|
|
530
360
|
* @typeParam EventName - One or more `ClientEvents` keys. Defaults to every event (catchall).
|
|
531
361
|
*/
|
|
532
|
-
declare abstract class EventMiddleware<in out EventName extends ValidNonInteractionKeys = ValidNonInteractionKeys> extends BaseHandler<ClientEvents[EventName]> {
|
|
362
|
+
export declare abstract class EventMiddleware<in out EventName extends ValidNonInteractionKeys = ValidNonInteractionKeys> extends BaseHandler<ClientEvents[EventName]> {
|
|
533
363
|
private readonly firedEvent;
|
|
534
364
|
constructor(event: ClientEvents[EventName], core: Core, dispatch: DispatchContext, eventName?: EventName);
|
|
535
365
|
protected readonly event: SingleEventPayload<EventName>;
|
|
@@ -610,12 +440,12 @@ type EventSpec<EventKey extends ValidNonInteractionKeys> = readonly [event: Even
|
|
|
610
440
|
* }
|
|
611
441
|
* ```
|
|
612
442
|
*/
|
|
613
|
-
declare function RegisterEvent<const Defs extends readonly EventSpec<ValidNonInteractionKeys>[]>(...defs: Defs): <HandlerCtor extends Constructor<EventHandler<Defs[number][0]>>>(constructor: HandlerCtor) => void;
|
|
443
|
+
export declare function RegisterEvent<const Defs extends readonly EventSpec<ValidNonInteractionKeys>[]>(...defs: Defs): <HandlerCtor extends Constructor<EventHandler<Defs[number][0]>>>(constructor: HandlerCtor) => void;
|
|
614
444
|
//#endregion
|
|
615
445
|
//#region src/bot/ReplySender.d.ts
|
|
616
446
|
type SentMessage = Message;
|
|
617
447
|
/** Writes interaction responses through discord.js. The repliable handler bases and the dispatcher construct it. */
|
|
618
|
-
declare class ReplySender extends BaseReplySender<SentMessage, GatewayFile> {
|
|
448
|
+
export declare class ReplySender extends BaseReplySender<SentMessage, GatewayFile> {
|
|
619
449
|
private readonly interaction;
|
|
620
450
|
constructor(interaction: Repliables, dispatch: DispatchContext, bus: Bus);
|
|
621
451
|
protected writeReply(response: GatewayReplyResponse | string, opts?: SendOpts): Promise<SentMessage | undefined>;
|
|
@@ -647,7 +477,7 @@ declare class ReplySender extends BaseReplySender<SentMessage, GatewayFile> {
|
|
|
647
477
|
*
|
|
648
478
|
* @typeParam Event - The repliable interaction type this handler processes
|
|
649
479
|
*/
|
|
650
|
-
declare abstract class RepliableHandler<Event extends Repliables> extends RepliableHandler$1<Event, Core, SentMessage, GatewayFile, ReplySender> {
|
|
480
|
+
export declare abstract class RepliableHandler<Event extends Repliables> extends RepliableHandler$1<Event, Core, SentMessage, GatewayFile, ReplySender> {
|
|
651
481
|
/** @internal */
|
|
652
482
|
getEvent(): Event;
|
|
653
483
|
protected buildSender(event: Event, core: Core, dispatch: DispatchContext): ReplySender;
|
|
@@ -663,7 +493,7 @@ declare abstract class RepliableHandler<Event extends Repliables> extends Replia
|
|
|
663
493
|
*
|
|
664
494
|
* @typeParam Repliable - The interaction type this handler processes
|
|
665
495
|
*/
|
|
666
|
-
declare abstract class InteractionHandler<Repliable extends Repliables> extends RepliableHandler<Repliable> {
|
|
496
|
+
export declare abstract class InteractionHandler<Repliable extends Repliables> extends RepliableHandler<Repliable> {
|
|
667
497
|
constructor(event: Repliable, core: Core, dispatch: DispatchContext);
|
|
668
498
|
/**
|
|
669
499
|
* Open a modal. Must be the initial response to this interaction. The modal kind rejects this call at
|
|
@@ -804,7 +634,7 @@ type FitAll<TCtor extends AnyHandlerCtor, Gates extends readonly Gate<GateContex
|
|
|
804
634
|
* @see {@link defineEffectGate}
|
|
805
635
|
* @decorator
|
|
806
636
|
*/
|
|
807
|
-
declare function Gated<const Gates extends NonEmptyTuple<Gate<GateContextBase>>>(...gates: Gates): <TCtor extends AnyHandlerCtor>(ctor: FitAll<TCtor, Gates> extends Gates ? TCtor : FitAll<TCtor, Gates>) => void;
|
|
637
|
+
export declare function Gated<const Gates extends NonEmptyTuple<Gate<GateContextBase>>>(...gates: Gates): <TCtor extends AnyHandlerCtor>(ctor: FitAll<TCtor, Gates> extends Gates ? TCtor : FitAll<TCtor, Gates>) => void;
|
|
808
638
|
//#endregion
|
|
809
639
|
//#region src/bot/decorators/Middlewares.d.ts
|
|
810
640
|
/** Registration options for an event middleware. */
|
|
@@ -839,7 +669,7 @@ interface EventMiddlewareOptions<Events extends NonEmptyTuple<ValidNonInteractio
|
|
|
839
669
|
*
|
|
840
670
|
* @throws A **SeedcordTypeError** If `priority` is not a finite number.
|
|
841
671
|
*/
|
|
842
|
-
declare function RegisterEventMiddleware<const Events extends NonEmptyTuple<ValidNonInteractionKeys> = NonEmptyTuple<ValidNonInteractionKeys>>(options?: EventMiddlewareOptions<Events>): (ctor: Constructor<EventMiddleware<Events[number]>>) => void;
|
|
672
|
+
export declare function RegisterEventMiddleware<const Events extends NonEmptyTuple<ValidNonInteractionKeys> = NonEmptyTuple<ValidNonInteractionKeys>>(options?: EventMiddlewareOptions<Events>): (ctor: Constructor<EventMiddleware<Events[number]>>) => void;
|
|
843
673
|
//#endregion
|
|
844
674
|
//#region src/bot/gates/catalog/IgnoreBots.d.ts
|
|
845
675
|
/**
|
|
@@ -861,7 +691,7 @@ declare function RegisterEventMiddleware<const Events extends NonEmptyTuple<Vali
|
|
|
861
691
|
* }
|
|
862
692
|
* ```
|
|
863
693
|
*/
|
|
864
|
-
declare const IgnoreBots: import("@seedcord/core").Gate<EventGateContext<ValidNonInteractionKeys>, "IgnoreBots">;
|
|
694
|
+
export declare const IgnoreBots: import("@seedcord/core").Gate<EventGateContext<ValidNonInteractionKeys>, "IgnoreBots">;
|
|
865
695
|
//#endregion
|
|
866
696
|
//#region src/bot/gates/catalog/Nsfw.d.ts
|
|
867
697
|
/**
|
|
@@ -884,12 +714,12 @@ declare const IgnoreBots: import("@seedcord/core").Gate<EventGateContext<ValidNo
|
|
|
884
714
|
* }
|
|
885
715
|
* ```
|
|
886
716
|
*/
|
|
887
|
-
declare function Nsfw(options?: GateNoticeOptions): Gate<InteractionGateContext<NonModalInteraction>, 'Nsfw'>;
|
|
717
|
+
export declare function Nsfw(options?: GateNoticeOptions): Gate<InteractionGateContext<NonModalInteraction>, 'Nsfw'>;
|
|
888
718
|
//#endregion
|
|
889
719
|
//#region src/bot/injectors/EmojiInjector.d.ts
|
|
890
720
|
type SavedEmojiType = GuildEmoji | ApplicationEmoji;
|
|
891
721
|
/** A resolved emoji, plus the discord.js emoji it came from on {@link GatewayEmoji.source}. */
|
|
892
|
-
declare class GatewayEmoji<Source extends SavedEmojiType = SavedEmojiType> extends ResolvedEmoji {
|
|
722
|
+
export declare class GatewayEmoji<Source extends SavedEmojiType = SavedEmojiType> extends ResolvedEmoji {
|
|
893
723
|
#private;
|
|
894
724
|
constructor(source: Source);
|
|
895
725
|
/** What discord.js resolved, for `.url` and the management calls. */
|
|
@@ -905,7 +735,7 @@ type InjectedEmojiMap = { [K in keyof EmojiMap]: EmojiMap[K] extends 'guild' ? G
|
|
|
905
735
|
* The bot's resolved emojis, keyed by {@link EmojiMap}. Filled by {@link EmojiInjector} during startup.
|
|
906
736
|
* Throws if you read a key the injector did not fill.
|
|
907
737
|
*/
|
|
908
|
-
declare const Emojis: InjectedEmojiMap;
|
|
738
|
+
export declare const Emojis: InjectedEmojiMap;
|
|
909
739
|
//#endregion
|
|
910
740
|
//#region src/bot/utilities/permissions/checkBotPermissions.d.ts
|
|
911
741
|
/**
|
|
@@ -921,7 +751,7 @@ declare const Emojis: InjectedEmojiMap;
|
|
|
921
751
|
* checkBotPermissions(textChannel, [PermissionFlagsBits.SendMessages, PermissionFlagsBits.ViewChannel]);
|
|
922
752
|
* ```
|
|
923
753
|
*/
|
|
924
|
-
declare function checkBotPermissions(target: Guild | TextChannel, scope: PermissionScope, inverse?: boolean, errors?: PermissionNoticeOverrides): void;
|
|
754
|
+
export declare function checkBotPermissions(target: Guild | TextChannel, scope: PermissionScope, inverse?: boolean, errors?: PermissionNoticeOverrides): void;
|
|
925
755
|
//#endregion
|
|
926
756
|
//#region src/bot/utilities/permissions/checkPermissions.d.ts
|
|
927
757
|
/** Options for {@link checkPermissions}. */
|
|
@@ -956,7 +786,7 @@ interface CheckPermissionOptions extends PermissionNoticeOverrides {
|
|
|
956
786
|
* });
|
|
957
787
|
* ```
|
|
958
788
|
*/
|
|
959
|
-
declare function checkPermissions(target: Role | GuildMember, ctx: Guild, scope: PermissionScope, inverse?: boolean, errors?: PermissionNoticeOverrides): void;
|
|
789
|
+
export declare function checkPermissions(target: Role | GuildMember, ctx: Guild, scope: PermissionScope, inverse?: boolean, errors?: PermissionNoticeOverrides): void;
|
|
960
790
|
/**
|
|
961
791
|
* Checks a {@link Role} or a {@link GuildMember} against the overwrite-resolved set in a
|
|
962
792
|
* {@link TextChannel}. Refuses when a permission in `scope` is missing, or with `inverse` when one is
|
|
@@ -970,7 +800,7 @@ declare function checkPermissions(target: Role | GuildMember, ctx: Guild, scope:
|
|
|
970
800
|
* checkPermissions(role, textChannel, [PermissionFlagsBits.SendMessages, PermissionFlagsBits.ViewChannel]);
|
|
971
801
|
* ```
|
|
972
802
|
*/
|
|
973
|
-
declare function checkPermissions(target: Role | GuildMember, ctx: TextChannel, scope: PermissionScope, inverse?: boolean, errors?: PermissionNoticeOverrides): void;
|
|
803
|
+
export declare function checkPermissions(target: Role | GuildMember, ctx: TextChannel, scope: PermissionScope, inverse?: boolean, errors?: PermissionNoticeOverrides): void;
|
|
974
804
|
/**
|
|
975
805
|
* Checks permissions with an options object. Refuses when a permission in
|
|
976
806
|
* {@link CheckPermissionOptions.scope} is missing, or with `options.inverse` when one is present.
|
|
@@ -987,13 +817,13 @@ declare function checkPermissions(target: Role | GuildMember, ctx: TextChannel,
|
|
|
987
817
|
* });
|
|
988
818
|
* ```
|
|
989
819
|
*/
|
|
990
|
-
declare function checkPermissions(options: CheckPermissionOptions): void;
|
|
820
|
+
export declare function checkPermissions(options: CheckPermissionOptions): void;
|
|
991
821
|
//#endregion
|
|
992
822
|
//#region src/bot/utilities/permissions/hasPermsToAssign.d.ts
|
|
993
823
|
/**
|
|
994
824
|
* Optional custom error constructors for {@link HasPermsToAssignOptions}.
|
|
995
825
|
*/
|
|
996
|
-
interface AssignRoleNoticeOverrides {
|
|
826
|
+
export interface AssignRoleNoticeOverrides {
|
|
997
827
|
higherNotice?: new (message: string, role: Role, botRole: Role) => Notice;
|
|
998
828
|
managedNotice?: new (message: string) => Notice;
|
|
999
829
|
missingNotice?: new (message: string | undefined, subject: string, missingPerms: readonly string[]) => Notice;
|
|
@@ -1001,7 +831,7 @@ interface AssignRoleNoticeOverrides {
|
|
|
1001
831
|
/**
|
|
1002
832
|
* Options for {@link hasPermsToAssign}.
|
|
1003
833
|
*/
|
|
1004
|
-
interface HasPermsToAssignOptions {
|
|
834
|
+
export interface HasPermsToAssignOptions {
|
|
1005
835
|
targetRole: Role;
|
|
1006
836
|
noticeOverrides?: AssignRoleNoticeOverrides;
|
|
1007
837
|
}
|
|
@@ -1029,7 +859,7 @@ interface HasPermsToAssignOptions {
|
|
|
1029
859
|
* });
|
|
1030
860
|
* ```
|
|
1031
861
|
*/
|
|
1032
|
-
declare function hasPermsToAssign(roleOrOptions: Role | HasPermsToAssignOptions): void;
|
|
862
|
+
export declare function hasPermsToAssign(roleOrOptions: Role | HasPermsToAssignOptions): void;
|
|
1033
863
|
//#endregion
|
|
1034
864
|
//#region src/bot/confirm/getConfirmation.d.ts
|
|
1035
865
|
type Outcome = ReplyResponse | (() => Promisable<ReplyResponse>);
|
|
@@ -1102,7 +932,7 @@ interface DefaultConfirmOptions extends ConfirmOptions {
|
|
|
1102
932
|
* }
|
|
1103
933
|
* ```
|
|
1104
934
|
*/
|
|
1105
|
-
declare function getConfirmation(handler: RepliableHandler<NonModalInteraction>, prompt: string, options?: DefaultConfirmOptions): Promise<boolean>;
|
|
935
|
+
export declare function getConfirmation(handler: RepliableHandler<NonModalInteraction>, prompt: string, options?: DefaultConfirmOptions): Promise<boolean>;
|
|
1106
936
|
/**
|
|
1107
937
|
* Shows a confirm/cancel prompt you build yourself and resolves to `true` only if the invoking user clicks
|
|
1108
938
|
* confirm. The factory receives the two minted button ids. Set them on your own buttons. A cancel click or a
|
|
@@ -1155,7 +985,7 @@ declare function getConfirmation(handler: RepliableHandler<NonModalInteraction>,
|
|
|
1155
985
|
* if (!confirmed) return;
|
|
1156
986
|
* ```
|
|
1157
987
|
*/
|
|
1158
|
-
declare function getConfirmation(handler: RepliableHandler<NonModalInteraction>, prompt: (ids: {
|
|
988
|
+
export declare function getConfirmation(handler: RepliableHandler<NonModalInteraction>, prompt: (ids: {
|
|
1159
989
|
confirm: string;
|
|
1160
990
|
cancel: string;
|
|
1161
991
|
}) => Promisable<ReplyResponse>, options?: ConfirmOptions): Promise<boolean>;
|
|
@@ -1197,7 +1027,7 @@ type InteractionOf<Kind extends MiddlewareKind> = InteractionForKind[Kind];
|
|
|
1197
1027
|
* }
|
|
1198
1028
|
* ```
|
|
1199
1029
|
*/
|
|
1200
|
-
declare abstract class InteractionMiddleware<in out Kind extends MiddlewareKind = MiddlewareKind> extends RepliableHandler<InteractionOf<Kind>> {
|
|
1030
|
+
export declare abstract class InteractionMiddleware<in out Kind extends MiddlewareKind = MiddlewareKind> extends RepliableHandler<InteractionOf<Kind>> {
|
|
1201
1031
|
/** @internal */
|
|
1202
1032
|
readonly [MiddlewareKindsBrand]?: Kind;
|
|
1203
1033
|
constructor(event: InteractionOf<Kind>, core: Core, dispatch: DispatchContext, sender: ReplySender);
|
|
@@ -1266,7 +1096,7 @@ type SlashMatchArms<Route extends keyof SlashRegistry, Cache extends CacheType,
|
|
|
1266
1096
|
* }
|
|
1267
1097
|
* ```
|
|
1268
1098
|
*/
|
|
1269
|
-
declare abstract class SlashHandler<Route extends keyof SlashRegistry, Cache extends CacheType = CacheFor<Route>> extends InteractionHandler<ChatInputCommandInteraction<Cache>> {
|
|
1099
|
+
export declare abstract class SlashHandler<Route extends keyof SlashRegistry, Cache extends CacheType = CacheFor<Route>> extends InteractionHandler<ChatInputCommandInteraction<Cache>> {
|
|
1270
1100
|
/** @internal */
|
|
1271
1101
|
readonly [SlashRouteBrand]?: Route;
|
|
1272
1102
|
/**
|
|
@@ -1332,7 +1162,7 @@ type MessageMenuArms<Names extends NamesFor<ApplicationCommandType.Message>, Ret
|
|
|
1332
1162
|
* }
|
|
1333
1163
|
* ```
|
|
1334
1164
|
*/
|
|
1335
|
-
declare abstract class UserContextMenuHandler<Names extends NamesFor<ApplicationCommandType.User>, Cache extends CacheType = MenuCacheFor<ApplicationCommandType.User, Names>> extends InteractionHandler<UserContextMenuCommandInteraction<Cache>> {
|
|
1165
|
+
export declare abstract class UserContextMenuHandler<Names extends NamesFor<ApplicationCommandType.User>, Cache extends CacheType = MenuCacheFor<ApplicationCommandType.User, Names>> extends InteractionHandler<UserContextMenuCommandInteraction<Cache>> {
|
|
1336
1166
|
/** @internal */
|
|
1337
1167
|
readonly [ContextMenuKindBrand]?: ApplicationCommandType.User;
|
|
1338
1168
|
/** @internal */
|
|
@@ -1388,7 +1218,7 @@ declare abstract class UserContextMenuHandler<Names extends NamesFor<Application
|
|
|
1388
1218
|
* }
|
|
1389
1219
|
* ```
|
|
1390
1220
|
*/
|
|
1391
|
-
declare abstract class MessageContextMenuHandler<Names extends NamesFor<ApplicationCommandType.Message>, Cache extends CacheType = MenuCacheFor<ApplicationCommandType.Message, Names>> extends InteractionHandler<MessageContextMenuCommandInteraction<Cache>> {
|
|
1221
|
+
export declare abstract class MessageContextMenuHandler<Names extends NamesFor<ApplicationCommandType.Message>, Cache extends CacheType = MenuCacheFor<ApplicationCommandType.Message, Names>> extends InteractionHandler<MessageContextMenuCommandInteraction<Cache>> {
|
|
1392
1222
|
/** @internal */
|
|
1393
1223
|
readonly [ContextMenuKindBrand]?: ApplicationCommandType.Message;
|
|
1394
1224
|
/** @internal */
|
|
@@ -1447,7 +1277,7 @@ type FocusedArms<Route extends keyof SlashRegistry, Ret> = { [Name in Autocomple
|
|
|
1447
1277
|
* }
|
|
1448
1278
|
* ```
|
|
1449
1279
|
*/
|
|
1450
|
-
declare abstract class AutocompleteHandler<Route extends keyof SlashRegistry, Cache extends CacheType = CacheFor<Route>> extends BaseHandler<AutocompleteInteraction<Cache>> {
|
|
1280
|
+
export declare abstract class AutocompleteHandler<Route extends keyof SlashRegistry, Cache extends CacheType = CacheFor<Route>> extends BaseHandler<AutocompleteInteraction<Cache>> {
|
|
1451
1281
|
/** @internal */
|
|
1452
1282
|
readonly [AutocompleteRouteBrand]?: Route;
|
|
1453
1283
|
constructor(event: AutocompleteInteraction<Cache>, core: Core, dispatch: DispatchContext);
|
|
@@ -1506,7 +1336,7 @@ type ComponentInteraction = ButtonInteraction | ModalSubmitInteraction | AnySele
|
|
|
1506
1336
|
* @typeParam Event - The component interaction type this handler processes
|
|
1507
1337
|
* @typeParam Defs - The customId route definitions registered on the concrete handler
|
|
1508
1338
|
*/
|
|
1509
|
-
declare abstract class ComponentHandler<Event extends ComponentInteraction, Defs extends readonly AnyCustomId[]> extends InteractionHandler<Event> implements HasComponentDefs<Defs> {
|
|
1339
|
+
export declare abstract class ComponentHandler<Event extends ComponentInteraction, Defs extends readonly AnyCustomId[]> extends InteractionHandler<Event> implements HasComponentDefs<Defs> {
|
|
1510
1340
|
/** @internal */
|
|
1511
1341
|
readonly [ComponentDefsBrand]?: Defs;
|
|
1512
1342
|
/** Rewrite the source message this component interaction came from. */
|
|
@@ -1576,7 +1406,7 @@ declare abstract class ComponentHandler<Event extends ComponentInteraction, Defs
|
|
|
1576
1406
|
* }
|
|
1577
1407
|
* ```
|
|
1578
1408
|
*/
|
|
1579
|
-
declare abstract class ButtonHandler<Defs extends readonly AnyCustomId[], Cache extends CacheType = 'cached'> extends ComponentHandler<ButtonInteraction<Cache>, Defs> {
|
|
1409
|
+
export declare abstract class ButtonHandler<Defs extends readonly AnyCustomId[], Cache extends CacheType = 'cached'> extends ComponentHandler<ButtonInteraction<Cache>, Defs> {
|
|
1580
1410
|
/** @internal */
|
|
1581
1411
|
readonly [ComponentKindBrand]?: InteractionKind.Button;
|
|
1582
1412
|
}
|
|
@@ -1605,7 +1435,7 @@ declare abstract class ButtonHandler<Defs extends readonly AnyCustomId[], Cache
|
|
|
1605
1435
|
* }
|
|
1606
1436
|
* ```
|
|
1607
1437
|
*/
|
|
1608
|
-
declare abstract class ModalHandler<Defs extends readonly AnyCustomId[], Cache extends CacheType = 'cached'> extends ComponentHandler<ModalSubmitInteraction<Cache>, Defs> {
|
|
1438
|
+
export declare abstract class ModalHandler<Defs extends readonly AnyCustomId[], Cache extends CacheType = 'cached'> extends ComponentHandler<ModalSubmitInteraction<Cache>, Defs> {
|
|
1609
1439
|
/** @internal */
|
|
1610
1440
|
readonly [ComponentKindBrand]?: InteractionKind.Modal;
|
|
1611
1441
|
/** The fields this modal submitted, read by custom id. */
|
|
@@ -1628,7 +1458,7 @@ declare abstract class ModalHandler<Defs extends readonly AnyCustomId[], Cache e
|
|
|
1628
1458
|
* @typeParam Event - The select menu interaction type this handler processes
|
|
1629
1459
|
* @typeParam Defs - The customId route definitions registered on the concrete handler
|
|
1630
1460
|
*/
|
|
1631
|
-
declare abstract class SelectMenuHandler<Event extends AnySelectMenuInteraction, Defs extends readonly AnyCustomId[]> extends ComponentHandler<Event, Defs> {
|
|
1461
|
+
export declare abstract class SelectMenuHandler<Event extends AnySelectMenuInteraction, Defs extends readonly AnyCustomId[]> extends ComponentHandler<Event, Defs> {
|
|
1632
1462
|
/** The values this select picked. On every kind but the string menu they are snowflake ids. */
|
|
1633
1463
|
protected get values(): string[];
|
|
1634
1464
|
}
|
|
@@ -1653,7 +1483,7 @@ declare abstract class SelectMenuHandler<Event extends AnySelectMenuInteraction,
|
|
|
1653
1483
|
* }
|
|
1654
1484
|
* ```
|
|
1655
1485
|
*/
|
|
1656
|
-
declare abstract class StringMenuHandler<Defs extends readonly AnyCustomId[], Cache extends CacheType = 'cached'> extends SelectMenuHandler<StringSelectMenuInteraction<Cache>, Defs> {
|
|
1486
|
+
export declare abstract class StringMenuHandler<Defs extends readonly AnyCustomId[], Cache extends CacheType = 'cached'> extends SelectMenuHandler<StringSelectMenuInteraction<Cache>, Defs> {
|
|
1657
1487
|
/** @internal */
|
|
1658
1488
|
readonly [ComponentKindBrand]?: InteractionKind.StringMenu;
|
|
1659
1489
|
}
|
|
@@ -1677,7 +1507,7 @@ declare abstract class StringMenuHandler<Defs extends readonly AnyCustomId[], Ca
|
|
|
1677
1507
|
* }
|
|
1678
1508
|
* ```
|
|
1679
1509
|
*/
|
|
1680
|
-
declare abstract class UserMenuHandler<Defs extends readonly AnyCustomId[], Cache extends CacheType = 'cached'> extends SelectMenuHandler<UserSelectMenuInteraction<Cache>, Defs> {
|
|
1510
|
+
export declare abstract class UserMenuHandler<Defs extends readonly AnyCustomId[], Cache extends CacheType = 'cached'> extends SelectMenuHandler<UserSelectMenuInteraction<Cache>, Defs> {
|
|
1681
1511
|
/** @internal */
|
|
1682
1512
|
readonly [ComponentKindBrand]?: InteractionKind.UserMenu;
|
|
1683
1513
|
/** The users this select picked. */
|
|
@@ -1704,7 +1534,7 @@ declare abstract class UserMenuHandler<Defs extends readonly AnyCustomId[], Cach
|
|
|
1704
1534
|
* }
|
|
1705
1535
|
* ```
|
|
1706
1536
|
*/
|
|
1707
|
-
declare abstract class RoleMenuHandler<Defs extends readonly AnyCustomId[], Cache extends CacheType = 'cached'> extends SelectMenuHandler<RoleSelectMenuInteraction<Cache>, Defs> {
|
|
1537
|
+
export declare abstract class RoleMenuHandler<Defs extends readonly AnyCustomId[], Cache extends CacheType = 'cached'> extends SelectMenuHandler<RoleSelectMenuInteraction<Cache>, Defs> {
|
|
1708
1538
|
/** @internal */
|
|
1709
1539
|
readonly [ComponentKindBrand]?: InteractionKind.RoleMenu;
|
|
1710
1540
|
/** The roles this select picked. */
|
|
@@ -1729,7 +1559,7 @@ declare abstract class RoleMenuHandler<Defs extends readonly AnyCustomId[], Cach
|
|
|
1729
1559
|
* }
|
|
1730
1560
|
* ```
|
|
1731
1561
|
*/
|
|
1732
|
-
declare abstract class ChannelMenuHandler<Defs extends readonly AnyCustomId[], Cache extends CacheType = 'cached'> extends SelectMenuHandler<ChannelSelectMenuInteraction<Cache>, Defs> {
|
|
1562
|
+
export declare abstract class ChannelMenuHandler<Defs extends readonly AnyCustomId[], Cache extends CacheType = 'cached'> extends SelectMenuHandler<ChannelSelectMenuInteraction<Cache>, Defs> {
|
|
1733
1563
|
/** @internal */
|
|
1734
1564
|
readonly [ComponentKindBrand]?: InteractionKind.ChannelMenu;
|
|
1735
1565
|
/** The channels this select picked. */
|
|
@@ -1754,7 +1584,7 @@ declare abstract class ChannelMenuHandler<Defs extends readonly AnyCustomId[], C
|
|
|
1754
1584
|
* }
|
|
1755
1585
|
* ```
|
|
1756
1586
|
*/
|
|
1757
|
-
declare abstract class MentionableMenuHandler<Defs extends readonly AnyCustomId[], Cache extends CacheType = 'cached'> extends SelectMenuHandler<MentionableSelectMenuInteraction<Cache>, Defs> {
|
|
1587
|
+
export declare abstract class MentionableMenuHandler<Defs extends readonly AnyCustomId[], Cache extends CacheType = 'cached'> extends SelectMenuHandler<MentionableSelectMenuInteraction<Cache>, Defs> {
|
|
1758
1588
|
/** @internal */
|
|
1759
1589
|
readonly [ComponentKindBrand]?: InteractionKind.MentionableMenu;
|
|
1760
1590
|
/** The users this select picked. */
|
|
@@ -1803,7 +1633,7 @@ type PaginatorHandlerCtor<Prefix extends string> = new (...args: ConstructorPara
|
|
|
1803
1633
|
* export class BansNav extends Bans.Handler {}
|
|
1804
1634
|
* ```
|
|
1805
1635
|
*/
|
|
1806
|
-
declare class Paginator<Item, const Prefix extends string> extends PaginatorBase<Item, Prefix, PageContext> {
|
|
1636
|
+
export declare class Paginator<Item, const Prefix extends string> extends PaginatorBase<Item, Prefix, PageContext> {
|
|
1807
1637
|
/** The nav handler base. Extend it with an empty body and decorate it, `@ButtonRoute(p.cursor)`. */
|
|
1808
1638
|
readonly Handler: PaginatorHandlerCtor<Prefix>;
|
|
1809
1639
|
constructor(config: PaginatorConfig<Item, Prefix, PageContext>);
|
|
@@ -1838,7 +1668,7 @@ type PageSource<Item> = PageSourceBase<Item, PageContext>;
|
|
|
1838
1668
|
*
|
|
1839
1669
|
* @typeParam Item - The item type, inferred from the loader's return.
|
|
1840
1670
|
*/
|
|
1841
|
-
declare class ArraySource<Item> extends ArraySourceBase<Item, PageContext> {}
|
|
1671
|
+
export declare class ArraySource<Item> extends ArraySourceBase<Item, PageContext> {}
|
|
1842
1672
|
/**
|
|
1843
1673
|
* A source for a large or unknown-length set you fetch one page at a time (SQL LIMIT/OFFSET, a paged API).
|
|
1844
1674
|
* The fetcher receives the page index and the page size and reports whether a next page exists. A cursor
|
|
@@ -1847,7 +1677,7 @@ declare class ArraySource<Item> extends ArraySourceBase<Item, PageContext> {}
|
|
|
1847
1677
|
*
|
|
1848
1678
|
* @typeParam Item - The item type, inferred from the fetcher's slice.
|
|
1849
1679
|
*/
|
|
1850
|
-
declare class CursorSource<Item> extends CursorSourceBase<Item, PageContext> {}
|
|
1680
|
+
export declare class CursorSource<Item> extends CursorSourceBase<Item, PageContext> {}
|
|
1851
1681
|
//#endregion
|
|
1852
1682
|
//#region src/subscribers/index.d.ts
|
|
1853
1683
|
/**
|
|
@@ -1855,14 +1685,14 @@ declare class CursorSource<Item> extends CursorSourceBase<Item, PageContext> {}
|
|
|
1855
1685
|
*
|
|
1856
1686
|
* @typeParam KeyOfSubscribers - The subscription key this handler receives
|
|
1857
1687
|
*/
|
|
1858
|
-
declare abstract class Subscriber<KeyOfSubscribers extends SubscriptionKey> extends Subscriber$1<KeyOfSubscribers, Core> {}
|
|
1688
|
+
export declare abstract class Subscriber<KeyOfSubscribers extends SubscriptionKey> extends Subscriber$1<KeyOfSubscribers, Core> {}
|
|
1859
1689
|
/**
|
|
1860
1690
|
* Base class for a gateway subscriber that delivers its event to a Discord webhook, binding
|
|
1861
1691
|
* `this.core` to the gateway {@link Core}.
|
|
1862
1692
|
*
|
|
1863
1693
|
* @typeParam KeyOfSubscribers - The subscription key this reporter receives
|
|
1864
1694
|
*/
|
|
1865
|
-
declare abstract class WebhookLog<KeyOfSubscribers extends SubscriptionKey> extends WebhookLog$1<KeyOfSubscribers, Core> {}
|
|
1695
|
+
export declare abstract class WebhookLog<KeyOfSubscribers extends SubscriptionKey> extends WebhookLog$1<KeyOfSubscribers, Core> {}
|
|
1866
1696
|
//#endregion
|
|
1867
1697
|
//#region src/plugin.d.ts
|
|
1868
1698
|
/**
|
|
@@ -1881,7 +1711,7 @@ type GatewayPluginOptions = TypedOmit<PluginOptions$1, 'transport' | 'runtime'>
|
|
|
1881
1711
|
*
|
|
1882
1712
|
* @typeParam Opts - The transport and runtime the plugin declares.
|
|
1883
1713
|
*/
|
|
1884
|
-
declare abstract class Plugin<Opts extends GatewayPluginOptions = {
|
|
1714
|
+
export declare abstract class Plugin<Opts extends GatewayPluginOptions = {
|
|
1885
1715
|
transport: 'gateway';
|
|
1886
1716
|
runtime: 'server';
|
|
1887
1717
|
}> extends Plugin$1<Opts, Core> {}
|
|
@@ -1891,7 +1721,7 @@ declare abstract class Plugin<Opts extends GatewayPluginOptions = {
|
|
|
1891
1721
|
* The gateway bot host. Opens a discord.js gateway session, discovers handlers, and runs
|
|
1892
1722
|
* coordinated startup and shutdown. Attach plugins with `attach()`.
|
|
1893
1723
|
*/
|
|
1894
|
-
declare class Seedcord extends Pluggable<'gateway', 'server'> implements
|
|
1724
|
+
export declare class Seedcord extends Pluggable<'gateway', 'server'> implements SeedcordInstance {
|
|
1895
1725
|
readonly config: GatewayConfig;
|
|
1896
1726
|
/** @internal */
|
|
1897
1727
|
readonly [SeedcordBrand] = true;
|
|
@@ -1932,7 +1762,7 @@ declare class Seedcord extends Pluggable<'gateway', 'server'> implements Core, S
|
|
|
1932
1762
|
//#endregion
|
|
1933
1763
|
//#region src/version.d.ts
|
|
1934
1764
|
/** Package version */
|
|
1935
|
-
declare const version: string;
|
|
1765
|
+
export declare const version: string;
|
|
1936
1766
|
//#endregion
|
|
1937
|
-
export {
|
|
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 };
|
|
1938
1768
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1869,10 +1869,9 @@ var EventDispatcher = class {
|
|
|
1869
1869
|
const handlers = this.eventMap.get(event);
|
|
1870
1870
|
if (!handlers) continue;
|
|
1871
1871
|
const index = handlers.findIndex((h) => h.ctor === handlerClass);
|
|
1872
|
-
if (index !== -1)
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
}
|
|
1872
|
+
if (!(index !== -1)) continue;
|
|
1873
|
+
handlers.splice(index, 1);
|
|
1874
|
+
if (handlers.length === 0) this.eventMap.delete(event);
|
|
1876
1875
|
}
|
|
1877
1876
|
}
|
|
1878
1877
|
unregisterMiddleware(middlewareCtor) {
|
|
@@ -2225,14 +2224,12 @@ var InteractionDispatcher = class {
|
|
|
2225
2224
|
}
|
|
2226
2225
|
registerMiddleware(middlewareCtor, relativePath) {
|
|
2227
2226
|
const metadata = this.middlewares.register(middlewareCtor);
|
|
2228
|
-
if (!metadata) return;
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
});
|
|
2235
|
-
}
|
|
2227
|
+
if (!metadata || !this.loading) return;
|
|
2228
|
+
const scope = metadata.keys ? `${metadata.priority}, ${metadata.keys.join(", ")}` : metadata.priority;
|
|
2229
|
+
this.loadedMiddlewares.push({
|
|
2230
|
+
name: `${middlewareCtor.name} (${String(scope)})`,
|
|
2231
|
+
from: formatFilePath(relativePath)
|
|
2232
|
+
});
|
|
2236
2233
|
}
|
|
2237
2234
|
isHandlerClass(obj) {
|
|
2238
2235
|
if (typeof obj !== "function") return false;
|
|
@@ -2494,7 +2491,7 @@ function assertGuildsIntent(intents, commands) {
|
|
|
2494
2491
|
}
|
|
2495
2492
|
|
|
2496
2493
|
//#endregion
|
|
2497
|
-
//#region \0@oxc-project+runtime@0.
|
|
2494
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/decorate.js
|
|
2498
2495
|
function __decorate(decorators, target, key, desc) {
|
|
2499
2496
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2500
2497
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2577,13 +2574,12 @@ var Bot = class {
|
|
|
2577
2574
|
if (this.#events) await this.#events.init();
|
|
2578
2575
|
await this.#login(token);
|
|
2579
2576
|
await this.#emojiInjector.init();
|
|
2580
|
-
if (this.#commandRegistry)
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
}
|
|
2577
|
+
if (!this.#commandRegistry) return;
|
|
2578
|
+
await this.#commandRegistry.init();
|
|
2579
|
+
assertGuildsIntent(this.#intents, this.#commandRegistry.allCommands());
|
|
2580
|
+
await this.#commandRegistry.setCommands();
|
|
2581
|
+
this.#interactions?.warnUnhandledRoutes(this.#commandRegistry.routeLeaves());
|
|
2582
|
+
this.#interactions?.warnUnhandledContextMenuRoutes(this.#commandRegistry.contextMenuLeaves());
|
|
2587
2583
|
}
|
|
2588
2584
|
async #stop() {
|
|
2589
2585
|
this.#client.removeAllListeners();
|
|
@@ -2616,7 +2612,7 @@ function initBot(bot) {
|
|
|
2616
2612
|
//#endregion
|
|
2617
2613
|
//#region src/version.ts
|
|
2618
2614
|
/** Package version */
|
|
2619
|
-
const version = "0.7.
|
|
2615
|
+
const version = "0.7.3";
|
|
2620
2616
|
|
|
2621
2617
|
//#endregion
|
|
2622
2618
|
//#region src/Seedcord.ts
|