diff --git a/lang/logs.json b/lang/logs.json index ad95953..0c751d2 100644 --- a/lang/logs.json +++ b/lang/logs.json @@ -50,8 +50,8 @@ "button": "An error occurred while processing a button interaction.", "commandNotFound": "[{INTERACTION_ID}] A command with the name '{COMMAND_NAME}' could not be found.", "autocompleteNotFound": "[{INTERACTION_ID}] An autocomplete method for the '{COMMAND_NAME}' command could not be found.", - "commandGuild": "[{INTERACTION_ID}] An error occurred while executing the '{COMMAND_NAME}' command for user '{USER_TAG}' ({USER_ID}) in channel '{CHANNEL_NAME}' ({CHANNEL_ID}) in guild '{GUILD_NAME}' ({GUILD_ID}).", - "autocompleteGuild": "[{INTERACTION_ID}] An error occurred while autocompleting the '{OPTION_NAME}' option for the '{COMMAND_NAME}' command for user '{USER_TAG}' ({USER_ID}) in channel '{CHANNEL_NAME}' ({CHANNEL_ID}) in guild '{GUILD_NAME}' ({GUILD_ID}).", + "commandGuild": "[{INTERACTION_ID}] An error occurred while executing the '{COMMAND_NAME}' command for user '{USER_TAG}' ({USER_ID}) in channel '{CHANNEL_NAME}' ({CHANNEL_ID}) in guild '{GUILD_NAME}' ({GUILD_ID}). Arguments: {ARGUMENTS}.", + "autocompleteGuild": "[{INTERACTION_ID}] An error occurred while autocompleting the '{OPTION_NAME}' option for the '{COMMAND_NAME}' command for user '{USER_TAG}' ({USER_ID}) in channel '{CHANNEL_NAME}' ({CHANNEL_ID}) in guild '{GUILD_NAME}' ({GUILD_ID}). Arguments: {ARGUMENTS}.", "commandOther": "[{INTERACTION_ID}] An error occurred while executing the '{COMMAND_NAME}' command for user '{USER_TAG}' ({USER_ID}).", "autocompleteOther": "[{INTERACTION_ID}] An error occurred while autocompleting the '{OPTION_NAME}' option for the '{COMMAND_NAME}' command for user '{USER_TAG}' ({USER_ID}).", "apiRequest": "An error occurred while processing a '{HTTP_METHOD}' request to '{URL}'.", diff --git a/src/events/command-handler.ts b/src/events/command-handler.ts index 065d10d..e8f3315 100644 --- a/src/events/command-handler.ts +++ b/src/events/command-handler.ts @@ -26,10 +26,7 @@ export class CommandHandler implements EventHandler { Config.rateLimiting.commands.interval * 1000 ); - constructor( - public commands: Command[], - private eventDataService: EventDataService - ) {} + constructor(public commands: Command[], private eventDataService: EventDataService) {} public async process(intr: CommandInteraction | AutocompleteInteraction): Promise { // Don't respond to self, or other bots @@ -144,6 +141,12 @@ export class CommandHandler implements EventHandler { } catch (error) { await this.sendError(intr, data); + let args = intr.options.data + .map(option => { + return `${option.name}: ${option.value}`; + }) + .join(', '); + // Log command error Logger.error( intr.channel instanceof TextChannel || @@ -158,11 +161,13 @@ export class CommandHandler implements EventHandler { .replaceAll('{CHANNEL_ID}', intr.channel.id) .replaceAll('{GUILD_NAME}', intr.guild?.name) .replaceAll('{GUILD_ID}', intr.guild?.id) + .replaceAll('{ARGUMENTS}', args) : Logs.error.commandOther .replaceAll('{INTERACTION_ID}', intr.id) .replaceAll('{COMMAND_NAME}', commandName) .replaceAll('{USER_TAG}', intr.user.tag) - .replaceAll('{USER_ID}', intr.user.id), + .replaceAll('{USER_ID}', intr.user.id) + .replaceAll('{ARGUMENTS}', args), error ); }