@seedcord/core 0.1.0-next.6 → 0.1.0-next.7
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/{AutocompleteOptions-eKhIe6Qt.d.mts → AutocompleteOptions-DLp_B8as.d.mts} +61 -112
- package/dist/HmrModuleHandler-3sNgKHdf.mjs +163 -0
- package/dist/HmrModuleHandler-3sNgKHdf.mjs.map +1 -0
- package/dist/HmrModuleHandler-CTBng7wV.cjs +170 -0
- package/dist/HmrModuleHandler-CTBng7wV.cjs.map +1 -0
- package/dist/Plugin-3rlH0uxH.d.mts +620 -0
- package/dist/{Plugin-C2-VHrsX.cjs → Plugin-Cgp1a0uQ.cjs} +13 -4
- package/dist/Plugin-Cgp1a0uQ.cjs.map +1 -0
- package/dist/{Plugin-PcdPjAzc.mjs → Plugin-j9GYdroS.mjs} +13 -4
- package/dist/Plugin-j9GYdroS.mjs.map +1 -0
- package/dist/{permissions-DSW_EZfN.cjs → Silence-DiP95iwD.cjs} +38 -307
- package/dist/Silence-DiP95iwD.cjs.map +1 -0
- package/dist/{permissions-RVCBhL2n.mjs → Silence-dbC2slOB.mjs} +35 -238
- package/dist/Silence-dbC2slOB.mjs.map +1 -0
- package/dist/basic-D7bDlgSP.d.mts +10 -0
- package/dist/hmr.index.cjs +2 -164
- package/dist/hmr.index.mjs +2 -162
- package/dist/index-Dueqztyy.d.mts +142 -0
- package/dist/index.cjs +50 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +7 -5
- package/dist/index.mjs +8 -35
- package/dist/index.mjs.map +1 -1
- package/dist/internal.index.cjs +262 -74
- package/dist/internal.index.cjs.map +1 -1
- package/dist/internal.index.d.mts +68 -4
- package/dist/internal.index.mjs +216 -35
- package/dist/internal.index.mjs.map +1 -1
- package/dist/node-internal.index.cjs +123 -52
- package/dist/node-internal.index.cjs.map +1 -1
- package/dist/node-internal.index.d.mts +67 -2158
- package/dist/node-internal.index.mjs +124 -54
- package/dist/node-internal.index.mjs.map +1 -1
- package/dist/plugin.index.cjs +1 -1
- package/dist/plugin.index.d.mts +1 -1
- package/dist/plugin.index.mjs +1 -1
- package/dist/publishDefault-CCf1azzW.mjs +264 -0
- package/dist/publishDefault-CCf1azzW.mjs.map +1 -0
- package/dist/publishDefault-l0NQ-SHo.cjs +353 -0
- package/dist/publishDefault-l0NQ-SHo.cjs.map +1 -0
- package/dist/subscribers-B1G6_LlK.cjs +517 -0
- package/dist/subscribers-B1G6_LlK.cjs.map +1 -0
- package/dist/subscribers-DYqFVP1X.mjs +480 -0
- package/dist/subscribers-DYqFVP1X.mjs.map +1 -0
- package/package.json +7 -6
- package/dist/Plugin-C2-VHrsX.cjs.map +0 -1
- package/dist/Plugin-CNyRKDHT.d.mts +0 -226
- package/dist/Plugin-PcdPjAzc.mjs.map +0 -1
- package/dist/hmr.index.cjs.map +0 -1
- package/dist/hmr.index.mjs.map +0 -1
- package/dist/is-never-Ddaba1Su.d.mts +0 -58
- package/dist/permissions-DSW_EZfN.cjs.map +0 -1
- package/dist/permissions-RVCBhL2n.mjs.map +0 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { t as Constructor } from "./basic-D7bDlgSP.mjs";
|
|
2
|
+
import { C as Subscriber, O as SubscriptionKey, y as CoreBase } from "./Plugin-3rlH0uxH.mjs";
|
|
3
|
+
import { APIMessageTopLevelComponent } from "discord-api-types/v10";
|
|
4
|
+
import { EventFrequency } from "@seedcord/types";
|
|
5
|
+
|
|
6
|
+
//#region src/subscribers/decorators/Subscribe.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Options accepted by the `@Subscribe` decorator.
|
|
9
|
+
*/
|
|
10
|
+
interface SubscribeOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Frequency: `'once'` or `'on'`.
|
|
13
|
+
*
|
|
14
|
+
* @defaultValue `'on'`
|
|
15
|
+
*/
|
|
16
|
+
readonly frequency?: EventFrequency | undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Registers a subscriber handler class with a specific subscriber event.
|
|
20
|
+
*
|
|
21
|
+
* Associates the decorated class with a subscriber event type for automatic
|
|
22
|
+
* registration and execution when the subscriber is emitted.
|
|
23
|
+
*
|
|
24
|
+
* @typeParam TSubscriber - The subscriber event name to register for
|
|
25
|
+
* @param subscriber - The subscriber event name to register for
|
|
26
|
+
* @param options - Options to configure the subscriber handler registration.
|
|
27
|
+
* @decorator
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* \@Subscribe('userJoin')
|
|
31
|
+
* class WelcomeHandler extends Subscriber<'userJoin'> {
|
|
32
|
+
* async execute() {
|
|
33
|
+
* // Handle user join event
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* \@Subscribe('userJoin', { frequency: 'once' })
|
|
40
|
+
* // or
|
|
41
|
+
* \@Subscribe('userJoin')
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
declare function Subscribe<TSubscriber extends SubscriptionKey>(subscriber: TSubscriber, options?: SubscribeOptions): <HandlerCtor extends Constructor<Subscriber<TSubscriber, CoreBase>>>(constructor: HandlerCtor) => void;
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/subscribers/bases/WebhookSender.d.ts
|
|
47
|
+
/**
|
|
48
|
+
* A file attached to a webhook report.
|
|
49
|
+
*/
|
|
50
|
+
interface WebhookFile {
|
|
51
|
+
name: string;
|
|
52
|
+
description: string;
|
|
53
|
+
/** A `Buffer` still satisfies this, it extends `Uint8Array`. */
|
|
54
|
+
data: Uint8Array | string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The payload {@link WebhookSender.send} posts.
|
|
58
|
+
*/
|
|
59
|
+
interface WebhookSendOptions {
|
|
60
|
+
flags: number;
|
|
61
|
+
username: string;
|
|
62
|
+
components: readonly {
|
|
63
|
+
toJSON(): APIMessageTopLevelComponent;
|
|
64
|
+
}[];
|
|
65
|
+
files?: readonly WebhookFile[] | undefined;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Sends component messages to a Discord webhook through `@discordjs/rest`.
|
|
69
|
+
*
|
|
70
|
+
* @throws A `SeedcordError` when the url does not carry a webhook id and token.
|
|
71
|
+
*/
|
|
72
|
+
declare class WebhookSender {
|
|
73
|
+
private readonly rest;
|
|
74
|
+
private readonly route;
|
|
75
|
+
constructor(url: string);
|
|
76
|
+
/**
|
|
77
|
+
* Fetches the webhook object, sending no message. Returns `missing` on a 404 or 401 from
|
|
78
|
+
* Discord and `unreachable` on any other failure.
|
|
79
|
+
*/
|
|
80
|
+
verify(): Promise<'ok' | 'missing' | 'unreachable'>;
|
|
81
|
+
send(options: WebhookSendOptions): Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/subscribers/bases/WebhookLog.d.ts
|
|
85
|
+
/**
|
|
86
|
+
* The content a reporter returns from {@link WebhookLog.report}.
|
|
87
|
+
*/
|
|
88
|
+
interface WebhookReport {
|
|
89
|
+
/** Shown as the webhook message author. Defaults to the reporter's class name. */
|
|
90
|
+
username?: string;
|
|
91
|
+
components: readonly {
|
|
92
|
+
toJSON(): APIMessageTopLevelComponent;
|
|
93
|
+
}[];
|
|
94
|
+
files?: readonly WebhookFile[] | undefined;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Base class for subscribers that deliver their event to a Discord webhook.
|
|
98
|
+
*
|
|
99
|
+
* Declare the url's environment variable with `@WebhookUrl` and implement {@link report}. Url
|
|
100
|
+
* resolution, validation, sender reuse, and sending run in the base. When the variable is unset
|
|
101
|
+
* the reporter is skipped at registration with a boot warning.
|
|
102
|
+
*
|
|
103
|
+
* @typeParam KeyOfSubscribers - The subscription key this reporter receives
|
|
104
|
+
* @typeParam TCore - The transport's Core
|
|
105
|
+
*/
|
|
106
|
+
declare abstract class WebhookLog<KeyOfSubscribers extends SubscriptionKey, TCore extends CoreBase> extends Subscriber<KeyOfSubscribers, TCore> {
|
|
107
|
+
private static readonly senders;
|
|
108
|
+
/** Builds the message for one published event. */
|
|
109
|
+
abstract report(): WebhookReport | Promise<WebhookReport>;
|
|
110
|
+
execute(): Promise<void>;
|
|
111
|
+
/** @internal */
|
|
112
|
+
static senderFor(url: string): WebhookSender;
|
|
113
|
+
/** @internal */
|
|
114
|
+
static envKeyOf(ctor: NewableFunction): string;
|
|
115
|
+
/** @internal Returns null when the env var is unset, throws when set but malformed. */
|
|
116
|
+
static urlOf(envKey: string): string | null;
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/subscribers/decorators/WebhookUrl.d.ts
|
|
120
|
+
/**
|
|
121
|
+
* Declares the environment variable a {@link WebhookLog} reporter reads its webhook url from.
|
|
122
|
+
*
|
|
123
|
+
* An unset variable disables the reporter with a boot warning. A set but malformed value throws
|
|
124
|
+
* at boot.
|
|
125
|
+
*
|
|
126
|
+
* @param envKey - The environment variable name holding the webhook url
|
|
127
|
+
* @decorator
|
|
128
|
+
* @example
|
|
129
|
+
* ```ts
|
|
130
|
+
* \@Subscribe('memberBanned')
|
|
131
|
+
* \@WebhookUrl('BAN_LOG_WEBHOOK_URL')
|
|
132
|
+
* class BanLog extends WebhookLog<'memberBanned'> {
|
|
133
|
+
* report() {
|
|
134
|
+
* return { components: [new BanCard(this.data).component] };
|
|
135
|
+
* }
|
|
136
|
+
* }
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
declare function WebhookUrl(envKey: string): <HandlerCtor extends Constructor<WebhookLog<SubscriptionKey, CoreBase>>>(constructor: HandlerCtor) => void;
|
|
140
|
+
//#endregion
|
|
141
|
+
export { Subscribe as a, WebhookFile as i, WebhookLog as n, SubscribeOptions as o, WebhookReport as r, WebhookUrl as t };
|
|
142
|
+
//# sourceMappingURL=index-Dueqztyy.d.mts.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
2
|
+
const require_publishDefault = require('./publishDefault-l0NQ-SHo.cjs');
|
|
3
|
+
const require_Silence = require('./Silence-DiP95iwD.cjs');
|
|
3
4
|
const require_phases = require('./phases-C_BGNyVo.cjs');
|
|
5
|
+
const require_subscribers = require('./subscribers-B1G6_LlK.cjs');
|
|
4
6
|
require("reflect-metadata");
|
|
5
7
|
let _seedcord_errors = require("@seedcord/errors");
|
|
6
8
|
let _seedcord_errors_internal = require("@seedcord/errors/internal");
|
|
@@ -10,7 +12,7 @@ let _seedcord_utils = require("@seedcord/utils");
|
|
|
10
12
|
//#region src/decorators/Command.ts
|
|
11
13
|
function RegisterCommand(scope, guilds = []) {
|
|
12
14
|
return (ctor) => {
|
|
13
|
-
const existingMeta = Reflect.getOwnMetadata(
|
|
15
|
+
const existingMeta = Reflect.getOwnMetadata(require_publishDefault.CommandMetadataKey, ctor);
|
|
14
16
|
if (existingMeta) throw new _seedcord_errors_internal.SeedcordError(_seedcord_errors.SeedcordErrorCode.DecoratorCommandAlreadyRegistered, [
|
|
15
17
|
ctor.name,
|
|
16
18
|
existingMeta.scope,
|
|
@@ -22,7 +24,7 @@ function RegisterCommand(scope, guilds = []) {
|
|
|
22
24
|
scope,
|
|
23
25
|
guilds
|
|
24
26
|
};
|
|
25
|
-
Reflect.defineMetadata(
|
|
27
|
+
Reflect.defineMetadata(require_publishDefault.CommandMetadataKey, meta, ctor);
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
30
|
|
|
@@ -49,7 +51,7 @@ function RegisterCommand(scope, guilds = []) {
|
|
|
49
51
|
*/
|
|
50
52
|
function SlashRoute(...routes) {
|
|
51
53
|
return function(constructor) {
|
|
52
|
-
|
|
54
|
+
require_Silence.storeInteractionRoute("slash", routes, constructor);
|
|
53
55
|
};
|
|
54
56
|
}
|
|
55
57
|
/**
|
|
@@ -74,7 +76,7 @@ function SlashRoute(...routes) {
|
|
|
74
76
|
*/
|
|
75
77
|
function AutocompleteRoute(...routes) {
|
|
76
78
|
return function(constructor) {
|
|
77
|
-
|
|
79
|
+
require_Silence.storeInteractionRoute("autocomplete", routes, constructor);
|
|
78
80
|
};
|
|
79
81
|
}
|
|
80
82
|
/**
|
|
@@ -100,7 +102,7 @@ function AutocompleteRoute(...routes) {
|
|
|
100
102
|
*/
|
|
101
103
|
function ContextMenuRoute(kind, ...names) {
|
|
102
104
|
return function(constructor) {
|
|
103
|
-
|
|
105
|
+
require_Silence.storeInteractionRoute(require_Silence.contextMenuRouteOf(kind), names, constructor);
|
|
104
106
|
};
|
|
105
107
|
}
|
|
106
108
|
/**
|
|
@@ -116,7 +118,7 @@ function ContextMenuRoute(kind, ...names) {
|
|
|
116
118
|
*/
|
|
117
119
|
function ButtonRoute(...defs) {
|
|
118
120
|
return function(constructor) {
|
|
119
|
-
|
|
121
|
+
require_Silence.storeComponentRoute("button", defs, constructor);
|
|
120
122
|
};
|
|
121
123
|
}
|
|
122
124
|
/**
|
|
@@ -132,7 +134,7 @@ function ButtonRoute(...defs) {
|
|
|
132
134
|
*/
|
|
133
135
|
function ModalRoute(...defs) {
|
|
134
136
|
return function(constructor) {
|
|
135
|
-
|
|
137
|
+
require_Silence.storeComponentRoute("modal", defs, constructor);
|
|
136
138
|
};
|
|
137
139
|
}
|
|
138
140
|
/**
|
|
@@ -153,7 +155,7 @@ function ModalRoute(...defs) {
|
|
|
153
155
|
*/
|
|
154
156
|
function SelectMenuRoute(type, ...defs) {
|
|
155
157
|
return function(constructor) {
|
|
156
|
-
|
|
158
|
+
require_Silence.storeComponentRoute(require_Silence.selectMenuRouteOf(type), defs, constructor);
|
|
157
159
|
};
|
|
158
160
|
}
|
|
159
161
|
|
|
@@ -192,10 +194,10 @@ var BaseHandler = class {
|
|
|
192
194
|
event;
|
|
193
195
|
logger;
|
|
194
196
|
dispatch;
|
|
195
|
-
constructor(event, core, dispatch) {
|
|
197
|
+
constructor(event, core, dispatch, channel) {
|
|
196
198
|
this.core = core;
|
|
197
199
|
this.event = event;
|
|
198
|
-
this.logger = new _seedcord_logger.Logger(this.constructor.name);
|
|
200
|
+
this.logger = new _seedcord_logger.Logger(this.constructor.name, { channel });
|
|
199
201
|
this.dispatch = dispatch;
|
|
200
202
|
}
|
|
201
203
|
};
|
|
@@ -215,7 +217,7 @@ var RepliableHandler = class extends BaseHandler {
|
|
|
215
217
|
sender;
|
|
216
218
|
routeId;
|
|
217
219
|
constructor(event, core, dispatch) {
|
|
218
|
-
super(event, core, dispatch);
|
|
220
|
+
super(event, core, dispatch, "interactions");
|
|
219
221
|
this.routeId = dispatch?.routeId ?? this.constructor.name;
|
|
220
222
|
this.sender = this.buildSender(event, core, this.routeId);
|
|
221
223
|
}
|
|
@@ -278,21 +280,21 @@ var RepliableHandler = class extends BaseHandler {
|
|
|
278
280
|
* }
|
|
279
281
|
* ```
|
|
280
282
|
*/
|
|
281
|
-
var Fault = class extends
|
|
283
|
+
var Fault = class extends require_Silence.Notice {
|
|
282
284
|
constructor(options) {
|
|
283
285
|
super("A fault occurred", options?.cause === void 0 ? void 0 : { cause: options.cause });
|
|
284
286
|
this.report = options?.report ?? true;
|
|
285
287
|
}
|
|
286
288
|
render(ctx) {
|
|
287
|
-
return { components: [new
|
|
289
|
+
return { components: [new require_Silence.NoticeCard(`Something went wrong. Please reach out to ${ctx.developerUsername ?? "the developer"} with a way to reproduce the error and the following:\n### UUID: \`${ctx.uuid}\``, "Error").component] };
|
|
288
290
|
}
|
|
289
291
|
};
|
|
290
292
|
|
|
291
293
|
//#endregion
|
|
292
294
|
//#region src/gates/combinators.ts
|
|
293
295
|
function and(...gates) {
|
|
294
|
-
return
|
|
295
|
-
for (const gate of gates) await
|
|
296
|
+
return require_Silence.defineGate(gates.map((gate) => gate.name).join(" & "), async (ctx) => {
|
|
297
|
+
for (const gate of gates) await require_Silence.runCheck(gate, ctx);
|
|
296
298
|
});
|
|
297
299
|
}
|
|
298
300
|
function isOrOptions(arg) {
|
|
@@ -302,17 +304,17 @@ function or(...args) {
|
|
|
302
304
|
const last = args.at(-1);
|
|
303
305
|
const options = last !== void 0 && isOrOptions(last) ? last : void 0;
|
|
304
306
|
const gates = options ? args.slice(0, -1) : args;
|
|
305
|
-
return
|
|
307
|
+
return require_Silence.defineGate(gates.map((gate) => gate.name).join(" | "), async (ctx) => {
|
|
306
308
|
const summaries = [];
|
|
307
309
|
let everyArmHasSummary = true;
|
|
308
310
|
for (const gate of gates) {
|
|
309
|
-
const mark =
|
|
311
|
+
const mark = require_Silence.markCommits(ctx);
|
|
310
312
|
try {
|
|
311
|
-
await
|
|
313
|
+
await require_Silence.runCheck(gate, ctx);
|
|
312
314
|
return;
|
|
313
315
|
} catch (error) {
|
|
314
|
-
if (error instanceof
|
|
315
|
-
|
|
316
|
+
if (error instanceof require_Silence.Notice && !(error instanceof Fault) && !error.report) {
|
|
317
|
+
require_Silence.rollbackCommits(ctx, mark);
|
|
316
318
|
if (error.summary === void 0) everyArmHasSummary = false;
|
|
317
319
|
else summaries.push(error.summary);
|
|
318
320
|
continue;
|
|
@@ -321,8 +323,8 @@ function or(...args) {
|
|
|
321
323
|
}
|
|
322
324
|
}
|
|
323
325
|
if (options) throw typeof options.fail === "function" ? options.fail(ctx) : options.fail;
|
|
324
|
-
if (everyArmHasSummary && summaries.length > 0) throw new
|
|
325
|
-
throw new
|
|
326
|
+
if (everyArmHasSummary && summaries.length > 0) throw new require_Silence.NeedsAny(summaries);
|
|
327
|
+
throw new require_Silence.NotAllowed();
|
|
326
328
|
});
|
|
327
329
|
}
|
|
328
330
|
|
|
@@ -355,10 +357,10 @@ function or(...args) {
|
|
|
355
357
|
* ```
|
|
356
358
|
*/
|
|
357
359
|
function OwnerOnly(options) {
|
|
358
|
-
return
|
|
360
|
+
return require_Silence.defineGate("OwnerOnly", (ctx) => {
|
|
359
361
|
const owners = ctx.core.config.ownerIds ?? [];
|
|
360
362
|
if (ctx.userId !== null && owners.includes(ctx.userId)) return;
|
|
361
|
-
throw
|
|
363
|
+
throw require_Silence.pickNotice(options, (message) => new require_Silence.NotOwner(message));
|
|
362
364
|
});
|
|
363
365
|
}
|
|
364
366
|
/**
|
|
@@ -384,9 +386,9 @@ function OwnerOnly(options) {
|
|
|
384
386
|
* ```
|
|
385
387
|
*/
|
|
386
388
|
function GuildOnly(options) {
|
|
387
|
-
return
|
|
389
|
+
return require_Silence.defineGate("GuildOnly", (ctx) => {
|
|
388
390
|
if (ctx.guildId) return;
|
|
389
|
-
throw
|
|
391
|
+
throw require_Silence.pickNotice(options, (message) => new require_Silence.NotInGuild(message));
|
|
390
392
|
});
|
|
391
393
|
}
|
|
392
394
|
/**
|
|
@@ -410,9 +412,9 @@ function GuildOnly(options) {
|
|
|
410
412
|
* ```
|
|
411
413
|
*/
|
|
412
414
|
function DmOnly(options) {
|
|
413
|
-
return
|
|
415
|
+
return require_Silence.defineGate("DmOnly", (ctx) => {
|
|
414
416
|
if (!ctx.guildId) return;
|
|
415
|
-
throw
|
|
417
|
+
throw require_Silence.pickNotice(options, (message) => new require_Silence.NotInDm(message));
|
|
416
418
|
});
|
|
417
419
|
}
|
|
418
420
|
|
|
@@ -484,45 +486,16 @@ function Cooldown(duration, options) {
|
|
|
484
486
|
};
|
|
485
487
|
const anonId = anonSeq++;
|
|
486
488
|
const keyOf = (ctx) => `cooldown:${ctx.routeId ?? `anon${anonId}`}:${per}:w${windowMs}:l${options?.limit ?? 1}:${scopeValue(ctx, per)}`;
|
|
487
|
-
return
|
|
489
|
+
return require_Silence.defineEffectGate("Cooldown", async (ctx) => {
|
|
488
490
|
const result = await ctx.core.rateLimiter.peek(keyOf(ctx), window);
|
|
489
491
|
if (!result.limited) return;
|
|
490
492
|
if (options?.notice) throw options.notice(result.resetAt);
|
|
491
|
-
throw new
|
|
493
|
+
throw new require_Silence.OnCooldown(result.resetAt, options?.message?.(result.resetAt));
|
|
492
494
|
}, async (ctx) => {
|
|
493
495
|
await ctx.core.rateLimiter.charge(keyOf(ctx), window);
|
|
494
496
|
});
|
|
495
497
|
}
|
|
496
498
|
|
|
497
|
-
//#endregion
|
|
498
|
-
//#region src/stops/Silence.ts
|
|
499
|
-
/**
|
|
500
|
-
* Throw to stop a handler with no reply and no report.
|
|
501
|
-
*
|
|
502
|
-
* The framework boundary catches `Silence` before {@link Notice}, makes zero Discord calls, and stops.
|
|
503
|
-
* Ideally you'd only throw this in `EventHandlers` (or `Gates` for those), because it doesn't make sense to
|
|
504
|
-
* leave the user with no reply for an interaction.
|
|
505
|
-
*
|
|
506
|
-
* @example
|
|
507
|
-
* ```ts
|
|
508
|
-
* import { Silence } from '@seedcord/gateway';
|
|
509
|
-
*
|
|
510
|
-
* // before any reply or defer, drop the interaction with no reply and no report
|
|
511
|
-
* if (await isBlacklisted(interaction.user.id)) throw new Silence('blacklisted user');
|
|
512
|
-
* ```
|
|
513
|
-
*/
|
|
514
|
-
var Silence = class extends Error {
|
|
515
|
-
reason;
|
|
516
|
-
/**
|
|
517
|
-
* @param reason - Optional note written only to a debug log, never shown to the user or reported.
|
|
518
|
-
*/
|
|
519
|
-
constructor(reason) {
|
|
520
|
-
super(reason ?? "Silence");
|
|
521
|
-
this.reason = reason;
|
|
522
|
-
Error.captureStackTrace(this, this.constructor);
|
|
523
|
-
}
|
|
524
|
-
};
|
|
525
|
-
|
|
526
499
|
//#endregion
|
|
527
500
|
//#region src/pagination/paginate.ts
|
|
528
501
|
/**
|
|
@@ -552,38 +525,43 @@ function paginate(items, page, perPage) {
|
|
|
552
525
|
//#endregion
|
|
553
526
|
//#region src/index.ts
|
|
554
527
|
/** Package version */
|
|
555
|
-
const version = "0.1.0-next.
|
|
528
|
+
const version = "0.1.0-next.7";
|
|
556
529
|
|
|
557
530
|
//#endregion
|
|
558
531
|
exports.AutocompleteRoute = AutocompleteRoute;
|
|
559
532
|
exports.BaseHandler = BaseHandler;
|
|
560
|
-
exports.BuilderComponent =
|
|
533
|
+
exports.BuilderComponent = require_publishDefault.BuilderComponent;
|
|
534
|
+
exports.Bus = require_subscribers.Bus;
|
|
561
535
|
exports.ButtonRoute = ButtonRoute;
|
|
562
536
|
exports.ContextMenuRoute = ContextMenuRoute;
|
|
563
537
|
exports.Cooldown = Cooldown;
|
|
564
|
-
exports.CustomId =
|
|
538
|
+
exports.CustomId = require_Silence.CustomId;
|
|
565
539
|
exports.DispatchContext = DispatchContext;
|
|
566
540
|
exports.DmOnly = DmOnly;
|
|
567
541
|
exports.Fault = Fault;
|
|
568
542
|
exports.GuildOnly = GuildOnly;
|
|
569
543
|
exports.ModalRoute = ModalRoute;
|
|
570
|
-
exports.Notice =
|
|
544
|
+
exports.Notice = require_Silence.Notice;
|
|
571
545
|
exports.OwnerOnly = OwnerOnly;
|
|
572
546
|
exports.RegisterCommand = RegisterCommand;
|
|
573
547
|
exports.RepliableHandler = RepliableHandler;
|
|
574
|
-
exports.RequireBotPermissions =
|
|
575
|
-
exports.RequirePermissions =
|
|
576
|
-
exports.RequireRole =
|
|
577
|
-
exports.RowComponent =
|
|
578
|
-
exports.SelectMenuKind =
|
|
548
|
+
exports.RequireBotPermissions = require_Silence.RequireBotPermissions;
|
|
549
|
+
exports.RequirePermissions = require_Silence.RequirePermissions;
|
|
550
|
+
exports.RequireRole = require_Silence.RequireRole;
|
|
551
|
+
exports.RowComponent = require_publishDefault.RowComponent;
|
|
552
|
+
exports.SelectMenuKind = require_Silence.SelectMenuKind;
|
|
579
553
|
exports.SelectMenuRoute = SelectMenuRoute;
|
|
580
554
|
exports.ShutdownPhase = require_phases.ShutdownPhase;
|
|
581
|
-
exports.Silence = Silence;
|
|
555
|
+
exports.Silence = require_Silence.Silence;
|
|
582
556
|
exports.SlashRoute = SlashRoute;
|
|
583
557
|
exports.StartupPhase = require_phases.StartupPhase;
|
|
558
|
+
exports.Subscribe = require_subscribers.Subscribe;
|
|
559
|
+
exports.Subscriber = require_subscribers.Subscriber;
|
|
560
|
+
exports.WebhookLog = require_subscribers.WebhookLog;
|
|
561
|
+
exports.WebhookUrl = require_subscribers.WebhookUrl;
|
|
584
562
|
exports.and = and;
|
|
585
|
-
exports.defineEffectGate =
|
|
586
|
-
exports.defineGate =
|
|
563
|
+
exports.defineEffectGate = require_Silence.defineEffectGate;
|
|
564
|
+
exports.defineGate = require_Silence.defineGate;
|
|
587
565
|
exports.or = or;
|
|
588
566
|
exports.paginate = paginate;
|
|
589
567
|
exports.version = version;
|