bakit 1.0.0-beta.12 → 1.0.0-beta.13
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.ts +0 -1
- package/dist/index.js +169 -271
- package/package.json +1 -2
package/dist/index.d.ts
CHANGED
|
@@ -252,7 +252,6 @@ declare class ListenerEntry<E extends EventsLike, K extends keyof E> extends Bas
|
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
declare namespace ListenerAPI {
|
|
255
|
-
const ENTRY_KEY: unique symbol;
|
|
256
255
|
function use<E extends EventsLike, K extends keyof E>(entry: ListenerEntry<E, K>): (target: ConstructorLike) => void;
|
|
257
256
|
function getEntry<E extends EventsLike, K extends keyof E>(target: ConstructorLike): ListenerEntry<E, K> | undefined;
|
|
258
257
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// src/index.ts
|
|
5
|
-
import "reflect-metadata";
|
|
6
|
-
|
|
7
1
|
// src/BakitClient.ts
|
|
8
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Client,
|
|
4
|
+
codeBlock,
|
|
5
|
+
Events
|
|
6
|
+
} from "discord.js";
|
|
9
7
|
|
|
10
8
|
// src/command/CommandRegistry.ts
|
|
11
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
Collection as Collection2,
|
|
11
|
+
SlashCommandBuilder,
|
|
12
|
+
SlashCommandSubcommandBuilder,
|
|
13
|
+
SlashCommandSubcommandGroupBuilder
|
|
14
|
+
} from "discord.js";
|
|
12
15
|
import glob from "tiny-glob";
|
|
13
16
|
import { pathToFileURL } from "url";
|
|
14
17
|
|
|
@@ -16,33 +19,23 @@ import { pathToFileURL } from "url";
|
|
|
16
19
|
import { Collection } from "discord.js";
|
|
17
20
|
|
|
18
21
|
// src/base/BaseEntry.ts
|
|
19
|
-
var HookExecutionState = /* @__PURE__ */ (function(HookExecutionState2) {
|
|
20
|
-
HookExecutionState2["Main"] = "MAIN";
|
|
21
|
-
HookExecutionState2["Pre"] = "PRE";
|
|
22
|
-
HookExecutionState2["Post"] = "POST";
|
|
23
|
-
HookExecutionState2["Error"] = "ERROR";
|
|
24
|
-
return HookExecutionState2;
|
|
25
|
-
})({});
|
|
26
22
|
var BaseEntry = class {
|
|
27
|
-
static {
|
|
28
|
-
__name(this, "BaseEntry");
|
|
29
|
-
}
|
|
30
23
|
target;
|
|
31
24
|
hooks = {
|
|
32
|
-
["MAIN"]: void 0,
|
|
33
|
-
["ERROR"]: void 0,
|
|
34
|
-
["POST"]: void 0,
|
|
35
|
-
["PRE"]: void 0
|
|
25
|
+
["MAIN" /* Main */]: void 0,
|
|
26
|
+
["ERROR" /* Error */]: void 0,
|
|
27
|
+
["POST" /* Post */]: void 0,
|
|
28
|
+
["PRE" /* Pre */]: void 0
|
|
36
29
|
};
|
|
37
30
|
main;
|
|
38
31
|
pre;
|
|
39
32
|
post;
|
|
40
33
|
error;
|
|
41
34
|
constructor() {
|
|
42
|
-
this.main = this.createMainHookDecorator("MAIN");
|
|
43
|
-
this.pre = this.createMainHookDecorator("PRE");
|
|
44
|
-
this.post = this.createMainHookDecorator("POST");
|
|
45
|
-
this.error = this.createMainHookDecorator("ERROR");
|
|
35
|
+
this.main = this.createMainHookDecorator("MAIN" /* Main */);
|
|
36
|
+
this.pre = this.createMainHookDecorator("PRE" /* Pre */);
|
|
37
|
+
this.post = this.createMainHookDecorator("POST" /* Post */);
|
|
38
|
+
this.error = this.createMainHookDecorator("ERROR" /* Error */);
|
|
46
39
|
}
|
|
47
40
|
setTarget(target) {
|
|
48
41
|
this.target = target;
|
|
@@ -76,27 +69,15 @@ var BaseEntry = class {
|
|
|
76
69
|
|
|
77
70
|
// src/command/CommandEntry.ts
|
|
78
71
|
var BaseCommandEntry = class extends BaseEntry {
|
|
79
|
-
static {
|
|
80
|
-
__name(this, "BaseCommandEntry");
|
|
81
|
-
}
|
|
82
|
-
options;
|
|
83
72
|
constructor(options) {
|
|
84
|
-
super()
|
|
73
|
+
super();
|
|
74
|
+
this.options = options;
|
|
85
75
|
}
|
|
86
76
|
};
|
|
87
77
|
var BaseCommandGroupEntry = class extends BaseCommandEntry {
|
|
88
|
-
static {
|
|
89
|
-
__name(this, "BaseCommandGroupEntry");
|
|
90
|
-
}
|
|
91
78
|
children = new Collection();
|
|
92
79
|
subcommand(options) {
|
|
93
|
-
const fullOptions = typeof options === "string" ? {
|
|
94
|
-
name: options,
|
|
95
|
-
description: `${options} command`
|
|
96
|
-
} : {
|
|
97
|
-
description: `${options.name} command`,
|
|
98
|
-
...options
|
|
99
|
-
};
|
|
80
|
+
const fullOptions = typeof options === "string" ? { name: options, description: `${options} command` } : { description: `${options.name} command`, ...options };
|
|
100
81
|
if (this.children.has(fullOptions.name)) {
|
|
101
82
|
throw new Error(`Entry "${fullOptions.name}" is already existed.`);
|
|
102
83
|
}
|
|
@@ -106,17 +87,8 @@ var BaseCommandGroupEntry = class extends BaseCommandEntry {
|
|
|
106
87
|
}
|
|
107
88
|
};
|
|
108
89
|
var RootCommandEntry = class extends BaseCommandGroupEntry {
|
|
109
|
-
static {
|
|
110
|
-
__name(this, "RootCommandEntry");
|
|
111
|
-
}
|
|
112
90
|
group(options) {
|
|
113
|
-
const fullOptions = typeof options === "string" ? {
|
|
114
|
-
name: options,
|
|
115
|
-
description: `${options} command`
|
|
116
|
-
} : {
|
|
117
|
-
description: `${options.name} command`,
|
|
118
|
-
...options
|
|
119
|
-
};
|
|
91
|
+
const fullOptions = typeof options === "string" ? { name: options, description: `${options} command` } : { description: `${options.name} command`, ...options };
|
|
120
92
|
if (this.children.has(fullOptions.name)) {
|
|
121
93
|
throw new Error(`Entry "${fullOptions.name}" is already existed.`);
|
|
122
94
|
}
|
|
@@ -126,26 +98,21 @@ var RootCommandEntry = class extends BaseCommandGroupEntry {
|
|
|
126
98
|
}
|
|
127
99
|
};
|
|
128
100
|
var CommandGroupEntry = class extends BaseCommandGroupEntry {
|
|
129
|
-
static {
|
|
130
|
-
__name(this, "CommandGroupEntry");
|
|
131
|
-
}
|
|
132
|
-
parent;
|
|
133
101
|
constructor(options, parent) {
|
|
134
|
-
super(options)
|
|
102
|
+
super(options);
|
|
103
|
+
this.parent = parent;
|
|
135
104
|
}
|
|
136
105
|
};
|
|
137
106
|
var SubcommandEntry = class extends BaseCommandEntry {
|
|
138
|
-
static {
|
|
139
|
-
__name(this, "SubcommandEntry");
|
|
140
|
-
}
|
|
141
|
-
parent;
|
|
142
107
|
constructor(options, parent) {
|
|
143
|
-
super(options)
|
|
108
|
+
super(options);
|
|
109
|
+
this.parent = parent;
|
|
144
110
|
}
|
|
145
111
|
};
|
|
146
112
|
|
|
147
113
|
// src/command/Command.ts
|
|
148
|
-
|
|
114
|
+
var CommandAPI;
|
|
115
|
+
((CommandAPI2) => {
|
|
149
116
|
const rootEntries = /* @__PURE__ */ new WeakMap();
|
|
150
117
|
function use(root) {
|
|
151
118
|
return (target) => {
|
|
@@ -153,65 +120,49 @@ var SubcommandEntry = class extends BaseCommandEntry {
|
|
|
153
120
|
rootEntries.set(target, root);
|
|
154
121
|
};
|
|
155
122
|
}
|
|
156
|
-
__name(use, "use");
|
|
157
123
|
CommandAPI2.use = use;
|
|
158
124
|
function getRoot(constructor) {
|
|
159
125
|
return rootEntries.get(constructor);
|
|
160
126
|
}
|
|
161
|
-
__name(getRoot, "getRoot");
|
|
162
127
|
CommandAPI2.getRoot = getRoot;
|
|
163
128
|
})(CommandAPI || (CommandAPI = {}));
|
|
164
129
|
function CommandFactory(options) {
|
|
165
130
|
if (typeof options === "string") {
|
|
166
|
-
options = {
|
|
167
|
-
name: options
|
|
168
|
-
};
|
|
131
|
+
options = { name: options };
|
|
169
132
|
}
|
|
170
133
|
if (!options.description) {
|
|
171
134
|
options.description = options.name;
|
|
172
135
|
}
|
|
173
136
|
return new RootCommandEntry(options);
|
|
174
137
|
}
|
|
175
|
-
__name(CommandFactory, "CommandFactory");
|
|
176
138
|
var Command = Object.assign(CommandFactory, CommandAPI);
|
|
177
|
-
var CommandAPI;
|
|
178
139
|
|
|
179
140
|
// src/command/argument/Argument.ts
|
|
180
|
-
var ArgumentType = /* @__PURE__ */ (
|
|
141
|
+
var ArgumentType = /* @__PURE__ */ ((ArgumentType2) => {
|
|
181
142
|
ArgumentType2["String"] = "string";
|
|
182
143
|
ArgumentType2["Integer"] = "integer";
|
|
183
144
|
ArgumentType2["Number"] = "number";
|
|
184
145
|
ArgumentType2["User"] = "user";
|
|
185
146
|
ArgumentType2["Member"] = "member";
|
|
186
147
|
return ArgumentType2;
|
|
187
|
-
})({});
|
|
148
|
+
})(ArgumentType || {});
|
|
188
149
|
|
|
189
150
|
// src/command/argument/Arg.ts
|
|
190
|
-
var
|
|
191
|
-
var cache = /* @__PURE__ */ new WeakMap();
|
|
151
|
+
var store = /* @__PURE__ */ new WeakMap();
|
|
192
152
|
function getMethodArguments(method, init = false) {
|
|
193
|
-
let args =
|
|
153
|
+
let args = store.get(method);
|
|
194
154
|
if (!args) {
|
|
195
155
|
args = [];
|
|
196
156
|
if (init) {
|
|
197
|
-
|
|
198
|
-
cache.set(method, args);
|
|
157
|
+
store.set(method, args);
|
|
199
158
|
}
|
|
200
159
|
}
|
|
201
|
-
return init ? args : Object.freeze([
|
|
202
|
-
...args
|
|
203
|
-
]);
|
|
160
|
+
return init ? args : Object.freeze([...args]);
|
|
204
161
|
}
|
|
205
|
-
__name(getMethodArguments, "getMethodArguments");
|
|
206
162
|
function createArgument(type) {
|
|
207
163
|
return function(options) {
|
|
208
|
-
const objOptions = typeof options === "string" ? {
|
|
209
|
-
|
|
210
|
-
} : options;
|
|
211
|
-
const fullOptions = {
|
|
212
|
-
...objOptions,
|
|
213
|
-
type
|
|
214
|
-
};
|
|
164
|
+
const objOptions = typeof options === "string" ? { name: options } : options;
|
|
165
|
+
const fullOptions = { ...objOptions, type };
|
|
215
166
|
if (!fullOptions.description) {
|
|
216
167
|
fullOptions.description = fullOptions.name;
|
|
217
168
|
}
|
|
@@ -228,18 +179,15 @@ function createArgument(type) {
|
|
|
228
179
|
};
|
|
229
180
|
};
|
|
230
181
|
}
|
|
231
|
-
|
|
232
|
-
var
|
|
233
|
-
var
|
|
234
|
-
var
|
|
235
|
-
var
|
|
236
|
-
var member = createArgument(ArgumentType.Member);
|
|
182
|
+
var string = createArgument("string" /* String */);
|
|
183
|
+
var integer = createArgument("integer" /* Integer */);
|
|
184
|
+
var number = createArgument("number" /* Number */);
|
|
185
|
+
var user = createArgument("user" /* User */);
|
|
186
|
+
var member = createArgument("member" /* Member */);
|
|
237
187
|
function describeArgumentExpectation(arg) {
|
|
238
|
-
const parts = [
|
|
239
|
-
arg.type
|
|
240
|
-
];
|
|
188
|
+
const parts = [arg.type];
|
|
241
189
|
switch (arg.type) {
|
|
242
|
-
case
|
|
190
|
+
case "string" /* String */: {
|
|
243
191
|
if (arg.minLength && !arg.maxLength) {
|
|
244
192
|
parts.push(`\u2265 ${String(arg.minLength)}`);
|
|
245
193
|
}
|
|
@@ -251,8 +199,8 @@ function describeArgumentExpectation(arg) {
|
|
|
251
199
|
}
|
|
252
200
|
break;
|
|
253
201
|
}
|
|
254
|
-
case
|
|
255
|
-
case
|
|
202
|
+
case "number" /* Number */:
|
|
203
|
+
case "integer" /* Integer */: {
|
|
256
204
|
if (arg.minValue !== void 0 && arg.maxValue === void 0) {
|
|
257
205
|
parts.push(`\u2265 ${String(arg.minValue)}`);
|
|
258
206
|
}
|
|
@@ -264,14 +212,9 @@ function describeArgumentExpectation(arg) {
|
|
|
264
212
|
}
|
|
265
213
|
break;
|
|
266
214
|
}
|
|
267
|
-
case ArgumentType.User:
|
|
268
|
-
case ArgumentType.Member: {
|
|
269
|
-
break;
|
|
270
|
-
}
|
|
271
215
|
}
|
|
272
216
|
return parts.join(", ");
|
|
273
217
|
}
|
|
274
|
-
__name(describeArgumentExpectation, "describeArgumentExpectation");
|
|
275
218
|
function format(arg) {
|
|
276
219
|
const { name, required, tuple } = arg;
|
|
277
220
|
const opening = required ? "<" : "[";
|
|
@@ -279,7 +222,6 @@ function format(arg) {
|
|
|
279
222
|
const prefix = tuple ? "..." : "";
|
|
280
223
|
return `${opening}${prefix}${name}: ${describeArgumentExpectation(arg)}${closing}`;
|
|
281
224
|
}
|
|
282
|
-
__name(format, "format");
|
|
283
225
|
var Arg = {
|
|
284
226
|
getMethodArguments,
|
|
285
227
|
createArgument,
|
|
@@ -294,15 +236,12 @@ var Arg = {
|
|
|
294
236
|
|
|
295
237
|
// src/command/CommandRegistry.ts
|
|
296
238
|
var CommandRegistry = class _CommandRegistry {
|
|
297
|
-
static {
|
|
298
|
-
__name(this, "CommandRegistry");
|
|
299
|
-
}
|
|
300
239
|
static constructors = new Collection2();
|
|
301
240
|
static instances = new Collection2();
|
|
302
241
|
/**
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
242
|
+
* Add a command to the registry.
|
|
243
|
+
* @param constructor The command class you want to add.
|
|
244
|
+
*/
|
|
306
245
|
static add(constructor) {
|
|
307
246
|
const root = Command.getRoot(constructor);
|
|
308
247
|
if (!root) {
|
|
@@ -313,11 +252,11 @@ var CommandRegistry = class _CommandRegistry {
|
|
|
313
252
|
this.instances.set(options.name, new constructor());
|
|
314
253
|
}
|
|
315
254
|
/**
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
255
|
+
* Load and add all commands which matched provided glob pattern to the registry.
|
|
256
|
+
* @param pattern glob pattern to load.
|
|
257
|
+
* @param parallel load all matched results in parallel, enabled by default.
|
|
258
|
+
* @returns All loaded command constructors.
|
|
259
|
+
*/
|
|
321
260
|
static async load(pattern, parallel = true) {
|
|
322
261
|
const files = await glob(pattern);
|
|
323
262
|
const loaders = files.map(async (file) => {
|
|
@@ -336,10 +275,10 @@ var CommandRegistry = class _CommandRegistry {
|
|
|
336
275
|
return result;
|
|
337
276
|
}
|
|
338
277
|
/**
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
278
|
+
* Build a command into application command data.
|
|
279
|
+
* @param constructor The command class you want to build.
|
|
280
|
+
* @returns a REST JSON version of the application command data.
|
|
281
|
+
*/
|
|
343
282
|
static buildSlashCommand(constructor) {
|
|
344
283
|
const root = Command.getRoot(constructor);
|
|
345
284
|
if (!root) {
|
|
@@ -357,7 +296,7 @@ var CommandRegistry = class _CommandRegistry {
|
|
|
357
296
|
}
|
|
358
297
|
static getMainHookArguments(entry) {
|
|
359
298
|
const { hooks } = entry;
|
|
360
|
-
const mainHook = hooks[
|
|
299
|
+
const mainHook = hooks["MAIN" /* Main */];
|
|
361
300
|
return mainHook ? Arg.getMethodArguments(mainHook.method) : [];
|
|
362
301
|
}
|
|
363
302
|
static buildSlashCommandSubcommands(parent, entry, inheritedArgs) {
|
|
@@ -384,20 +323,17 @@ var CommandRegistry = class _CommandRegistry {
|
|
|
384
323
|
}
|
|
385
324
|
static buildSlashCommandOptions(builder, args) {
|
|
386
325
|
const argGroup = Object.groupBy(args, ({ required }) => required ? "required" : "optional");
|
|
387
|
-
const orderedArgs = [
|
|
388
|
-
...argGroup.required || [],
|
|
389
|
-
...argGroup.optional || []
|
|
390
|
-
];
|
|
326
|
+
const orderedArgs = [...argGroup.required || [], ...argGroup.optional || []];
|
|
391
327
|
for (const arg of orderedArgs) {
|
|
392
328
|
this.attachSlashCommandOption(builder, arg);
|
|
393
329
|
}
|
|
394
330
|
}
|
|
395
331
|
static attachSlashCommandOption(builder, arg) {
|
|
396
|
-
const setupOption =
|
|
332
|
+
const setupOption = (option) => {
|
|
397
333
|
return option.setName(arg.name).setDescription(arg.description || arg.name).setRequired(Boolean(arg.required));
|
|
398
|
-
}
|
|
334
|
+
};
|
|
399
335
|
switch (arg.type) {
|
|
400
|
-
case
|
|
336
|
+
case "string" /* String */: {
|
|
401
337
|
builder.addStringOption((data) => {
|
|
402
338
|
const option = setupOption(data);
|
|
403
339
|
if (arg.maxLength) {
|
|
@@ -410,7 +346,7 @@ var CommandRegistry = class _CommandRegistry {
|
|
|
410
346
|
});
|
|
411
347
|
break;
|
|
412
348
|
}
|
|
413
|
-
case
|
|
349
|
+
case "integer" /* Integer */: {
|
|
414
350
|
builder.addIntegerOption((data) => {
|
|
415
351
|
const option = setupOption(data);
|
|
416
352
|
if (arg.maxValue) {
|
|
@@ -423,7 +359,7 @@ var CommandRegistry = class _CommandRegistry {
|
|
|
423
359
|
});
|
|
424
360
|
break;
|
|
425
361
|
}
|
|
426
|
-
case
|
|
362
|
+
case "number" /* Number */: {
|
|
427
363
|
builder.addNumberOption((data) => {
|
|
428
364
|
const option = setupOption(data);
|
|
429
365
|
if (arg.maxValue) {
|
|
@@ -436,8 +372,8 @@ var CommandRegistry = class _CommandRegistry {
|
|
|
436
372
|
});
|
|
437
373
|
break;
|
|
438
374
|
}
|
|
439
|
-
case
|
|
440
|
-
case
|
|
375
|
+
case "user" /* User */:
|
|
376
|
+
case "member" /* Member */: {
|
|
441
377
|
builder.addUserOption((option) => setupOption(option));
|
|
442
378
|
break;
|
|
443
379
|
}
|
|
@@ -446,12 +382,11 @@ var CommandRegistry = class _CommandRegistry {
|
|
|
446
382
|
};
|
|
447
383
|
|
|
448
384
|
// src/command/Context.ts
|
|
449
|
-
import {
|
|
385
|
+
import {
|
|
386
|
+
ChatInputCommandInteraction,
|
|
387
|
+
Message
|
|
388
|
+
} from "discord.js";
|
|
450
389
|
var BaseContext = class {
|
|
451
|
-
static {
|
|
452
|
-
__name(this, "BaseContext");
|
|
453
|
-
}
|
|
454
|
-
source;
|
|
455
390
|
constructor(source) {
|
|
456
391
|
this.source = source;
|
|
457
392
|
}
|
|
@@ -499,14 +434,9 @@ var BaseContext = class {
|
|
|
499
434
|
}
|
|
500
435
|
};
|
|
501
436
|
var ChatInputContext = class extends BaseContext {
|
|
502
|
-
static {
|
|
503
|
-
__name(this, "ChatInputContext");
|
|
504
|
-
}
|
|
505
437
|
async send(options) {
|
|
506
438
|
if (typeof options === "string") {
|
|
507
|
-
options = {
|
|
508
|
-
content: options
|
|
509
|
-
};
|
|
439
|
+
options = { content: options };
|
|
510
440
|
}
|
|
511
441
|
const sendOptions = {
|
|
512
442
|
...options,
|
|
@@ -520,9 +450,6 @@ var ChatInputContext = class extends BaseContext {
|
|
|
520
450
|
}
|
|
521
451
|
};
|
|
522
452
|
var MessageContext = class extends BaseContext {
|
|
523
|
-
static {
|
|
524
|
-
__name(this, "MessageContext");
|
|
525
|
-
}
|
|
526
453
|
async send(options) {
|
|
527
454
|
const { channel } = this;
|
|
528
455
|
if (!channel?.isSendable()) {
|
|
@@ -544,19 +471,15 @@ function extractId(value) {
|
|
|
544
471
|
}
|
|
545
472
|
return null;
|
|
546
473
|
}
|
|
547
|
-
__name(extractId, "extractId");
|
|
548
474
|
|
|
549
475
|
// src/errors/CommandSyntaxError.ts
|
|
550
|
-
var CommandSyntaxErrorType = /* @__PURE__ */ (
|
|
476
|
+
var CommandSyntaxErrorType = /* @__PURE__ */ ((CommandSyntaxErrorType2) => {
|
|
551
477
|
CommandSyntaxErrorType2["MissingRequireArgument"] = "MISSING_REQUIRE_ARGUMENT";
|
|
552
478
|
CommandSyntaxErrorType2["InvalidArgument"] = "INVALID_ARGUMENT";
|
|
553
479
|
CommandSyntaxErrorType2["InvalidVariadicArgumentValue"] = "INVALID_VARIADIC_ARGUMENT_VALUE";
|
|
554
480
|
return CommandSyntaxErrorType2;
|
|
555
|
-
})({});
|
|
481
|
+
})(CommandSyntaxErrorType || {});
|
|
556
482
|
var CommandSyntaxError = class extends Error {
|
|
557
|
-
static {
|
|
558
|
-
__name(this, "CommandSyntaxError");
|
|
559
|
-
}
|
|
560
483
|
arg;
|
|
561
484
|
type;
|
|
562
485
|
expected;
|
|
@@ -566,14 +489,11 @@ var CommandSyntaxError = class extends Error {
|
|
|
566
489
|
const { arg, type, received } = options;
|
|
567
490
|
const expected = Arg.describeArgumentExpectation(arg);
|
|
568
491
|
switch (type) {
|
|
569
|
-
case "MISSING_REQUIRE_ARGUMENT"
|
|
570
|
-
message = [
|
|
571
|
-
`Missing required argument "${arg.name}"`,
|
|
572
|
-
`> Expected: ${expected}`
|
|
573
|
-
].join("\n");
|
|
492
|
+
case "MISSING_REQUIRE_ARGUMENT" /* MissingRequireArgument */: {
|
|
493
|
+
message = [`Missing required argument "${arg.name}"`, `> Expected: ${expected}`].join("\n");
|
|
574
494
|
break;
|
|
575
495
|
}
|
|
576
|
-
case "INVALID_ARGUMENT"
|
|
496
|
+
case "INVALID_ARGUMENT" /* InvalidArgument */: {
|
|
577
497
|
message = [
|
|
578
498
|
`Invalid value received for argument "${arg.name}"`,
|
|
579
499
|
`> Expected: ${expected}`,
|
|
@@ -581,7 +501,7 @@ var CommandSyntaxError = class extends Error {
|
|
|
581
501
|
].join("\n");
|
|
582
502
|
break;
|
|
583
503
|
}
|
|
584
|
-
case "INVALID_VARIADIC_ARGUMENT_VALUE"
|
|
504
|
+
case "INVALID_VARIADIC_ARGUMENT_VALUE" /* InvalidVariadicArgumentValue */: {
|
|
585
505
|
message = [
|
|
586
506
|
`Invalid value received for variadic argument "${arg.name}"`,
|
|
587
507
|
`> Expected: ${expected}`,
|
|
@@ -608,33 +528,27 @@ var CommandSyntaxError = class extends Error {
|
|
|
608
528
|
|
|
609
529
|
// src/command/argument/ArgumentResolver.ts
|
|
610
530
|
var ArgumentResolver = class _ArgumentResolver {
|
|
611
|
-
static {
|
|
612
|
-
__name(this, "ArgumentResolver");
|
|
613
|
-
}
|
|
614
|
-
options;
|
|
615
|
-
parsedValues = [];
|
|
616
531
|
constructor(options) {
|
|
617
532
|
this.options = options;
|
|
618
533
|
}
|
|
534
|
+
parsedValues = [];
|
|
619
535
|
/**
|
|
620
|
-
|
|
621
|
-
|
|
536
|
+
* Get the first value as the command trigger.
|
|
537
|
+
*/
|
|
622
538
|
get trigger() {
|
|
623
539
|
return this.options.values[0];
|
|
624
540
|
}
|
|
625
541
|
/**
|
|
626
|
-
|
|
627
|
-
|
|
542
|
+
* Get amount of specified argument values.
|
|
543
|
+
*/
|
|
628
544
|
get specifiedAmount() {
|
|
629
545
|
return this.options.values.length - this.options.startAt;
|
|
630
546
|
}
|
|
631
547
|
/**
|
|
632
|
-
|
|
633
|
-
|
|
548
|
+
* Get parsed raw values from content.
|
|
549
|
+
*/
|
|
634
550
|
get values() {
|
|
635
|
-
return [
|
|
636
|
-
...this.options.values
|
|
637
|
-
];
|
|
551
|
+
return [...this.options.values];
|
|
638
552
|
}
|
|
639
553
|
get client() {
|
|
640
554
|
return this.options.message.client;
|
|
@@ -646,9 +560,7 @@ var ArgumentResolver = class _ArgumentResolver {
|
|
|
646
560
|
// Custom prefixes specified in options
|
|
647
561
|
...client.options.prefixes ?? [],
|
|
648
562
|
// Use bot mention as prefix if enabled
|
|
649
|
-
...enableMentionPrefix ? [
|
|
650
|
-
client.user.toString()
|
|
651
|
-
] : []
|
|
563
|
+
...enableMentionPrefix ? [client.user.toString()] : []
|
|
652
564
|
];
|
|
653
565
|
const prefix = prefixes.find((p) => message.content.startsWith(p)) ?? null;
|
|
654
566
|
if (!prefix) {
|
|
@@ -658,6 +570,7 @@ var ArgumentResolver = class _ArgumentResolver {
|
|
|
658
570
|
return new _ArgumentResolver({
|
|
659
571
|
message,
|
|
660
572
|
startAt: 1,
|
|
573
|
+
// Skip the command trigger
|
|
661
574
|
values,
|
|
662
575
|
args: [],
|
|
663
576
|
prefix
|
|
@@ -671,9 +584,7 @@ var ArgumentResolver = class _ArgumentResolver {
|
|
|
671
584
|
args,
|
|
672
585
|
startAt: this.options.startAt
|
|
673
586
|
});
|
|
674
|
-
child.parsedValues = [
|
|
675
|
-
...this.parsedValues
|
|
676
|
-
];
|
|
587
|
+
child.parsedValues = [...this.parsedValues];
|
|
677
588
|
if (!child.options.args.length) {
|
|
678
589
|
return child;
|
|
679
590
|
}
|
|
@@ -699,7 +610,7 @@ var ArgumentResolver = class _ArgumentResolver {
|
|
|
699
610
|
if (matchedValue === null) {
|
|
700
611
|
throw new CommandSyntaxError({
|
|
701
612
|
arg,
|
|
702
|
-
type:
|
|
613
|
+
type: "INVALID_ARGUMENT" /* InvalidArgument */,
|
|
703
614
|
received: value
|
|
704
615
|
});
|
|
705
616
|
}
|
|
@@ -726,7 +637,7 @@ var ArgumentResolver = class _ArgumentResolver {
|
|
|
726
637
|
} else if (arg.required) {
|
|
727
638
|
throw new CommandSyntaxError({
|
|
728
639
|
arg,
|
|
729
|
-
type:
|
|
640
|
+
type: "MISSING_REQUIRE_ARGUMENT" /* MissingRequireArgument */,
|
|
730
641
|
received: value
|
|
731
642
|
});
|
|
732
643
|
}
|
|
@@ -737,7 +648,7 @@ var ArgumentResolver = class _ArgumentResolver {
|
|
|
737
648
|
if (arg.required) {
|
|
738
649
|
throw new CommandSyntaxError({
|
|
739
650
|
arg,
|
|
740
|
-
type:
|
|
651
|
+
type: "MISSING_REQUIRE_ARGUMENT" /* MissingRequireArgument */,
|
|
741
652
|
received: "nothing"
|
|
742
653
|
});
|
|
743
654
|
}
|
|
@@ -755,7 +666,7 @@ var ArgumentResolver = class _ArgumentResolver {
|
|
|
755
666
|
if (matchedValue === null) {
|
|
756
667
|
throw new CommandSyntaxError({
|
|
757
668
|
arg,
|
|
758
|
-
type:
|
|
669
|
+
type: "INVALID_VARIADIC_ARGUMENT_VALUE" /* InvalidVariadicArgumentValue */,
|
|
759
670
|
received: rest
|
|
760
671
|
});
|
|
761
672
|
}
|
|
@@ -764,7 +675,7 @@ var ArgumentResolver = class _ArgumentResolver {
|
|
|
764
675
|
if (values.length === 0 && arg.required) {
|
|
765
676
|
throw new CommandSyntaxError({
|
|
766
677
|
arg,
|
|
767
|
-
type:
|
|
678
|
+
type: "MISSING_REQUIRE_ARGUMENT" /* MissingRequireArgument */,
|
|
768
679
|
received: "nothing"
|
|
769
680
|
});
|
|
770
681
|
}
|
|
@@ -772,13 +683,13 @@ var ArgumentResolver = class _ArgumentResolver {
|
|
|
772
683
|
}
|
|
773
684
|
async matchValue(arg, value) {
|
|
774
685
|
switch (arg.type) {
|
|
775
|
-
case
|
|
686
|
+
case "user" /* User */:
|
|
776
687
|
return await this.matchUserValue(arg, value);
|
|
777
|
-
case
|
|
688
|
+
case "integer" /* Integer */:
|
|
778
689
|
return this.matchIntegerValue(arg, value);
|
|
779
|
-
case
|
|
690
|
+
case "number" /* Number */:
|
|
780
691
|
return this.matchNumberValue(arg, value);
|
|
781
|
-
case
|
|
692
|
+
case "string" /* String */:
|
|
782
693
|
return this.matchStringValue(arg, value);
|
|
783
694
|
default:
|
|
784
695
|
return null;
|
|
@@ -832,15 +743,15 @@ var ArgumentResolver = class _ArgumentResolver {
|
|
|
832
743
|
}
|
|
833
744
|
static resolveChatInput(interaction, arg) {
|
|
834
745
|
switch (arg.type) {
|
|
835
|
-
case
|
|
746
|
+
case "string" /* String */:
|
|
836
747
|
return interaction.options.getString(arg.name, arg.required);
|
|
837
|
-
case
|
|
748
|
+
case "integer" /* Integer */:
|
|
838
749
|
return interaction.options.getInteger(arg.name, arg.required);
|
|
839
|
-
case
|
|
750
|
+
case "number" /* Number */:
|
|
840
751
|
return interaction.options.getNumber(arg.name, arg.required);
|
|
841
|
-
case
|
|
752
|
+
case "user" /* User */:
|
|
842
753
|
return interaction.options.getUser(arg.name, arg.required);
|
|
843
|
-
case
|
|
754
|
+
case "member" /* Member */:
|
|
844
755
|
return interaction.options.getMember(arg.name);
|
|
845
756
|
default:
|
|
846
757
|
return null;
|
|
@@ -851,9 +762,6 @@ var ArgumentResolver = class _ArgumentResolver {
|
|
|
851
762
|
// src/libs/StateBox.ts
|
|
852
763
|
import { AsyncLocalStorage } from "async_hooks";
|
|
853
764
|
var StateBox = class _StateBox {
|
|
854
|
-
static {
|
|
855
|
-
__name(this, "StateBox");
|
|
856
|
-
}
|
|
857
765
|
static STATES_KEY = Symbol("states");
|
|
858
766
|
static storage = new AsyncLocalStorage();
|
|
859
767
|
static getState() {
|
|
@@ -863,8 +771,8 @@ var StateBox = class _StateBox {
|
|
|
863
771
|
}
|
|
864
772
|
return state;
|
|
865
773
|
}
|
|
866
|
-
static run(fn,
|
|
867
|
-
return this.storage.run(
|
|
774
|
+
static run(fn, store2 = {}) {
|
|
775
|
+
return this.storage.run(store2, fn);
|
|
868
776
|
}
|
|
869
777
|
static wrap(fn) {
|
|
870
778
|
const currentStore = this.storage.getStore();
|
|
@@ -896,61 +804,46 @@ var StateBox = class _StateBox {
|
|
|
896
804
|
|
|
897
805
|
// src/listener/ListenerEntry.ts
|
|
898
806
|
var ListenerEntry = class extends BaseEntry {
|
|
899
|
-
static {
|
|
900
|
-
__name(this, "ListenerEntry");
|
|
901
|
-
}
|
|
902
|
-
options;
|
|
903
807
|
constructor(options) {
|
|
904
|
-
super()
|
|
808
|
+
super();
|
|
809
|
+
this.options = options;
|
|
905
810
|
}
|
|
906
811
|
};
|
|
907
812
|
|
|
908
813
|
// src/listener/Listener.ts
|
|
909
|
-
|
|
910
|
-
|
|
814
|
+
var ListenerAPI;
|
|
815
|
+
((ListenerAPI2) => {
|
|
816
|
+
const entries = /* @__PURE__ */ new WeakMap();
|
|
911
817
|
function use(entry) {
|
|
912
818
|
return (target) => {
|
|
913
|
-
|
|
819
|
+
entries.set(target, entry);
|
|
914
820
|
};
|
|
915
821
|
}
|
|
916
|
-
__name(use, "use");
|
|
917
822
|
ListenerAPI2.use = use;
|
|
918
823
|
function getEntry(target) {
|
|
919
|
-
return
|
|
824
|
+
return entries.get(target);
|
|
920
825
|
}
|
|
921
|
-
__name(getEntry, "getEntry");
|
|
922
826
|
ListenerAPI2.getEntry = getEntry;
|
|
923
827
|
})(ListenerAPI || (ListenerAPI = {}));
|
|
924
828
|
function ListenerFactory(options) {
|
|
925
|
-
const fullOptions = typeof options !== "object" ? {
|
|
926
|
-
name: options,
|
|
927
|
-
once: false
|
|
928
|
-
} : {
|
|
929
|
-
once: false,
|
|
930
|
-
...options
|
|
931
|
-
};
|
|
829
|
+
const fullOptions = typeof options !== "object" ? { name: options, once: false } : { once: false, ...options };
|
|
932
830
|
return new ListenerEntry(fullOptions);
|
|
933
831
|
}
|
|
934
|
-
__name(ListenerFactory, "ListenerFactory");
|
|
935
832
|
var Listener = Object.assign(ListenerFactory, ListenerAPI);
|
|
936
|
-
var ListenerAPI;
|
|
937
833
|
|
|
938
834
|
// src/listener/ListenerRegistry.ts
|
|
939
835
|
import glob2 from "tiny-glob";
|
|
940
836
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
941
837
|
var ListenerRegistry = class {
|
|
942
|
-
static {
|
|
943
|
-
__name(this, "ListenerRegistry");
|
|
944
|
-
}
|
|
945
838
|
static client;
|
|
946
839
|
static constructors = /* @__PURE__ */ new Set();
|
|
947
840
|
static instances = /* @__PURE__ */ new WeakMap();
|
|
948
841
|
static executors = /* @__PURE__ */ new WeakMap();
|
|
949
842
|
/**
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
843
|
+
* Add and register a listener to the registry.
|
|
844
|
+
* If `options.emitter` is not provided, the registry will use the base `client` by default.
|
|
845
|
+
* @param constructor The listener class you want to add.
|
|
846
|
+
*/
|
|
954
847
|
static add(constructor) {
|
|
955
848
|
const entry = Listener.getEntry(constructor);
|
|
956
849
|
if (!entry) {
|
|
@@ -973,10 +866,10 @@ var ListenerRegistry = class {
|
|
|
973
866
|
});
|
|
974
867
|
}
|
|
975
868
|
/**
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
869
|
+
* Remove and unregister a listener from the registry.
|
|
870
|
+
* @param constructor The listener class you want to remove.
|
|
871
|
+
* @returns `boolean`, returns `true` if the listener is removed successfully.
|
|
872
|
+
*/
|
|
980
873
|
static remove(constructor) {
|
|
981
874
|
const entry = Listener.getEntry(constructor);
|
|
982
875
|
if (!entry) {
|
|
@@ -998,9 +891,9 @@ var ListenerRegistry = class {
|
|
|
998
891
|
return true;
|
|
999
892
|
}
|
|
1000
893
|
/**
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
894
|
+
* Remove and unregister all listeners from the registry.
|
|
895
|
+
* @returns Amount of removed listeners.
|
|
896
|
+
*/
|
|
1004
897
|
static removeAll() {
|
|
1005
898
|
let removedAmount = 0;
|
|
1006
899
|
for (const constructor of this.constructors) {
|
|
@@ -1011,9 +904,9 @@ var ListenerRegistry = class {
|
|
|
1011
904
|
return removedAmount;
|
|
1012
905
|
}
|
|
1013
906
|
/**
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
907
|
+
* Set base client for the registry to fallback as default emitter. This should be used only by BakitClient and stay untouched.
|
|
908
|
+
* @param newClient base client to set for the registry.
|
|
909
|
+
*/
|
|
1017
910
|
static setClient(newClient) {
|
|
1018
911
|
this.client = newClient;
|
|
1019
912
|
}
|
|
@@ -1024,10 +917,10 @@ var ListenerRegistry = class {
|
|
|
1024
917
|
}
|
|
1025
918
|
const { hooks } = entry;
|
|
1026
919
|
return async function(...args) {
|
|
1027
|
-
const mainHook = hooks[
|
|
1028
|
-
const preHook = hooks[
|
|
1029
|
-
const postHook = hooks[
|
|
1030
|
-
const errorHook = hooks[
|
|
920
|
+
const mainHook = hooks["MAIN" /* Main */];
|
|
921
|
+
const preHook = hooks["PRE" /* Pre */];
|
|
922
|
+
const postHook = hooks["POST" /* Post */];
|
|
923
|
+
const errorHook = hooks["ERROR" /* Error */];
|
|
1031
924
|
if (!mainHook) {
|
|
1032
925
|
return;
|
|
1033
926
|
}
|
|
@@ -1041,7 +934,11 @@ var ListenerRegistry = class {
|
|
|
1041
934
|
}
|
|
1042
935
|
} catch (error) {
|
|
1043
936
|
if (errorHook) {
|
|
1044
|
-
await errorHook.method.call(
|
|
937
|
+
await errorHook.method.call(
|
|
938
|
+
instance,
|
|
939
|
+
error,
|
|
940
|
+
...args
|
|
941
|
+
);
|
|
1045
942
|
} else {
|
|
1046
943
|
throw error;
|
|
1047
944
|
}
|
|
@@ -1049,11 +946,11 @@ var ListenerRegistry = class {
|
|
|
1049
946
|
};
|
|
1050
947
|
}
|
|
1051
948
|
/**
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
949
|
+
* Load and add all listeners which matched provided glob pattern to the registry.
|
|
950
|
+
* @param pattern glob pattern to load.
|
|
951
|
+
* @param parallel load all matched results in parallel, enabled by default.
|
|
952
|
+
* @returns All loaded listener constructors.
|
|
953
|
+
*/
|
|
1057
954
|
static async load(pattern, parallel = true) {
|
|
1058
955
|
const files = await glob2(pattern);
|
|
1059
956
|
const loaders = files.map(async (file) => {
|
|
@@ -1075,20 +972,20 @@ var ListenerRegistry = class {
|
|
|
1075
972
|
|
|
1076
973
|
// src/BakitClient.ts
|
|
1077
974
|
var BakitClient = class _BakitClient extends Client {
|
|
1078
|
-
static {
|
|
1079
|
-
__name(this, "BakitClient");
|
|
1080
|
-
}
|
|
1081
975
|
constructor(options) {
|
|
1082
976
|
if (options.getSyntaxErrorMessage === void 0) {
|
|
1083
977
|
options.getSyntaxErrorMessage = _BakitClient.getSyntaxErrorMessage;
|
|
1084
978
|
}
|
|
1085
979
|
super(options);
|
|
1086
980
|
ListenerRegistry["setClient"](this);
|
|
1087
|
-
this.once(
|
|
981
|
+
this.once(
|
|
982
|
+
Events.ClientReady,
|
|
983
|
+
(client) => void this.registerApplicationCommands(client)
|
|
984
|
+
);
|
|
1088
985
|
this.on(Events.InteractionCreate, (interaction) => void this.handleInteraction(interaction));
|
|
1089
986
|
this.on(Events.MessageCreate, (message) => void this.handleMessage(message));
|
|
1090
987
|
}
|
|
1091
|
-
static getSyntaxErrorMessage =
|
|
988
|
+
static getSyntaxErrorMessage = (command, error, context, args, prefix) => {
|
|
1092
989
|
const requiredSyntax = args.map((x) => Arg.format(x)).join(" ");
|
|
1093
990
|
const root = Command.getRoot(command.constructor);
|
|
1094
991
|
if (!root) {
|
|
@@ -1102,7 +999,7 @@ var BakitClient = class _BakitClient extends Client {
|
|
|
1102
999
|
return {
|
|
1103
1000
|
content
|
|
1104
1001
|
};
|
|
1105
|
-
}
|
|
1002
|
+
};
|
|
1106
1003
|
async registerApplicationCommands(client) {
|
|
1107
1004
|
const commands = CommandRegistry.constructors.map((c) => CommandRegistry.buildSlashCommand(c));
|
|
1108
1005
|
await client.application.commands.set(commands);
|
|
@@ -1138,11 +1035,7 @@ var BakitClient = class _BakitClient extends Client {
|
|
|
1138
1035
|
async handleChatInputHooks(context, instance) {
|
|
1139
1036
|
const targetHooks = this.getChatInputTargetHooks(context.source, instance);
|
|
1140
1037
|
let inheritedArgs = [];
|
|
1141
|
-
for (const hooks of [
|
|
1142
|
-
targetHooks.root,
|
|
1143
|
-
targetHooks.group,
|
|
1144
|
-
targetHooks.subcommand
|
|
1145
|
-
]) {
|
|
1038
|
+
for (const hooks of [targetHooks.root, targetHooks.group, targetHooks.subcommand]) {
|
|
1146
1039
|
if (!hooks) {
|
|
1147
1040
|
continue;
|
|
1148
1041
|
}
|
|
@@ -1182,7 +1075,7 @@ var BakitClient = class _BakitClient extends Client {
|
|
|
1182
1075
|
}
|
|
1183
1076
|
}
|
|
1184
1077
|
async runMessageHooks(context, instance, hooks, resolver) {
|
|
1185
|
-
const mainHook = hooks[
|
|
1078
|
+
const mainHook = hooks["MAIN" /* Main */];
|
|
1186
1079
|
if (!mainHook) {
|
|
1187
1080
|
return resolver;
|
|
1188
1081
|
}
|
|
@@ -1191,7 +1084,13 @@ var BakitClient = class _BakitClient extends Client {
|
|
|
1191
1084
|
resolver = await resolver.resolve(args);
|
|
1192
1085
|
} catch (error) {
|
|
1193
1086
|
if (error instanceof CommandSyntaxError) {
|
|
1194
|
-
const errorContent = await this.options.getSyntaxErrorMessage?.(
|
|
1087
|
+
const errorContent = await this.options.getSyntaxErrorMessage?.(
|
|
1088
|
+
instance,
|
|
1089
|
+
error,
|
|
1090
|
+
context,
|
|
1091
|
+
args,
|
|
1092
|
+
resolver.options.prefix
|
|
1093
|
+
);
|
|
1195
1094
|
if (errorContent) {
|
|
1196
1095
|
await context.send(errorContent);
|
|
1197
1096
|
}
|
|
@@ -1203,36 +1102,35 @@ var BakitClient = class _BakitClient extends Client {
|
|
|
1203
1102
|
return resolver;
|
|
1204
1103
|
}
|
|
1205
1104
|
async runChatInputHooks(context, instance, hooks, inheritedArgs) {
|
|
1206
|
-
const mainHook = hooks[
|
|
1105
|
+
const mainHook = hooks["MAIN" /* Main */];
|
|
1207
1106
|
if (!mainHook) {
|
|
1208
1107
|
return;
|
|
1209
1108
|
}
|
|
1210
|
-
const newArgs = Arg.getMethodArguments(mainHook.method).map(
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
];
|
|
1109
|
+
const newArgs = Arg.getMethodArguments(mainHook.method).map(
|
|
1110
|
+
(arg) => ArgumentResolver.resolveChatInput(context.source, arg)
|
|
1111
|
+
);
|
|
1112
|
+
const argValues = [...inheritedArgs, ...newArgs];
|
|
1215
1113
|
await this.runHooks(context, instance, hooks, argValues);
|
|
1216
1114
|
return argValues;
|
|
1217
1115
|
}
|
|
1218
1116
|
async runHooks(context, instance, hooks, args) {
|
|
1219
|
-
const mainHook = hooks[
|
|
1220
|
-
const preHook = hooks[
|
|
1221
|
-
const postHook = hooks[
|
|
1222
|
-
const errorHook = hooks[
|
|
1117
|
+
const mainHook = hooks["MAIN" /* Main */];
|
|
1118
|
+
const preHook = hooks["PRE" /* Pre */];
|
|
1119
|
+
const postHook = hooks["POST" /* Post */];
|
|
1120
|
+
const errorHook = hooks["ERROR" /* Error */];
|
|
1223
1121
|
if (!mainHook) {
|
|
1224
1122
|
return;
|
|
1225
1123
|
}
|
|
1226
|
-
const execute =
|
|
1124
|
+
const execute = async (hook, error) => {
|
|
1227
1125
|
if (!hook) {
|
|
1228
1126
|
return;
|
|
1229
1127
|
}
|
|
1230
|
-
if (hook.state ===
|
|
1128
|
+
if (hook.state === "ERROR" /* Error */) {
|
|
1231
1129
|
await hook.method.call(instance, error, context, ...args);
|
|
1232
1130
|
} else {
|
|
1233
1131
|
await hook.method.call(instance, context, ...args);
|
|
1234
1132
|
}
|
|
1235
|
-
}
|
|
1133
|
+
};
|
|
1236
1134
|
try {
|
|
1237
1135
|
await execute(preHook);
|
|
1238
1136
|
await execute(mainHook);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bakit",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.13",
|
|
4
4
|
"description": "A framework for discord.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"discord.js": "^14.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"reflect-metadata": "^0.2.2",
|
|
42
41
|
"tiny-glob": "^0.2.9",
|
|
43
42
|
"type-fest": "^4.41.0"
|
|
44
43
|
},
|