@globalart/nestcord 1.5.10 → 1.6.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.
|
@@ -12,5 +12,6 @@ export declare class CommandsModule implements OnModuleInit, OnApplicationBootst
|
|
|
12
12
|
private readonly slashCommandsService;
|
|
13
13
|
constructor(client: Client, options: NestCordModuleOptions, commandsService: CommandsService, contextMenusService: ContextMenusService, slashCommandsService: SlashCommandsService);
|
|
14
14
|
onModuleInit(): Promise<void>;
|
|
15
|
+
private initializeClient;
|
|
15
16
|
onApplicationBootstrap(): void;
|
|
16
17
|
}
|
|
@@ -39,17 +39,26 @@ let CommandsModule = class CommandsModule {
|
|
|
39
39
|
onModuleInit() {
|
|
40
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
41
|
this.client.once('ready', () => __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
yield this.initializeClient();
|
|
43
|
+
}));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
initializeClient() {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const { skipGetCommandInfoFromDiscord, skipRegistration } = this.options;
|
|
49
|
+
if (!skipGetCommandInfoFromDiscord) {
|
|
42
50
|
yield this.client.application.commands.fetch();
|
|
43
51
|
this.commandsService.getAllCommandsAndSetAdditionalMeta();
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
52
|
+
}
|
|
53
|
+
if (!skipRegistration) {
|
|
47
54
|
if (this.client.application.partial) {
|
|
48
55
|
yield this.client.application.fetch();
|
|
49
56
|
}
|
|
50
57
|
yield this.commandsService.registerAllCommands();
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
if (!skipGetCommandInfoFromDiscord) {
|
|
59
|
+
this.commandsService.getAllCommandsAndSetAdditionalMeta();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
53
62
|
});
|
|
54
63
|
}
|
|
55
64
|
onApplicationBootstrap() {
|
|
@@ -119,10 +119,6 @@ let CommandsService = CommandsService_1 = class CommandsService {
|
|
|
119
119
|
if (commandByName.meta) {
|
|
120
120
|
commandByName.meta.discordResponse = command;
|
|
121
121
|
}
|
|
122
|
-
else {
|
|
123
|
-
// @ts-ignore
|
|
124
|
-
commandByName.meta = { discordResponse: command };
|
|
125
|
-
}
|
|
126
122
|
this.slashCommandsService.update(commandByName);
|
|
127
123
|
}
|
|
128
124
|
}
|
|
@@ -23,4 +23,8 @@ export interface NestCordModuleOptions extends DiscordClientOptions {
|
|
|
23
23
|
* If skipRegistration is true, nestcord would not automatically register your application commands with Discord. You would have to register the application commands manually.
|
|
24
24
|
*/
|
|
25
25
|
skipRegistration?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* If true, the bot won't fetch data from the Discord API, and discordResponse in the commandDiscovery will be null."
|
|
28
|
+
*/
|
|
29
|
+
skipGetCommandInfoFromDiscord?: boolean;
|
|
26
30
|
}
|
package/package.json
CHANGED