@notenoughupdates/discord-akairo
Advanced tools
Comparing version 9.0.10-dev.1640462480.67bad80 to 9.0.10-dev.1640720924.492e948
{ | ||
"name": "@notenoughupdates/discord-akairo", | ||
"version": "9.0.10-dev.1640462480.67bad80", | ||
"version": "9.0.10-dev.1640720924.492e948", | ||
"description": "A highly customizable bot framework for Discord.js.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/src/index.js", |
@@ -134,2 +134,3 @@ "use strict"; | ||
async registerInteractionCommands() { | ||
this.client.emit("akairoDebug", `[registerInteractionCommands] Started registering interaction commands...`); | ||
const parsedSlashCommands = []; | ||
@@ -198,2 +199,3 @@ const guildSlashCommandsParsed = new discord_js_1.Collection(); | ||
if (!Util_js_1.default.deepEquals(currentGlobalCommands, slashCommandsApp)) { | ||
this.client.emit("akairoDebug", "[registerInteractionCommands] Updating global interaction commands.", slashCommandsApp); | ||
await this.client.application?.commands.set(slashCommandsApp).catch(error => { | ||
@@ -206,2 +208,5 @@ if (error instanceof discord_js_1.DiscordAPIError) | ||
} | ||
else { | ||
this.client.emit("akairoDebug", "[registerInteractionCommands]Global interaction commands are up to date."); | ||
} | ||
/* Guilds */ | ||
@@ -229,2 +234,3 @@ for (const { name, description, options, guilds, defaultPermission, type } of parsedSlashCommands) { | ||
if (!Util_js_1.default.deepEquals(currentGuildCommands, value)) { | ||
this.client.emit("akairoDebug", `[registerInteractionCommands] Updating guild commands for ${guild.name}.`, value); | ||
await guild.commands.set(value).catch(error => { | ||
@@ -237,2 +243,5 @@ if (error instanceof discord_js_1.DiscordAPIError) | ||
} | ||
else { | ||
this.client.emit("akairoDebug", `[registerInteractionCommands] No changes needed for ${guild.name}.`); | ||
} | ||
}); | ||
@@ -289,7 +298,3 @@ } | ||
catch (e) { | ||
/* eslint-disable no-console */ | ||
console.debug(promises); | ||
console.debug(globalCommands); | ||
console.debug(fullPermissions); | ||
/* eslint-enable no-console */ | ||
this.client.emit("akairoDebug", "Error updating interaction permissions, here are the promises, globalCommands, and fullPermissions", promises, globalCommands, fullPermissions); | ||
throw e; | ||
@@ -610,2 +615,3 @@ } | ||
} | ||
this.client.emit("akairoDebug", `Autocomplete started for ${interaction.commandName}`); | ||
commandModule.autocomplete(interaction); | ||
@@ -612,0 +618,0 @@ } |
@@ -264,4 +264,4 @@ import type { ClientEvents, CommandInteraction, ContextMenuInteraction, Message } from "discord.js"; | ||
*/ | ||
akairoDebug: [message: string]; | ||
akairoDebug: [message: string, ...other: any[]]; | ||
} | ||
//# sourceMappingURL=events.d.ts.map |
{ | ||
"name": "@notenoughupdates/discord-akairo", | ||
"version": "9.0.10-dev.1640462480.67bad80", | ||
"version": "9.0.10-dev.1640720924.492e948", | ||
"description": "A highly customizable bot framework for Discord.js.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/src/index.js", |
@@ -362,2 +362,3 @@ import { | ||
protected async registerInteractionCommands() { | ||
this.client.emit("akairoDebug", `[registerInteractionCommands] Started registering interaction commands...`); | ||
const parsedSlashCommands: { | ||
@@ -443,2 +444,3 @@ name: string; | ||
if (!Util.deepEquals(currentGlobalCommands, slashCommandsApp)) { | ||
this.client.emit("akairoDebug", "[registerInteractionCommands] Updating global interaction commands.", slashCommandsApp); | ||
await this.client.application?.commands.set(slashCommandsApp).catch(error => { | ||
@@ -448,2 +450,4 @@ if (error instanceof DiscordAPIError) throw new RegisterInteractionCommandError(error, "global", slashCommandsApp); | ||
}); | ||
} else { | ||
this.client.emit("akairoDebug", "[registerInteractionCommands]Global interaction commands are up to date."); | ||
} | ||
@@ -474,2 +478,3 @@ | ||
if (!Util.deepEquals(currentGuildCommands, value)) { | ||
this.client.emit("akairoDebug", `[registerInteractionCommands] Updating guild commands for ${guild.name}.`, value); | ||
await guild.commands.set(value).catch(error => { | ||
@@ -479,2 +484,4 @@ if (error instanceof DiscordAPIError) throw new RegisterInteractionCommandError(error, "guild", value, guild); | ||
}); | ||
} else { | ||
this.client.emit("akairoDebug", `[registerInteractionCommands] No changes needed for ${guild.name}.`); | ||
} | ||
@@ -539,7 +546,9 @@ }); | ||
} catch (e) { | ||
/* eslint-disable no-console */ | ||
console.debug(promises); | ||
console.debug(globalCommands); | ||
console.debug(fullPermissions); | ||
/* eslint-enable no-console */ | ||
this.client.emit( | ||
"akairoDebug", | ||
"Error updating interaction permissions, here are the promises, globalCommands, and fullPermissions", | ||
promises, | ||
globalCommands, | ||
fullPermissions | ||
); | ||
throw e; | ||
@@ -892,2 +901,3 @@ } | ||
this.client.emit("akairoDebug", `Autocomplete started for ${interaction.commandName}`); | ||
commandModule.autocomplete(interaction); | ||
@@ -894,0 +904,0 @@ } |
@@ -302,3 +302,3 @@ import type { ClientEvents, CommandInteraction, ContextMenuInteraction, Message } from "discord.js"; | ||
*/ | ||
akairoDebug: [message: string]; | ||
akairoDebug: [message: string, ...other: any[]]; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
906931
16284