feat: Introduce dynamic JSON-based configuration for game settings and command toggling via a new admin command.

This commit is contained in:
syntaxbullet
2025-12-15 21:59:28 +01:00
parent 1eace32aa1
commit ac6283e60c
12 changed files with 257 additions and 48 deletions

20
src/lib/configManager.ts Normal file
View File

@@ -0,0 +1,20 @@
import { readFileSync, writeFileSync } from 'fs';
import { join } from 'path';
import { KyokoClient } from '@/lib/KyokoClient';
const configPath = join(process.cwd(), 'src', 'config', 'game.json');
export const configManager = {
toggleCommand: (commandName: string, enabled: boolean) => {
const raw = readFileSync(configPath, 'utf-8');
const data = JSON.parse(raw);
if (!data.commands) {
data.commands = {};
}
data.commands[commandName] = enabled;
writeFileSync(configPath, JSON.stringify(data, null, 4));
}
};