aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/Config.ts93
-rw-r--r--config/example-options.ts42
2 files changed, 135 insertions, 0 deletions
diff --git a/config/Config.ts b/config/Config.ts
new file mode 100644
index 0000000..ce5ec06
--- /dev/null
+++ b/config/Config.ts
@@ -0,0 +1,93 @@
+import { type Snowflake } from 'discord.js';
+
+export class Config {
+ public credentials: Credentials;
+ public environment: Environment;
+ public owners: Snowflake[];
+ public prefix: string;
+ public channels: Channels;
+ public db: DataBase;
+ public logging: Logging;
+ public supportGuild: SupportGuild;
+
+ public constructor(options: ConfigOptions) {
+ this.credentials = options.credentials;
+ this.environment = options.environment;
+ this.owners = options.owners;
+ this.prefix = options.prefix;
+ this.channels = options.channels;
+ this.db = options.db;
+ this.logging = options.logging;
+ this.supportGuild = options.supportGuild;
+ }
+
+ public get token(): string {
+ return this.environment === 'production'
+ ? this.credentials.token
+ : this.environment === 'beta'
+ ? this.credentials.betaToken
+ : this.credentials.devToken;
+ }
+
+ public get isProduction(): boolean {
+ return this.environment === 'production';
+ }
+
+ public get isBeta(): boolean {
+ return this.environment === 'beta';
+ }
+
+ public get isDevelopment(): boolean {
+ return this.environment === 'development';
+ }
+}
+
+export interface ConfigOptions {
+ credentials: Credentials;
+ environment: Environment;
+ owners: Snowflake[];
+ prefix: string;
+ channels: Channels;
+ db: DataBase;
+ logging: Logging;
+ supportGuild: SupportGuild;
+}
+
+interface Credentials {
+ token: string;
+ betaToken: string;
+ devToken: string;
+ hypixelApiKey: string;
+ wolframAlphaAppId: string;
+ imgurClientId: string;
+ imgurClientSecret: string;
+ sentryDsn: string;
+ perspectiveApiKey: string;
+}
+
+type Environment = 'production' | 'beta' | 'development';
+
+interface Channels {
+ log: Snowflake;
+ error: Snowflake;
+ dm: Snowflake;
+ servers: Snowflake;
+}
+
+interface DataBase {
+ host: string;
+ port: number;
+ username: string;
+ password: string;
+}
+
+interface Logging {
+ db: boolean;
+ verbose: boolean;
+ info: boolean;
+}
+
+interface SupportGuild {
+ id: Snowflake;
+ invite: string;
+}
diff --git a/config/example-options.ts b/config/example-options.ts
new file mode 100644
index 0000000..024b043
--- /dev/null
+++ b/config/example-options.ts
@@ -0,0 +1,42 @@
+import { Config } from './Config.js';
+
+export default new Config({
+ credentials: {
+ token: '[TOKEN]',
+ betaToken: '[TOKEN]',
+ devToken: '[TOKEN]',
+ hypixelApiKey: '[API_KEY]',
+ wolframAlphaAppId: '[APP_ID]',
+ imgurClientId: '[CLIENT_ID]',
+ imgurClientSecret: '[CLIENT_SECRET]',
+ sentryDsn: 'SENTRY_DSN',
+ perspectiveApiKey: '[PERSPECTIVE_API_KEY]'
+ },
+ environment: 'development',
+ owners: [
+ '322862723090219008', //IRONM00N
+ '487443883127472129' //Tyman
+ ],
+ prefix: '-',
+ channels: {
+ log: '1000000000000000',
+ error: '1000000000000000',
+ dm: '1000000000000000',
+ servers: '1000000000000000'
+ },
+ db: {
+ host: 'localhost',
+ port: 5432,
+ username: '[USER_NAME]',
+ password: '[PASSWORD]'
+ },
+ logging: {
+ db: false,
+ verbose: false,
+ info: true
+ },
+ supportGuild: {
+ id: '812400566235430912',
+ invite: 'https://discord.gg/mWtDmq6XcB'
+ }
+});