@pikokr/command.ts 3.2.4-dev.434c22e → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/applicationCommand/AppCommand.d.ts +18 -0
- package/dist/applicationCommand/AppCommand.js +22 -0
- package/dist/applicationCommand/AppCommand.js.map +1 -0
- package/dist/applicationCommand/decorator.d.ts +10 -0
- package/dist/applicationCommand/decorator.js +39 -0
- package/dist/applicationCommand/decorator.js.map +1 -0
- package/dist/applicationCommand/index.d.ts +2 -0
- package/dist/applicationCommand/index.js +15 -0
- package/dist/applicationCommand/index.js.map +1 -0
- package/dist/builtinModules/BuiltinApplicationCommandConverters.d.ts +8 -0
- package/dist/builtinModules/BuiltinApplicationCommandConverters.js +13 -0
- package/dist/builtinModules/BuiltinApplicationCommandConverters.js.map +1 -0
- package/dist/builtinModules/CommandHandler.d.ts +4 -1
- package/dist/builtinModules/CommandHandler.js +141 -17
- package/dist/builtinModules/CommandHandler.js.map +1 -1
- package/dist/builtinModules/index.d.ts +1 -1
- package/dist/builtinModules/index.js +1 -1
- package/dist/builtinModules/index.js.map +1 -1
- package/dist/command/ArgumentConverter.d.ts +3 -3
- package/dist/command/ArgumentConverter.js +3 -3
- package/dist/command/ArgumentConverter.js.map +1 -1
- package/dist/command/Command.d.ts +2 -2
- package/dist/command/decorator.d.ts +2 -1
- package/dist/command/decorator.js +6 -5
- package/dist/command/decorator.js.map +1 -1
- package/dist/command/utils.d.ts +2 -2
- package/dist/command/utils.js +6 -6
- package/dist/command/utils.js.map +1 -1
- package/dist/constants.d.ts +3 -2
- package/dist/constants.js +4 -3
- package/dist/constants.js.map +1 -1
- package/dist/error/ArgumentConverterNotFound.d.ts +6 -6
- package/dist/error/ArgumentConverterNotFound.js +3 -3
- package/dist/error/ArgumentConverterNotFound.js.map +1 -1
- package/dist/error/CommandCheckFailed.d.ts +6 -6
- package/dist/error/CommandCheckFailed.js +3 -3
- package/dist/error/CommandCheckFailed.js.map +1 -1
- package/dist/error/checks/SlashCommandGlobalCheckError.d.ts +5 -0
- package/dist/error/checks/SlashCommandGlobalCheckError.js +11 -0
- package/dist/error/checks/SlashCommandGlobalCheckError.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/messageComponents/base.d.ts +10 -0
- package/dist/messageComponents/base.js +15 -0
- package/dist/messageComponents/base.js.map +1 -0
- package/dist/messageComponents/button.d.ts +5 -0
- package/dist/messageComponents/button.js +28 -0
- package/dist/messageComponents/button.js.map +1 -0
- package/dist/messageComponents/index.d.ts +2 -0
- package/dist/messageComponents/index.js +15 -0
- package/dist/messageComponents/index.js.map +1 -0
- package/dist/messageComponents/selectMenu.d.ts +5 -0
- package/dist/messageComponents/selectMenu.js +28 -0
- package/dist/messageComponents/selectMenu.js.map +1 -0
- package/dist/slashCommand/decorator.d.ts +1 -0
- package/dist/slashCommand/decorator.js +2 -1
- package/dist/slashCommand/decorator.js.map +1 -1
- package/dist/structures/CommandClient.d.ts +7 -3
- package/dist/structures/CommandClient.js +7 -8
- package/dist/structures/CommandClient.js.map +1 -1
- package/dist/structures/Module.d.ts +6 -4
- package/dist/structures/Module.js +6 -3
- package/dist/structures/Module.js.map +1 -1
- package/dist/structures/Registry.d.ts +6 -4
- package/dist/structures/Registry.js +18 -15
- package/dist/structures/Registry.js.map +1 -1
- package/dist/typings.d.ts +14 -2
- package/package.json +2 -4
- package/src/applicationCommand/AppCommand.ts +28 -0
- package/src/{slashCommand → applicationCommand}/decorator.ts +10 -10
- package/src/applicationCommand/index.ts +2 -0
- package/src/builtinModules/BuiltinApplicationCommandConverters.ts +12 -0
- package/src/builtinModules/CommandHandler.ts +168 -20
- package/src/builtinModules/index.ts +1 -1
- package/src/command/ArgumentConverter.ts +3 -3
- package/src/command/Command.ts +2 -2
- package/src/command/decorator.ts +6 -5
- package/src/command/utils.ts +9 -9
- package/src/constants.ts +4 -2
- package/src/error/ArgumentConverterNotFound.ts +4 -4
- package/src/error/CommandCheckFailed.ts +4 -4
- package/src/error/checks/SlashCommandGlobalCheckError.ts +7 -0
- package/src/index.ts +2 -1
- package/src/messageComponents/base.ts +12 -0
- package/src/messageComponents/button.ts +26 -0
- package/src/messageComponents/index.ts +2 -0
- package/src/messageComponents/selectMenu.ts +26 -0
- package/src/structures/CommandClient.ts +16 -10
- package/src/structures/Module.ts +11 -6
- package/src/structures/Registry.ts +25 -19
- package/src/typings.ts +14 -2
- package/test/index.ts +2 -2
- package/test/modules/dev.ts +9 -5
- package/test/modules/test.ts +88 -15
- package/src/builtinModules/BuiltinSlashCommandConverters.ts +0 -23
- package/src/slashCommand/SlashCommand.ts +0 -29
- package/src/slashCommand/index.ts +0 -2
package/dist/command/utils.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createCheckDecorator = void 0;
|
|
4
4
|
const constants_1 = require("../constants");
|
|
5
|
-
const createCheckDecorator = (execute,
|
|
5
|
+
const createCheckDecorator = (execute, executeApplicationCommand) => {
|
|
6
6
|
return (target, propertyKey) => {
|
|
7
7
|
if (execute) {
|
|
8
8
|
let properties = Reflect.getMetadata(constants_1.KCommandChecks, target, propertyKey);
|
|
@@ -14,14 +14,14 @@ const createCheckDecorator = (execute, slashExecute) => {
|
|
|
14
14
|
Reflect.defineMetadata(constants_1.KCommandChecks, properties, target, propertyKey);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
if (
|
|
18
|
-
let properties = Reflect.getMetadata(constants_1.
|
|
17
|
+
if (executeApplicationCommand) {
|
|
18
|
+
let properties = Reflect.getMetadata(constants_1.KApplicationCommandChecks, target, propertyKey);
|
|
19
19
|
if (properties) {
|
|
20
|
-
properties.push(
|
|
20
|
+
properties.push(executeApplicationCommand);
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
23
|
-
properties = [
|
|
24
|
-
Reflect.defineMetadata(constants_1.
|
|
23
|
+
properties = [executeApplicationCommand];
|
|
24
|
+
Reflect.defineMetadata(constants_1.KApplicationCommandChecks, properties, target, propertyKey);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/command/utils.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/command/utils.ts"],"names":[],"mappings":";;;AAEA,4CAAwE;AAEjE,MAAM,oBAAoB,GAAG,CAClC,OAA8D,EAC9D,yBAAwI,EACvH,EAAE;IACnB,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;QAC7B,IAAI,OAAO,EAAE;YACX,IAAI,UAAU,GAAoB,OAAO,CAAC,WAAW,CAAC,0BAAc,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;YAC1F,IAAI,UAAU,EAAE;gBACd,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;aACzB;iBAAM;gBACL,UAAU,GAAG,CAAC,OAAO,CAAC,CAAA;gBACtB,OAAO,CAAC,cAAc,CAAC,0BAAc,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;aACxE;SACF;QACD,IAAI,yBAAyB,EAAE;YAC7B,IAAI,UAAU,GAAsC,OAAO,CAAC,WAAW,CAAC,qCAAyB,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;YACvH,IAAI,UAAU,EAAE;gBACd,UAAU,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAA;aAC3C;iBAAM;gBACL,UAAU,GAAG,CAAC,yBAAyB,CAAC,CAAA;gBACxC,OAAO,CAAC,cAAc,CAAC,qCAAyB,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;aACnF;SACF;IACH,CAAC,CAAA;AACH,CAAC,CAAA;AAxBY,QAAA,oBAAoB,wBAwBhC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const KCommands: unique symbol;
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const KApplicationCommands: unique symbol;
|
|
3
3
|
export declare const KSlashCommandOptions: unique symbol;
|
|
4
4
|
export declare const KListeners: unique symbol;
|
|
5
5
|
export declare const KModulePath: unique symbol;
|
|
@@ -10,4 +10,5 @@ export declare const KRest: unique symbol;
|
|
|
10
10
|
export declare const KArgumentConverters: unique symbol;
|
|
11
11
|
export declare const KSlashArgumentConverters: unique symbol;
|
|
12
12
|
export declare const KCommandChecks: unique symbol;
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const KApplicationCommandChecks: unique symbol;
|
|
14
|
+
export declare const KMessageComponentHandlers: unique symbol;
|
package/dist/constants.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.KMessageComponentHandlers = exports.KApplicationCommandChecks = exports.KCommandChecks = exports.KSlashArgumentConverters = exports.KArgumentConverters = exports.KRest = exports.KOptionals = exports.KBuiltInModule = exports.KListenerExecuteCache = exports.KModulePath = exports.KListeners = exports.KSlashCommandOptions = exports.KApplicationCommands = exports.KCommands = void 0;
|
|
4
4
|
exports.KCommands = Symbol('Command.TS Commands');
|
|
5
|
-
exports.
|
|
5
|
+
exports.KApplicationCommands = Symbol('Command.TS Slash Commands');
|
|
6
6
|
exports.KSlashCommandOptions = Symbol('Command.TS Slash Command Options');
|
|
7
7
|
exports.KListeners = Symbol('Command.TS Listeners');
|
|
8
8
|
exports.KModulePath = Symbol('Command.TS Module Path');
|
|
@@ -13,5 +13,6 @@ exports.KRest = Symbol('Command.TS Rest Parameter');
|
|
|
13
13
|
exports.KArgumentConverters = Symbol('Command.TS Argument Converter');
|
|
14
14
|
exports.KSlashArgumentConverters = Symbol('Command.TS Slash Argument Converter');
|
|
15
15
|
exports.KCommandChecks = Symbol('Command.TS Command Checks');
|
|
16
|
-
exports.
|
|
16
|
+
exports.KApplicationCommandChecks = Symbol('Command.TS Slash Command Checks');
|
|
17
|
+
exports.KMessageComponentHandlers = Symbol('Command.TS Message Component Handlers');
|
|
17
18
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAA;AAEzC,QAAA,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAA;AAEzC,QAAA,oBAAoB,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAA;AAE1D,QAAA,oBAAoB,GAAG,MAAM,CAAC,kCAAkC,CAAC,CAAA;AAEjE,QAAA,UAAU,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAA;AAE3C,QAAA,WAAW,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAA;AAE9C,QAAA,qBAAqB,GAAG,MAAM,CAAC,8BAA8B,CAAC,CAAA;AAE9D,QAAA,cAAc,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAA;AAErD,QAAA,UAAU,GAAG,MAAM,CAAC,gCAAgC,CAAC,CAAA;AAErD,QAAA,KAAK,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAA;AAE3C,QAAA,mBAAmB,GAAG,MAAM,CAAC,+BAA+B,CAAC,CAAA;AAE7D,QAAA,wBAAwB,GAAG,MAAM,CAAC,qCAAqC,CAAC,CAAA;AAExE,QAAA,cAAc,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAA;AAEpD,QAAA,yBAAyB,GAAG,MAAM,CAAC,iCAAiC,CAAC,CAAA;AAErE,QAAA,yBAAyB,GAAG,MAAM,CAAC,uCAAuC,CAAC,CAAA"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { CommandInteraction, Message } from 'discord.js';
|
|
1
|
+
import { CommandInteraction, ContextMenuInteraction, Message } from 'discord.js';
|
|
2
2
|
import type { Argument } from '../command';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AppCommandArgument } from '../applicationCommand';
|
|
4
4
|
export declare class ArgumentConverterNotFound extends Error {
|
|
5
5
|
type: Argument;
|
|
6
6
|
msg: Message;
|
|
7
7
|
constructor(type: Argument, msg: Message);
|
|
8
8
|
}
|
|
9
|
-
export declare class
|
|
10
|
-
type:
|
|
11
|
-
interaction: CommandInteraction;
|
|
12
|
-
constructor(type:
|
|
9
|
+
export declare class ApplicationCommandArgumentConverterNotFound extends Error {
|
|
10
|
+
type: AppCommandArgument;
|
|
11
|
+
interaction: CommandInteraction | ContextMenuInteraction;
|
|
12
|
+
constructor(type: AppCommandArgument, interaction: CommandInteraction | ContextMenuInteraction);
|
|
13
13
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ApplicationCommandArgumentConverterNotFound = exports.ArgumentConverterNotFound = void 0;
|
|
4
4
|
class ArgumentConverterNotFound extends Error {
|
|
5
5
|
constructor(type, msg) {
|
|
6
6
|
super(`Argument converter ${type.type.name} not found.`);
|
|
@@ -9,12 +9,12 @@ class ArgumentConverterNotFound extends Error {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.ArgumentConverterNotFound = ArgumentConverterNotFound;
|
|
12
|
-
class
|
|
12
|
+
class ApplicationCommandArgumentConverterNotFound extends Error {
|
|
13
13
|
constructor(type, interaction) {
|
|
14
14
|
super(`Argument converter ${type.type.name} not found.`);
|
|
15
15
|
this.type = type;
|
|
16
16
|
this.interaction = interaction;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
exports.
|
|
19
|
+
exports.ApplicationCommandArgumentConverterNotFound = ApplicationCommandArgumentConverterNotFound;
|
|
20
20
|
//# sourceMappingURL=ArgumentConverterNotFound.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArgumentConverterNotFound.js","sourceRoot":"","sources":["../../src/error/ArgumentConverterNotFound.ts"],"names":[],"mappings":";;;AAIA,MAAa,yBAA0B,SAAQ,KAAK;IAClD,YAAmB,IAAc,EAAS,GAAY;QACpD,KAAK,CAAC,sBAAsB,IAAI,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,CAAA;QADvC,SAAI,GAAJ,IAAI,CAAU;QAAS,QAAG,GAAH,GAAG,CAAS;IAEtD,CAAC;CACF;AAJD,8DAIC;AACD,MAAa,
|
|
1
|
+
{"version":3,"file":"ArgumentConverterNotFound.js","sourceRoot":"","sources":["../../src/error/ArgumentConverterNotFound.ts"],"names":[],"mappings":";;;AAIA,MAAa,yBAA0B,SAAQ,KAAK;IAClD,YAAmB,IAAc,EAAS,GAAY;QACpD,KAAK,CAAC,sBAAsB,IAAI,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,CAAA;QADvC,SAAI,GAAJ,IAAI,CAAU;QAAS,QAAG,GAAH,GAAG,CAAS;IAEtD,CAAC;CACF;AAJD,8DAIC;AACD,MAAa,2CAA4C,SAAQ,KAAK;IACpE,YAAmB,IAAwB,EAAS,WAAwD;QAC1G,KAAK,CAAC,sBAAsB,IAAI,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,CAAA;QADvC,SAAI,GAAJ,IAAI,CAAoB;QAAS,gBAAW,GAAX,WAAW,CAA6C;IAE5G,CAAC;CACF;AAJD,kGAIC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { CommandInteraction, Message } from 'discord.js';
|
|
1
|
+
import { CommandInteraction, ContextMenuInteraction, Message, MessageComponentInteraction } from 'discord.js';
|
|
2
2
|
import { Command } from '../command';
|
|
3
|
-
import {
|
|
3
|
+
import { AppCommand } from '../applicationCommand';
|
|
4
4
|
export declare class CommandCheckFailed extends Error {
|
|
5
5
|
msg: Message;
|
|
6
6
|
command: Command;
|
|
7
7
|
constructor(msg: Message, command: Command);
|
|
8
8
|
}
|
|
9
|
-
export declare class
|
|
10
|
-
interaction: CommandInteraction;
|
|
11
|
-
command:
|
|
12
|
-
constructor(interaction: CommandInteraction, command:
|
|
9
|
+
export declare class ApplicationCommandCheckFailed extends Error {
|
|
10
|
+
interaction: CommandInteraction | MessageComponentInteraction | ContextMenuInteraction;
|
|
11
|
+
command: AppCommand;
|
|
12
|
+
constructor(interaction: CommandInteraction | MessageComponentInteraction | ContextMenuInteraction, command: AppCommand);
|
|
13
13
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ApplicationCommandCheckFailed = exports.CommandCheckFailed = void 0;
|
|
4
4
|
class CommandCheckFailed extends Error {
|
|
5
5
|
constructor(msg, command) {
|
|
6
6
|
super();
|
|
@@ -9,12 +9,12 @@ class CommandCheckFailed extends Error {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.CommandCheckFailed = CommandCheckFailed;
|
|
12
|
-
class
|
|
12
|
+
class ApplicationCommandCheckFailed extends Error {
|
|
13
13
|
constructor(interaction, command) {
|
|
14
14
|
super();
|
|
15
15
|
this.interaction = interaction;
|
|
16
16
|
this.command = command;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
exports.
|
|
19
|
+
exports.ApplicationCommandCheckFailed = ApplicationCommandCheckFailed;
|
|
20
20
|
//# sourceMappingURL=CommandCheckFailed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandCheckFailed.js","sourceRoot":"","sources":["../../src/error/CommandCheckFailed.ts"],"names":[],"mappings":";;;AAIA,MAAa,kBAAmB,SAAQ,KAAK;IAC3C,YAAmB,GAAY,EAAS,OAAgB;QACtD,KAAK,EAAE,CAAA;QADU,QAAG,GAAH,GAAG,CAAS;QAAS,YAAO,GAAP,OAAO,CAAS;IAExD,CAAC;CACF;AAJD,gDAIC;AAED,MAAa,
|
|
1
|
+
{"version":3,"file":"CommandCheckFailed.js","sourceRoot":"","sources":["../../src/error/CommandCheckFailed.ts"],"names":[],"mappings":";;;AAIA,MAAa,kBAAmB,SAAQ,KAAK;IAC3C,YAAmB,GAAY,EAAS,OAAgB;QACtD,KAAK,EAAE,CAAA;QADU,QAAG,GAAH,GAAG,CAAS;QAAS,YAAO,GAAP,OAAO,CAAS;IAExD,CAAC;CACF;AAJD,gDAIC;AAED,MAAa,6BAA8B,SAAQ,KAAK;IACtD,YAAmB,WAAsF,EAAS,OAAmB;QACnI,KAAK,EAAE,CAAA;QADU,gBAAW,GAAX,WAAW,CAA2E;QAAS,YAAO,GAAP,OAAO,CAAY;IAErI,CAAC;CACF;AAJD,sEAIC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SlashCommandGlobalCheckError = void 0;
|
|
4
|
+
class SlashCommandGlobalCheckError extends Error {
|
|
5
|
+
constructor(i) {
|
|
6
|
+
super('Slash command before-run check failed.');
|
|
7
|
+
this.i = i;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.SlashCommandGlobalCheckError = SlashCommandGlobalCheckError;
|
|
11
|
+
//# sourceMappingURL=SlashCommandGlobalCheckError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlashCommandGlobalCheckError.js","sourceRoot":"","sources":["../../../src/error/checks/SlashCommandGlobalCheckError.ts"],"names":[],"mappings":";;;AAEA,MAAa,4BAA6B,SAAQ,KAAK;IACrD,YAAmB,CAAqB;QACtC,KAAK,CAAC,wCAAwC,CAAC,CAAA;QAD9B,MAAC,GAAD,CAAC,CAAoB;IAExC,CAAC;CACF;AAJD,oEAIC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -18,5 +18,6 @@ __exportStar(require("./error"), exports);
|
|
|
18
18
|
__exportStar(require("./command"), exports);
|
|
19
19
|
__exportStar(require("./listener"), exports);
|
|
20
20
|
__exportStar(require("./builtinModules/BuiltInModule"), exports);
|
|
21
|
-
__exportStar(require("./
|
|
21
|
+
__exportStar(require("./applicationCommand"), exports);
|
|
22
|
+
__exportStar(require("./messageComponents"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4BAAyB;AACzB,qBAAkB;AAElB,8CAA2B;AAC3B,+CAA4B;AAC5B,0CAAuB;AACvB,4CAAyB;AACzB,6CAA0B;AAC1B,iEAA8C;AAC9C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4BAAyB;AACzB,qBAAkB;AAElB,8CAA2B;AAC3B,+CAA4B;AAC5B,0CAAuB;AACvB,4CAAyB;AACzB,6CAA0B;AAC1B,iEAA8C;AAC9C,uDAAoC;AACpC,sDAAmC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MessageComponentInteraction, MessageComponentType } from 'discord.js';
|
|
2
|
+
import { Module } from '../structures';
|
|
3
|
+
export declare type MessageComponentExecutor = (i: MessageComponentInteraction) => void | Promise<void>;
|
|
4
|
+
export declare class MessageComponentHandler {
|
|
5
|
+
componentId: string;
|
|
6
|
+
componentType: Exclude<MessageComponentType, 'ACTION_ROW'>;
|
|
7
|
+
execute: MessageComponentExecutor;
|
|
8
|
+
constructor(componentId: string, componentType: Exclude<MessageComponentType, 'ACTION_ROW'>, execute: MessageComponentExecutor);
|
|
9
|
+
run(module: Module, i: MessageComponentInteraction): void | Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageComponentHandler = void 0;
|
|
4
|
+
class MessageComponentHandler {
|
|
5
|
+
constructor(componentId, componentType, execute) {
|
|
6
|
+
this.componentId = componentId;
|
|
7
|
+
this.componentType = componentType;
|
|
8
|
+
this.execute = execute;
|
|
9
|
+
}
|
|
10
|
+
run(module, i) {
|
|
11
|
+
return this.execute.apply(module, [i]);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.MessageComponentHandler = MessageComponentHandler;
|
|
15
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/messageComponents/base.ts"],"names":[],"mappings":";;;AAKA,MAAa,uBAAuB;IAClC,YAAmB,WAAmB,EAAS,aAA0D,EAAS,OAAiC;QAAhI,gBAAW,GAAX,WAAW,CAAQ;QAAS,kBAAa,GAAb,aAAa,CAA6C;QAAS,YAAO,GAAP,OAAO,CAA0B;IAAG,CAAC;IAEvJ,GAAG,CAAC,MAAc,EAAE,CAA8B;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IACxC,CAAC;CACF;AAND,0DAMC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MessageComponentExecutor, MessageComponentHandler } from './base';
|
|
2
|
+
export declare class ButtonInteractionHandler extends MessageComponentHandler {
|
|
3
|
+
constructor(id: string, execute: MessageComponentExecutor);
|
|
4
|
+
}
|
|
5
|
+
export declare const messageButton: (id: string) => MethodDecorator;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.messageButton = exports.ButtonInteractionHandler = void 0;
|
|
4
|
+
const base_1 = require("./base");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const constants_1 = require("../constants");
|
|
7
|
+
class ButtonInteractionHandler extends base_1.MessageComponentHandler {
|
|
8
|
+
constructor(id, execute) {
|
|
9
|
+
super(id, 'BUTTON', execute);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.ButtonInteractionHandler = ButtonInteractionHandler;
|
|
13
|
+
const messageButton = (id) => {
|
|
14
|
+
return (target, propertyKey) => {
|
|
15
|
+
utils_1.checkTarget(target);
|
|
16
|
+
const handler = new ButtonInteractionHandler(id, Reflect.get(target, propertyKey));
|
|
17
|
+
let properties = Reflect.getMetadata(constants_1.KMessageComponentHandlers, target);
|
|
18
|
+
if (properties) {
|
|
19
|
+
properties.push(handler);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
properties = [handler];
|
|
23
|
+
Reflect.defineMetadata(constants_1.KMessageComponentHandlers, properties, target);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
exports.messageButton = messageButton;
|
|
28
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/messageComponents/button.ts"],"names":[],"mappings":";;;AAAA,iCAA0E;AAC1E,oCAAsC;AACtC,4CAAwD;AAExD,MAAa,wBAAyB,SAAQ,8BAAuB;IACnE,YAAY,EAAU,EAAE,OAAiC;QACvD,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC9B,CAAC;CACF;AAJD,4DAIC;AAEM,MAAM,aAAa,GAAG,CAAC,EAAU,EAAmB,EAAE;IAC3D,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;QAC7B,mBAAW,CAAC,MAAM,CAAC,CAAA;QAEnB,MAAM,OAAO,GAAG,IAAI,wBAAwB,CAAC,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAA;QAElF,IAAI,UAAU,GAA8B,OAAO,CAAC,WAAW,CAAC,qCAAyB,EAAE,MAAM,CAAC,CAAA;QAElG,IAAI,UAAU,EAAE;YACd,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;SACzB;aAAM;YACL,UAAU,GAAG,CAAC,OAAO,CAAC,CAAA;YACtB,OAAO,CAAC,cAAc,CAAC,qCAAyB,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;SACtE;IACH,CAAC,CAAA;AACH,CAAC,CAAA;AAfY,QAAA,aAAa,iBAezB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./button"), exports);
|
|
14
|
+
__exportStar(require("./selectMenu"), exports);
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messageComponents/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwB;AACxB,+CAA4B"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MessageComponentExecutor, MessageComponentHandler } from './base';
|
|
2
|
+
export declare class SelectMenuInteractionHandler extends MessageComponentHandler {
|
|
3
|
+
constructor(id: string, execute: MessageComponentExecutor);
|
|
4
|
+
}
|
|
5
|
+
export declare const messageSelectMenu: (id: string) => MethodDecorator;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.messageSelectMenu = exports.SelectMenuInteractionHandler = void 0;
|
|
4
|
+
const base_1 = require("./base");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const constants_1 = require("../constants");
|
|
7
|
+
class SelectMenuInteractionHandler extends base_1.MessageComponentHandler {
|
|
8
|
+
constructor(id, execute) {
|
|
9
|
+
super(id, 'SELECT_MENU', execute);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.SelectMenuInteractionHandler = SelectMenuInteractionHandler;
|
|
13
|
+
const messageSelectMenu = (id) => {
|
|
14
|
+
return (target, propertyKey) => {
|
|
15
|
+
utils_1.checkTarget(target);
|
|
16
|
+
const handler = new SelectMenuInteractionHandler(id, Reflect.get(target, propertyKey));
|
|
17
|
+
let properties = Reflect.getMetadata(constants_1.KMessageComponentHandlers, target);
|
|
18
|
+
if (properties) {
|
|
19
|
+
properties.push(handler);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
properties = [handler];
|
|
23
|
+
Reflect.defineMetadata(constants_1.KMessageComponentHandlers, properties, target);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
exports.messageSelectMenu = messageSelectMenu;
|
|
28
|
+
//# sourceMappingURL=selectMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectMenu.js","sourceRoot":"","sources":["../../src/messageComponents/selectMenu.ts"],"names":[],"mappings":";;;AAAA,iCAA0E;AAC1E,oCAAsC;AACtC,4CAAwD;AAExD,MAAa,4BAA6B,SAAQ,8BAAuB;IACvE,YAAY,EAAU,EAAE,OAAiC;QACvD,KAAK,CAAC,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,CAAA;IACnC,CAAC;CACF;AAJD,oEAIC;AAEM,MAAM,iBAAiB,GAAG,CAAC,EAAU,EAAmB,EAAE;IAC/D,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;QAC7B,mBAAW,CAAC,MAAM,CAAC,CAAA;QAEnB,MAAM,OAAO,GAAG,IAAI,4BAA4B,CAAC,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAA;QAEtF,IAAI,UAAU,GAA8B,OAAO,CAAC,WAAW,CAAC,qCAAyB,EAAE,MAAM,CAAC,CAAA;QAElG,IAAI,UAAU,EAAE;YACd,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;SACzB;aAAM;YACL,UAAU,GAAG,CAAC,OAAO,CAAC,CAAA;YACtB,OAAO,CAAC,cAAc,CAAC,qCAAyB,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;SACtE;IACH,CAAC,CAAA;AACH,CAAC,CAAA;AAfY,QAAA,iBAAiB,qBAe7B"}
|
|
@@ -2,6 +2,7 @@ import { Snowflake } from 'discord.js';
|
|
|
2
2
|
import { SlashCommandBuilder } from '@discordjs/builders';
|
|
3
3
|
declare type SlashOptions = {
|
|
4
4
|
guild: Snowflake | Snowflake[];
|
|
5
|
+
optionTypes?: any[];
|
|
5
6
|
};
|
|
6
7
|
export declare const slashCommand: (opt: Partial<SlashOptions> & {
|
|
7
8
|
command: SlashCommandBuilder | Omit<SlashCommandBuilder, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
@@ -7,9 +7,10 @@ const constants_1 = require("../constants");
|
|
|
7
7
|
const SlashCommand_1 = require("./SlashCommand");
|
|
8
8
|
const slashCommand = (opt) => {
|
|
9
9
|
return (target, propertyKey) => {
|
|
10
|
+
var _a;
|
|
10
11
|
utils_1.checkTarget(target);
|
|
11
12
|
let properties = Reflect.getMetadata(constants_1.KSlashCommands, target);
|
|
12
|
-
const params = Reflect.getMetadata('design:paramtypes', target, propertyKey);
|
|
13
|
+
const params = (_a = opt.optionTypes) !== null && _a !== void 0 ? _a : Reflect.getMetadata('design:paramtypes', target, propertyKey);
|
|
13
14
|
const options = Reflect.getMetadata(constants_1.KSlashCommandOptions, target, propertyKey) || new discord_js_1.Collection();
|
|
14
15
|
const command = new SlashCommand_1.SlashCommand(opt.command, Reflect.get(target, propertyKey), target, params.map((x, i) => ({
|
|
15
16
|
type: x,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../src/slashCommand/decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAkD;AAClD,oCAAsC;AACtC,4CAAmE;AAEnE,iDAA6C;
|
|
1
|
+
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../src/slashCommand/decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAkD;AAClD,oCAAsC;AACtC,4CAAmE;AAEnE,iDAA6C;AAQtC,MAAM,YAAY,GAAG,CAAC,GAAiI,EAAE,EAAE;IAChK,OAAO,CACL,MAAc,EACd,WAAmB,EAEnB,EAAE;;QACF,mBAAW,CAAC,MAAM,CAAC,CAAA;QAEnB,IAAI,UAAU,GAAmB,OAAO,CAAC,WAAW,CAAC,0BAAc,EAAE,MAAM,CAAC,CAAA;QAE5E,MAAM,MAAM,GAAU,MAAA,GAAG,CAAC,WAAW,mCAAI,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;QAEtG,MAAM,OAAO,GAA+B,OAAO,CAAC,WAAW,CAAC,gCAAoB,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,IAAI,uBAAU,EAAkB,CAAA;QAE9I,MAAM,OAAO,GAAG,IAAI,2BAAY,CAC9B,GAAG,CAAC,OAAO,EACX,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EAChC,MAAgB,EAChB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACpB,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;SACrB,CAAC,CAAC,EACH,GAAG,CAAC,KAAK,EACT,WAAW,CACZ,CAAA;QAED,IAAI,UAAU,EAAE;YACd,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;SACzB;aAAM;YACL,UAAU,GAAG,CAAC,OAAO,CAAC,CAAA;YACtB,OAAO,CAAC,cAAc,CAAC,0BAAc,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;SAC3D;IACH,CAAC,CAAA;AACH,CAAC,CAAA;AAjCY,QAAA,YAAY,gBAiCxB;AAEM,MAAM,MAAM,GAAG,CAAC,GAAW,EAAsB,EAAE,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,EAAE;IACjG,mBAAW,CAAC,MAAM,CAAC,CAAA;IAEnB,IAAI,UAAU,GAA+B,OAAO,CAAC,WAAW,CAAC,gCAAoB,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;IAE3G,IAAI,CAAC,UAAU,EAAE;QACf,UAAU,GAAG,IAAI,uBAAU,EAAkB,CAAA;QAC7C,OAAO,CAAC,cAAc,CAAC,gCAAoB,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;KAC9E;IAED,UAAU,CAAC,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,CAAA;AACrC,CAAC,CAAA;AAXY,QAAA,MAAM,UAWlB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Registry } from './Registry';
|
|
2
|
-
import { Client, Message, Snowflake } from 'discord.js';
|
|
2
|
+
import { Client, CommandInteraction, Interaction, Message, Snowflake } from 'discord.js';
|
|
3
3
|
import { CoolDownAdapter } from '../command';
|
|
4
|
-
import { REST } from '@discordjs/rest';
|
|
5
4
|
import { Logger } from 'tslog';
|
|
6
5
|
export interface CommandOptions {
|
|
7
6
|
prefix: string | ((msg: any) => string | Promise<string | string[]> | string[]) | string[];
|
|
@@ -9,18 +8,24 @@ export interface CommandOptions {
|
|
|
9
8
|
globalAliases: (cmd: string, msg: Message) => string[] | Promise<string[]>;
|
|
10
9
|
}
|
|
11
10
|
export interface SlashCommandOptions {
|
|
11
|
+
check: (i: CommandInteraction) => boolean | Promise<boolean>;
|
|
12
|
+
}
|
|
13
|
+
export interface ApplicationCommandOptions {
|
|
12
14
|
guild?: Snowflake | Snowflake[];
|
|
13
15
|
autoSync: boolean;
|
|
16
|
+
beforeRunCheck: (i: Interaction) => void | Promise<void>;
|
|
14
17
|
}
|
|
15
18
|
export interface CommandClientOptions {
|
|
16
19
|
command: CommandOptions;
|
|
17
20
|
owners: 'auto' | Snowflake[];
|
|
18
21
|
slashCommands: SlashCommandOptions;
|
|
22
|
+
applicationCommands: ApplicationCommandOptions;
|
|
19
23
|
}
|
|
20
24
|
export interface CommandClientOptionsParam {
|
|
21
25
|
command: Partial<CommandOptions>;
|
|
22
26
|
owners: 'auto' | string[];
|
|
23
27
|
slashCommands: Partial<SlashCommandOptions>;
|
|
28
|
+
applicationCommands: Partial<ApplicationCommandOptions>;
|
|
24
29
|
}
|
|
25
30
|
export declare class CommandClient {
|
|
26
31
|
options: CommandClientOptions;
|
|
@@ -28,7 +33,6 @@ export declare class CommandClient {
|
|
|
28
33
|
registry: Registry;
|
|
29
34
|
client: Client;
|
|
30
35
|
coolDownAdapter: CoolDownAdapter;
|
|
31
|
-
rest: REST;
|
|
32
36
|
logger: Logger;
|
|
33
37
|
private _isReady;
|
|
34
38
|
private fetchOwners;
|
|
@@ -29,16 +29,12 @@ const Registry_1 = require("./Registry");
|
|
|
29
29
|
const discord_js_1 = require("discord.js");
|
|
30
30
|
const builtinModules_1 = require("../builtinModules");
|
|
31
31
|
const command_1 = require("../command");
|
|
32
|
-
const rest_1 = require("@discordjs/rest");
|
|
33
32
|
const tslog_1 = require("tslog");
|
|
34
33
|
class CommandClient {
|
|
35
34
|
constructor(_a) {
|
|
36
35
|
var { client, coolDownAdapter, logger } = _a, options = __rest(_a, ["client", "coolDownAdapter", "logger"]);
|
|
37
36
|
this.owners = [];
|
|
38
37
|
this.registry = new Registry_1.Registry(this);
|
|
39
|
-
this.rest = new rest_1.REST({
|
|
40
|
-
version: '9',
|
|
41
|
-
});
|
|
42
38
|
this._isReady = false;
|
|
43
39
|
this.client = client;
|
|
44
40
|
this.coolDownAdapter = coolDownAdapter || new command_1.DefaultCoolDownAdapter();
|
|
@@ -50,7 +46,11 @@ class CommandClient {
|
|
|
50
46
|
},
|
|
51
47
|
owners: 'auto',
|
|
52
48
|
slashCommands: {
|
|
53
|
-
|
|
49
|
+
check: () => true,
|
|
50
|
+
},
|
|
51
|
+
applicationCommands: {
|
|
52
|
+
autoSync: false,
|
|
53
|
+
beforeRunCheck: () => { },
|
|
54
54
|
},
|
|
55
55
|
}, options);
|
|
56
56
|
this.logger = logger !== null && logger !== void 0 ? logger : new tslog_1.Logger({ name: 'Command.TS' });
|
|
@@ -60,7 +60,7 @@ class CommandClient {
|
|
|
60
60
|
this.client.once('ready', () => this.ready());
|
|
61
61
|
this.registry.registerModule(new builtinModules_1.CommandHandler(this.registry));
|
|
62
62
|
this.registry.registerModule(new builtinModules_1.BuiltinCommandConverters(this));
|
|
63
|
-
this.registry.registerModule(new builtinModules_1.
|
|
63
|
+
this.registry.registerModule(new builtinModules_1.BuiltinApplicationCommandConverters(this));
|
|
64
64
|
}
|
|
65
65
|
fetchOwners() {
|
|
66
66
|
var _a, _b;
|
|
@@ -79,13 +79,12 @@ class CommandClient {
|
|
|
79
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
80
|
if (this._isReady)
|
|
81
81
|
return;
|
|
82
|
-
this.rest.setToken(this.client.token);
|
|
83
82
|
this._isReady = true;
|
|
84
83
|
if (this.options.owners === 'auto') {
|
|
85
84
|
const owners = yield this.fetchOwners();
|
|
86
85
|
this.owners.push(...owners);
|
|
87
86
|
}
|
|
88
|
-
if (this.options.
|
|
87
|
+
if (this.options.applicationCommands.autoSync) {
|
|
89
88
|
yield this.registry.syncCommands();
|
|
90
89
|
}
|
|
91
90
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandClient.js","sourceRoot":"","sources":["../../src/structures/CommandClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsB;AACtB,yCAAqC;AACrC,
|
|
1
|
+
{"version":3,"file":"CommandClient.js","sourceRoot":"","sources":["../../src/structures/CommandClient.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import type { Command } from '../command';
|
|
2
2
|
import { Listener } from '../listener';
|
|
3
|
-
import { ArgumentConverter,
|
|
4
|
-
import {
|
|
3
|
+
import { ArgumentConverter, ApplicationCommandArgumentConverter } from '../command';
|
|
4
|
+
import { AppCommand } from '../applicationCommand';
|
|
5
5
|
import { CommandClient } from './CommandClient';
|
|
6
|
+
import { MessageComponentHandler } from '../messageComponents/base';
|
|
6
7
|
export declare abstract class Module {
|
|
7
8
|
commandClient: CommandClient;
|
|
8
9
|
get logger(): import("tslog").Logger;
|
|
9
10
|
get commands(): Command[];
|
|
10
11
|
get listeners(): Listener[];
|
|
11
12
|
get argumentConverters(): ArgumentConverter[];
|
|
12
|
-
get
|
|
13
|
-
get
|
|
13
|
+
get applicationCommandArgumentConverters(): ApplicationCommandArgumentConverter[];
|
|
14
|
+
get applicationCommands(): AppCommand[];
|
|
15
|
+
get messageComponentHandlers(): MessageComponentHandler[];
|
|
14
16
|
get path(): string | undefined;
|
|
15
17
|
load(): void;
|
|
16
18
|
unload(): void;
|
|
@@ -17,11 +17,14 @@ class Module {
|
|
|
17
17
|
get argumentConverters() {
|
|
18
18
|
return Reflect.getMetadata(constants_1.KArgumentConverters, this) || [];
|
|
19
19
|
}
|
|
20
|
-
get
|
|
20
|
+
get applicationCommandArgumentConverters() {
|
|
21
21
|
return Reflect.getMetadata(constants_1.KSlashArgumentConverters, this) || [];
|
|
22
22
|
}
|
|
23
|
-
get
|
|
24
|
-
return Reflect.getMetadata(constants_1.
|
|
23
|
+
get applicationCommands() {
|
|
24
|
+
return Reflect.getMetadata(constants_1.KApplicationCommands, this) || [];
|
|
25
|
+
}
|
|
26
|
+
get messageComponentHandlers() {
|
|
27
|
+
return Reflect.getMetadata(constants_1.KMessageComponentHandlers, this) || [];
|
|
25
28
|
}
|
|
26
29
|
get path() {
|
|
27
30
|
return Reflect.getMetadata(constants_1.KModulePath, this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Module.js","sourceRoot":"","sources":["../../src/structures/Module.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"Module.js","sourceRoot":"","sources":["../../src/structures/Module.ts"],"names":[],"mappings":";;;AAAA,4CAAiK;AAQjK,MAAsB,MAAM;IAG1B,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,cAAc,CAAC;YAC9C,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI;SAC5B,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,OAAO,CAAC,WAAW,CAAC,qBAAS,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IACnD,CAAC;IAED,IAAI,SAAS;QACX,OAAO,OAAO,CAAC,WAAW,CAAC,sBAAU,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IACpD,CAAC;IAED,IAAI,kBAAkB;QACpB,OAAO,OAAO,CAAC,WAAW,CAAC,+BAAmB,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IAC7D,CAAC;IAED,IAAI,oCAAoC;QACtC,OAAO,OAAO,CAAC,WAAW,CAAC,oCAAwB,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IAClE,CAAC;IAED,IAAI,mBAAmB;QACrB,OAAO,OAAO,CAAC,WAAW,CAAC,gCAAoB,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IAC9D,CAAC;IAED,IAAI,wBAAwB;QAC1B,OAAO,OAAO,CAAC,WAAW,CAAC,qCAAyB,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IACnE,CAAC;IAED,IAAI,IAAI;QACN,OAAO,OAAO,CAAC,WAAW,CAAC,uBAAW,EAAE,IAAI,CAAC,CAAA;IAC/C,CAAC;IAED,IAAI,KAAI,CAAC;IACT,MAAM,KAAI,CAAC;IACX,YAAY,KAAI,CAAC;IACjB,WAAW,KAAI,CAAC;CACjB;AAzCD,wBAyCC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CommandClient } from './CommandClient';
|
|
2
2
|
import { Module } from './Module';
|
|
3
|
-
import { Command,
|
|
3
|
+
import { Command, ApplicationCommandArgumentConverter } from '../command';
|
|
4
4
|
import { Collection } from 'discord.js';
|
|
5
5
|
import { ArgumentConverter } from '../command';
|
|
6
|
-
import {
|
|
6
|
+
import { AppCommand } from '../applicationCommand';
|
|
7
|
+
import { MessageComponentHandler } from '../messageComponents/base';
|
|
7
8
|
export declare class Registry {
|
|
8
9
|
client: CommandClient;
|
|
9
10
|
constructor(client: CommandClient);
|
|
@@ -11,8 +12,9 @@ export declare class Registry {
|
|
|
11
12
|
private get logger();
|
|
12
13
|
get commands(): Command[];
|
|
13
14
|
get argumentConverters(): ArgumentConverter[];
|
|
14
|
-
get
|
|
15
|
-
get
|
|
15
|
+
get applicationCommandArgumentConverters(): ApplicationCommandArgumentConverter[];
|
|
16
|
+
get applicationCommands(): AppCommand[];
|
|
17
|
+
get messageComponentHandlers(): MessageComponentHandler[];
|
|
16
18
|
registerModule(module: Module): Module;
|
|
17
19
|
loadModulesIn(dir: string, absolute?: boolean): Promise<void>;
|
|
18
20
|
loadModule(file: string, absolute?: boolean): Promise<Module>;
|