mirror of
https://github.com/YuzuZensai/Kiroku.git
synced 2026-01-30 12:32:53 +00:00
43 lines
874 B
TypeScript
43 lines
874 B
TypeScript
import fs from 'fs';
|
|
import { Client, Events, GatewayIntentBits } from 'discord.js';
|
|
|
|
export interface Config {
|
|
global: {
|
|
discord_guild_id?: string;
|
|
discord_bot_token?: string;
|
|
steam_api_key?: string;
|
|
};
|
|
users: {
|
|
[key: string]: any;
|
|
};
|
|
}
|
|
|
|
class ConfigProvider {
|
|
private config: Config = {
|
|
global: {},
|
|
users: {}
|
|
};
|
|
private ready = false;
|
|
|
|
constructor() {
|
|
try {
|
|
let data = fs.readFileSync('./config.json', 'utf8');
|
|
this.config = JSON.parse(data);
|
|
this.ready = true;
|
|
} catch (err) {
|
|
console.error('[ConfigProvider]', err);
|
|
return;
|
|
}
|
|
}
|
|
|
|
public getConfig(): Config {
|
|
return this.config;
|
|
}
|
|
|
|
public isReady(): boolean {
|
|
return this.ready;
|
|
}
|
|
}
|
|
|
|
export default new ConfigProvider();
|