This commit is contained in:
Michel Fedde 2025-06-18 22:53:54 +02:00
parent 441715675c
commit a79898b2e9
48 changed files with 2062 additions and 1503 deletions

View file

@ -50,20 +50,20 @@ export class InteractionRouter {
return InteractionRoutingType.Unrouted;
}
private async handleCommand(interaction: ChatInputCommandInteraction) {
try {
const command = this.commands.getCommand(interaction.commandName);
if (!command) {
throw new UserError(`Requested command not found.`);
}
if (!('execute' in command)) {
throw new UserError(`Requested command is not setup for a chat command.`);
}
this.logger.debug(`Found chat command ${interaction.commandName}: running...`);
await command.execute?.call(command, interaction);
} catch (e: any) {
this.logger.error(e)
@ -79,13 +79,13 @@ ${inlineCode(e.tryInstead)}`
}
}
if (interaction.replied || interaction.deferred) {
await interaction.followUp({ content: userMessage, flags: MessageFlags.Ephemeral });
await interaction.followUp({content: userMessage, flags: MessageFlags.Ephemeral});
} else {
await interaction.reply({ content: userMessage, flags: MessageFlags.Ephemeral });
await interaction.reply({content: userMessage, flags: MessageFlags.Ephemeral});
}
}
}
private async handleAutocomplete(interaction: AutocompleteInteraction) {
const command = this.commands.getCommand(interaction.commandName);
@ -104,6 +104,6 @@ ${inlineCode(e.tryInstead)}`
} catch (e: unknown) {
Container.get<Logger>('logger').error(e);
}
}
}