@globalart/nestcord 1.7.7 → 1.7.8
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.
|
@@ -48,7 +48,7 @@ let CommandsModule = class CommandsModule {
|
|
|
48
48
|
const { skipGetCommandInfoFromDiscord, skipRegistration } = this.options;
|
|
49
49
|
if (!skipGetCommandInfoFromDiscord) {
|
|
50
50
|
yield this.client.application.commands.fetch();
|
|
51
|
-
this.commandsService.
|
|
51
|
+
this.commandsService.getAllCommandsAndSetDiscordResponseMeta();
|
|
52
52
|
}
|
|
53
53
|
if (!skipRegistration) {
|
|
54
54
|
if (this.client.application.partial) {
|
|
@@ -56,7 +56,7 @@ let CommandsModule = class CommandsModule {
|
|
|
56
56
|
}
|
|
57
57
|
yield this.commandsService.registerAllCommands();
|
|
58
58
|
if (!skipGetCommandInfoFromDiscord) {
|
|
59
|
-
this.commandsService.
|
|
59
|
+
this.commandsService.getAllCommandsAndSetDiscordResponseMeta();
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
});
|
|
@@ -25,10 +25,11 @@ export declare class CommandsService {
|
|
|
25
25
|
getCommandsByGuilds(): Collection<string, CommandDiscovery[]>;
|
|
26
26
|
getCommandsByCategoryMap(): Map<string, CommandDiscovery[]>;
|
|
27
27
|
getCommandsMap(): Map<string, CommandDiscovery>;
|
|
28
|
+
getGuildCommandsMap(guildId: string): Map<string, CommandDiscovery<import("./command.discovery").BaseCommandMeta>>;
|
|
28
29
|
getCommandByName(name: string): CommandDiscovery;
|
|
29
30
|
getGlobalCommands(): CommandDiscovery[];
|
|
30
31
|
getGlobalCommandByName(name: string): CommandDiscovery;
|
|
31
32
|
getGuildCommands(guildId: string): CommandDiscovery[];
|
|
32
33
|
getGuildCommandByName(guildId: string, name: string): CommandDiscovery;
|
|
33
|
-
|
|
34
|
+
getAllCommandsAndSetDiscordResponseMeta(): void;
|
|
34
35
|
}
|
|
@@ -95,6 +95,12 @@ let CommandsService = CommandsService_1 = class CommandsService {
|
|
|
95
95
|
return map;
|
|
96
96
|
}, new Map());
|
|
97
97
|
}
|
|
98
|
+
getGuildCommandsMap(guildId) {
|
|
99
|
+
return this.getGuildCommands(guildId).reduce((map, command) => {
|
|
100
|
+
map.set(command.getName(), command);
|
|
101
|
+
return map;
|
|
102
|
+
}, new Map());
|
|
103
|
+
}
|
|
98
104
|
getCommandByName(name) {
|
|
99
105
|
return this.getCommands().find((command) => command.getName() === name);
|
|
100
106
|
}
|
|
@@ -102,15 +108,15 @@ let CommandsService = CommandsService_1 = class CommandsService {
|
|
|
102
108
|
return this.getCommandsByGuilds().get(undefined) || [];
|
|
103
109
|
}
|
|
104
110
|
getGlobalCommandByName(name) {
|
|
105
|
-
return this.
|
|
111
|
+
return this.getCommandsMap().get(name);
|
|
106
112
|
}
|
|
107
113
|
getGuildCommands(guildId) {
|
|
108
114
|
return this.getCommandsByGuilds().get(guildId) || [];
|
|
109
115
|
}
|
|
110
116
|
getGuildCommandByName(guildId, name) {
|
|
111
|
-
return this.
|
|
117
|
+
return this.getGuildCommandsMap(guildId).get(name);
|
|
112
118
|
}
|
|
113
|
-
|
|
119
|
+
getAllCommandsAndSetDiscordResponseMeta() {
|
|
114
120
|
const commands = this.getCommandsMap();
|
|
115
121
|
const commandsCache = this.client.application.commands.cache;
|
|
116
122
|
const matchingCommands = Array.from(commandsCache.values()).filter((command) => commands.has(command.name));
|
|
@@ -24,7 +24,6 @@ var LocalizationInterceptor_1;
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.LocalizationInterceptor = void 0;
|
|
26
26
|
const common_1 = require("@nestjs/common");
|
|
27
|
-
const operators_1 = require("rxjs/operators");
|
|
28
27
|
const core_1 = require("../../../core");
|
|
29
28
|
const providers_1 = require("../providers");
|
|
30
29
|
const adapters_1 = require("../adapters");
|
|
@@ -60,11 +59,7 @@ let LocalizationInterceptor = LocalizationInterceptor_1 = class LocalizationInte
|
|
|
60
59
|
const locale = yield this.getLocale(nestcordContext);
|
|
61
60
|
const translationFn = this.getTranslationFn(locale);
|
|
62
61
|
LocalizationInterceptor_1.currentTranslationFn = translationFn;
|
|
63
|
-
return next.handle()
|
|
64
|
-
finalize: () => {
|
|
65
|
-
LocalizationInterceptor_1.currentTranslationFn = null;
|
|
66
|
-
},
|
|
67
|
-
}));
|
|
62
|
+
return next.handle();
|
|
68
63
|
});
|
|
69
64
|
}
|
|
70
65
|
getLocale(ctx) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@globalart/nestcord",
|
|
3
3
|
"description": "A module for creating Discord bots using NestJS, based on Discord.js",
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.8",
|
|
5
5
|
"private": false,
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "rimraf dist && tsc -p tsconfig.build.json",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@types/node": "20.14.9",
|
|
65
65
|
"@typescript-eslint/eslint-plugin": "7.0.0",
|
|
66
66
|
"@typescript-eslint/parser": "6.21.0",
|
|
67
|
-
"discord-api-types": "0.37.
|
|
67
|
+
"discord-api-types": "0.37.91",
|
|
68
68
|
"discord.js": "14.15.3",
|
|
69
69
|
"eslint": "8.57.0",
|
|
70
70
|
"eslint-config-prettier": "9.1.0",
|