Update ESLint rules, enhance environment schema with new metrics and health port, and refactor Redis import. Change TypeScript definitions path in package.json.

This commit is contained in:
smueller
2026-07-22 11:11:39 +02:00
parent c2271485a5
commit bc97d1d74c
15 changed files with 801 additions and 6 deletions

25
apps/bot/src/commands.ts Normal file
View File

@@ -0,0 +1,25 @@
import { REST, Routes, type ChatInputCommandInteraction } from 'discord.js';
import { env } from './env.js';
import { logger } from './logger.js';
import { moderationCommands } from './modules/moderation/commands.js';
import type { BotContext, SlashCommand } from './types.js';
const commands: SlashCommand[] = [...moderationCommands];
const map = new Map(commands.map((c) => [c.data.name, c]));
export async function registerCommands() {
const rest = new REST({ version: '10' }).setToken(env.BOT_TOKEN);
await rest.put(Routes.applicationCommands(env.BOT_CLIENT_ID), {
body: commands.map((c) => c.data.toJSON())
});
logger.info({ count: commands.length }, 'Registered application commands');
}
export async function routeCommand(interaction: ChatInputCommandInteraction, context: BotContext) {
const command = map.get(interaction.commandName);
if (!command) {
await interaction.reply({ content: 'Unknown command.', ephemeral: true });
return;
}
await command.execute(interaction, context);
}