necord 4.2.2 → 4.2.4
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.
|
@@ -3,7 +3,7 @@ import { ClientOptions as DiscordClientOptions, Snowflake } from 'discord.js';
|
|
|
3
3
|
export interface NecordModuleOptions extends DiscordClientOptions {
|
|
4
4
|
token: string;
|
|
5
5
|
prefix?: string | Function;
|
|
6
|
-
development?: Snowflake[];
|
|
6
|
+
development?: [Snowflake, ...Snowflake[]] | false;
|
|
7
7
|
}
|
|
8
8
|
export interface NecordOptionsFactory {
|
|
9
9
|
createNecordOptions(): Promise<NecordModuleOptions> | NecordModuleOptions;
|
|
@@ -44,8 +44,10 @@ let NecordInteractionUpdate = NecordInteractionUpdate_1 = class NecordInteractio
|
|
|
44
44
|
const clientCommands = client.application.commands;
|
|
45
45
|
const commandsByGuildMap = new Map([[undefined, []]]);
|
|
46
46
|
for (const command of this.registry.getApplicationCommands()) {
|
|
47
|
-
const
|
|
48
|
-
|
|
47
|
+
const defaultGuild = Array.isArray(this.options.development)
|
|
48
|
+
? this.options.development
|
|
49
|
+
: [undefined];
|
|
50
|
+
for (const guild of (_a = command.metadata[necord_constants_1.GUILDS_METADATA]) !== null && _a !== void 0 ? _a : defaultGuild) {
|
|
49
51
|
const visitedCommands = (_b = commandsByGuildMap.get(guild)) !== null && _b !== void 0 ? _b : [];
|
|
50
52
|
commandsByGuildMap.set(guild, visitedCommands.concat(command));
|
|
51
53
|
}
|
|
@@ -53,28 +55,15 @@ let NecordInteractionUpdate = NecordInteractionUpdate_1 = class NecordInteractio
|
|
|
53
55
|
this.logger.log(`Started refreshing application commands.`);
|
|
54
56
|
for (const [guild, commands] of commandsByGuildMap.entries()) {
|
|
55
57
|
const registeredCommands = yield clientCommands.set(commands, guild);
|
|
56
|
-
|
|
57
|
-
var _a;
|
|
58
|
-
const applicationCommand = registeredCommands.find(x => x.name === command.name);
|
|
59
|
-
return {
|
|
60
|
-
id: applicationCommand.id,
|
|
61
|
-
permissions: (_a = command.metadata[necord_constants_1.PERMISSIONS_METADATA]) !== null && _a !== void 0 ? _a : []
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
-
if (guild) {
|
|
65
|
-
yield clientCommands.permissions.set({
|
|
66
|
-
guild,
|
|
67
|
-
fullPermissions
|
|
68
|
-
});
|
|
58
|
+
if (!guild)
|
|
69
59
|
continue;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
60
|
+
yield clientCommands.permissions.set({
|
|
61
|
+
guild,
|
|
62
|
+
fullPermissions: commands.map(command => ({
|
|
63
|
+
id: registeredCommands.find(x => x.name === command.name).id,
|
|
64
|
+
permissions: command.metadata[necord_constants_1.PERMISSIONS_METADATA]
|
|
65
|
+
}))
|
|
66
|
+
});
|
|
78
67
|
}
|
|
79
68
|
this.logger.log(`Successfully reloaded application commands.`);
|
|
80
69
|
});
|
package/package.json
CHANGED