forked from syntaxbullet/AuroraBot-discord
20 lines
530 B
TypeScript
20 lines
530 B
TypeScript
import { readFileSync, writeFileSync } from 'fs';
|
|
import { join } from 'path';
|
|
|
|
const configPath = join(process.cwd(), 'config', 'config.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));
|
|
}
|
|
};
|