necord 3.0.5 → 3.0.6
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.
|
@@ -9,5 +9,5 @@ export declare class ComponentsService implements OnModuleInit {
|
|
|
9
9
|
private readonly client;
|
|
10
10
|
private readonly components;
|
|
11
11
|
constructor(explorerService: ExplorerService<ComponentMetadata>, metadataAccessor: MetadataAccessorService, client: Client);
|
|
12
|
-
onModuleInit(): void
|
|
12
|
+
onModuleInit(): Promise<void>;
|
|
13
13
|
}
|
|
@@ -8,6 +8,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
11
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
21
|
exports.ComponentsService = void 0;
|
|
13
22
|
const explorer_service_1 = require("./explorer.service");
|
|
@@ -22,13 +31,15 @@ let ComponentsService = class ComponentsService {
|
|
|
22
31
|
this.components = new Map();
|
|
23
32
|
}
|
|
24
33
|
onModuleInit() {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const components = this.explorerService.explore((instance, prototype, method) => this.metadataAccessor.getMessageComponentMetadata(instance, method));
|
|
36
|
+
for (const component of components) {
|
|
37
|
+
this.client.on('interactionCreate', interaction => interaction.isMessageComponent() &&
|
|
38
|
+
interaction.componentType === discord_js_1.MessageComponentInteraction.resolveType(component.type) &&
|
|
39
|
+
interaction.customId === component.customId &&
|
|
40
|
+
component.execute(interaction));
|
|
41
|
+
}
|
|
42
|
+
});
|
|
32
43
|
}
|
|
33
44
|
};
|
|
34
45
|
ComponentsService = __decorate([
|
|
@@ -33,7 +33,7 @@ let ListenersService = class ListenersService {
|
|
|
33
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
34
|
const listeners = this.explorerService.explore((instance, prototype, name) => this.metadataAccessor.getListenerMetadata(instance, name));
|
|
35
35
|
for (const listener of listeners) {
|
|
36
|
-
this.client[listener.type](listener.event, (...args) => listener.execute(args));
|
|
36
|
+
this.client[listener.type](listener.event, (...args) => listener.execute(args.length > 1 ? args : args[0]));
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "necord",
|
|
3
3
|
"description": "A module for creating Discord bots using NestJS, based on Discord.js.",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.6",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rimraf -rf dist && tsc -p tsconfig.json",
|
|
7
7
|
"prepublish:npm": "npm run build",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@types/node": "17.0.4",
|
|
52
52
|
"@typescript-eslint/eslint-plugin": "4.33.0",
|
|
53
53
|
"@typescript-eslint/parser": "4.33.0",
|
|
54
|
-
"discord.js": "13.
|
|
54
|
+
"discord.js": "13.3.1",
|
|
55
55
|
"eslint": "7.32.0",
|
|
56
56
|
"eslint-config-prettier": "8.3.0",
|
|
57
57
|
"eslint-plugin-prettier": "4.0.0",
|