Update README and moderation commands for localization and migration support
- Revised README to include database migration steps and a new section for database management. - Enhanced moderation command responses to utilize localized messages for unknown commands. - Refactored moderation commands to use centralized command data definitions, improving maintainability and consistency. - Added localization support for command descriptions and options in both German and English. - Versioned Prisma migrations for better tracking of database changes.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { REST, Routes, type ChatInputCommandInteraction } from 'discord.js';
|
||||
import { t } from '@nexumi/shared';
|
||||
import { env } from './env.js';
|
||||
import { logger } from './logger.js';
|
||||
import { getGuildLocale } from './i18n.js';
|
||||
import { moderationCommands } from './modules/moderation/commands.js';
|
||||
import type { BotContext, SlashCommand } from './types.js';
|
||||
|
||||
@@ -17,8 +19,9 @@ export async function registerCommands() {
|
||||
|
||||
export async function routeCommand(interaction: ChatInputCommandInteraction, context: BotContext) {
|
||||
const command = map.get(interaction.commandName);
|
||||
const locale = await getGuildLocale(context.prisma, interaction.guildId);
|
||||
if (!command) {
|
||||
await interaction.reply({ content: 'Unknown command.', ephemeral: true });
|
||||
await interaction.reply({ content: t(locale, 'generic.unknownCommand'), ephemeral: true });
|
||||
return;
|
||||
}
|
||||
await command.execute(interaction, context);
|
||||
|
||||
Reference in New Issue
Block a user