necord 4.2.1 → 4.2.2
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/context/index.d.ts +1 -0
- package/dist/context/index.js +1 -0
- package/dist/context/necord-info-type.enum.d.ts +7 -0
- package/dist/context/necord-info-type.enum.js +11 -0
- package/dist/necord-interaction.update.js +4 -3
- package/dist/necord-registry.js +2 -1
- package/dist/necord.update.js +2 -1
- package/package.json +1 -1
package/dist/context/index.d.ts
CHANGED
package/dist/context/index.js
CHANGED
|
@@ -12,4 +12,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./necord-arguments-host"), exports);
|
|
14
14
|
__exportStar(require("./necord-execution-context"), exports);
|
|
15
|
+
__exportStar(require("./necord-info-type.enum"), exports);
|
|
15
16
|
__exportStar(require("./necord-params.factory"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NecordInfoType = void 0;
|
|
4
|
+
var NecordInfoType;
|
|
5
|
+
(function (NecordInfoType) {
|
|
6
|
+
NecordInfoType[NecordInfoType["LISTENER"] = 0] = "LISTENER";
|
|
7
|
+
NecordInfoType[NecordInfoType["SLASH_COMMANDS"] = 1] = "SLASH_COMMANDS";
|
|
8
|
+
NecordInfoType[NecordInfoType["CONTEXT_MENU"] = 2] = "CONTEXT_MENU";
|
|
9
|
+
NecordInfoType[NecordInfoType["MESSAGE_COMPONENT"] = 3] = "MESSAGE_COMPONENT";
|
|
10
|
+
NecordInfoType[NecordInfoType["TEXT_COMMAND"] = 4] = "TEXT_COMMAND";
|
|
11
|
+
})(NecordInfoType = exports.NecordInfoType || (exports.NecordInfoType = {}));
|
|
@@ -28,6 +28,7 @@ const decorators_1 = require("./decorators");
|
|
|
28
28
|
const necord_registry_1 = require("./necord-registry");
|
|
29
29
|
const necord_constants_1 = require("./necord.constants");
|
|
30
30
|
const core_1 = require("@nestjs/core");
|
|
31
|
+
const context_1 = require("./context");
|
|
31
32
|
let NecordInteractionUpdate = NecordInteractionUpdate_1 = class NecordInteractionUpdate {
|
|
32
33
|
constructor(registry, options) {
|
|
33
34
|
this.registry = registry;
|
|
@@ -83,7 +84,7 @@ let NecordInteractionUpdate = NecordInteractionUpdate_1 = class NecordInteractio
|
|
|
83
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
85
|
if (interaction.isMessageComponent()) {
|
|
85
86
|
return (_a = this.registry
|
|
86
|
-
.getMessageComponent(interaction.componentType, interaction.customId)) === null || _a === void 0 ? void 0 : _a.metadata.execute([interaction], interaction.isSelectMenu() ? interaction.values : undefined, { type:
|
|
87
|
+
.getMessageComponent(interaction.componentType, interaction.customId)) === null || _a === void 0 ? void 0 : _a.metadata.execute([interaction], interaction.isSelectMenu() ? interaction.values : undefined, { type: context_1.NecordInfoType.MESSAGE_COMPONENT });
|
|
87
88
|
}
|
|
88
89
|
if (interaction.isContextMenu()) {
|
|
89
90
|
const options = interaction.isUserContextMenu()
|
|
@@ -94,7 +95,7 @@ let NecordInteractionUpdate = NecordInteractionUpdate_1 = class NecordInteractio
|
|
|
94
95
|
: { message: interaction.options.getMessage('message', false) };
|
|
95
96
|
return (_b = this.registry
|
|
96
97
|
.getContextMenu(interaction.targetType, interaction.commandName)) === null || _b === void 0 ? void 0 : _b.metadata.execute([interaction], options, {
|
|
97
|
-
type:
|
|
98
|
+
type: context_1.NecordInfoType.CONTEXT_MENU
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
101
|
if (interaction.isCommand() || interaction.isAutocomplete()) {
|
|
@@ -105,7 +106,7 @@ let NecordInteractionUpdate = NecordInteractionUpdate_1 = class NecordInteractio
|
|
|
105
106
|
if (!command)
|
|
106
107
|
return;
|
|
107
108
|
if (interaction.isCommand()) {
|
|
108
|
-
return command.metadata.execute([interaction], this.transformOptions(command, interaction), { type:
|
|
109
|
+
return command.metadata.execute([interaction], this.transformOptions(command, interaction), { type: context_1.NecordInfoType.SLASH_COMMANDS });
|
|
109
110
|
}
|
|
110
111
|
const module = command.metadata.host;
|
|
111
112
|
const instances = command.metadata[necord_constants_1.AUTOCOMPLETE_METADATA];
|
package/dist/necord-registry.js
CHANGED
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.NecordRegistry = void 0;
|
|
14
14
|
const discord_js_1 = require("discord.js");
|
|
15
15
|
const common_1 = require("@nestjs/common");
|
|
16
|
+
const context_1 = require("./context");
|
|
16
17
|
let NecordRegistry = NecordRegistry_1 = class NecordRegistry {
|
|
17
18
|
constructor(client) {
|
|
18
19
|
this.client = client;
|
|
@@ -23,7 +24,7 @@ let NecordRegistry = NecordRegistry_1 = class NecordRegistry {
|
|
|
23
24
|
}
|
|
24
25
|
registerListeners(listeners) {
|
|
25
26
|
listeners.forEach(listener => {
|
|
26
|
-
this.client[listener.type](listener.event, (...args) => listener.metadata.execute(args, null, { type:
|
|
27
|
+
this.client[listener.type](listener.event, (...args) => listener.metadata.execute(args, null, { type: context_1.NecordInfoType.LISTENER }));
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
30
|
addTextCommands(textCommands) {
|
package/dist/necord.update.js
CHANGED
|
@@ -27,6 +27,7 @@ const decorators_1 = require("./decorators");
|
|
|
27
27
|
const discord_js_1 = require("discord.js");
|
|
28
28
|
const necord_constants_1 = require("./necord.constants");
|
|
29
29
|
const necord_registry_1 = require("./necord-registry");
|
|
30
|
+
const context_1 = require("./context");
|
|
30
31
|
let NecordUpdate = class NecordUpdate {
|
|
31
32
|
constructor(options, client, registry) {
|
|
32
33
|
var _a;
|
|
@@ -49,7 +50,7 @@ let NecordUpdate = class NecordUpdate {
|
|
|
49
50
|
if (!cmd)
|
|
50
51
|
return;
|
|
51
52
|
return (_b = this.registry
|
|
52
|
-
.getTextCommand(cmd)) === null || _b === void 0 ? void 0 : _b.metadata.execute([message], args, { type:
|
|
53
|
+
.getTextCommand(cmd)) === null || _b === void 0 ? void 0 : _b.metadata.execute([message], args, { type: context_1.NecordInfoType.TEXT_COMMAND });
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
emit(event, ...args) {
|
package/package.json
CHANGED