aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord-akairo
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-17 14:11:37 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-17 14:11:37 -0400
commitda70ed6f4ad82c58adf7dc6120aa8b6b255238e9 (patch)
treea1d80d6d89ae249893c300234d034934a55ea0b4 /src/lib/extensions/discord-akairo
parentd1724227abfb8f0fcd9e573f7e9772cf0be8257a (diff)
downloadtanzanite-da70ed6f4ad82c58adf7dc6120aa8b6b255238e9.tar.gz
tanzanite-da70ed6f4ad82c58adf7dc6120aa8b6b255238e9.tar.bz2
tanzanite-da70ed6f4ad82c58adf7dc6120aa8b6b255238e9.zip
rewrote config for absolutly no reason :troll:
Diffstat (limited to 'src/lib/extensions/discord-akairo')
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts28
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts3
2 files changed, 17 insertions, 14 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts
index 3b14200..b8e9d00 100644
--- a/src/lib/extensions/discord-akairo/BushClient.ts
+++ b/src/lib/extensions/discord-akairo/BushClient.ts
@@ -17,7 +17,6 @@ import readline from 'readline';
import { Sequelize } from 'sequelize';
import { contentWithDurationTypeCaster } from '../../../arguments/contentWithDuration';
import { durationTypeCaster } from '../../../arguments/duration';
-import * as config from '../../../config/options';
import { UpdateCacheTask } from '../../../tasks/updateCache';
import { Ban } from '../../models/Ban';
import { Global } from '../../models/Global';
@@ -31,6 +30,7 @@ import { AllowedMentions } from '../../utils/AllowedMentions';
import { BushCache } from '../../utils/BushCache';
import { BushConstants } from '../../utils/BushConstants';
import { BushLogger } from '../../utils/BushLogger';
+import { Config } from '../../utils/Config';
import { BushButtonInteraction } from '../discord.js/BushButtonInteraction';
import { BushCategoryChannel } from '../discord.js/BushCategoryChannel';
import { BushCommandInteraction } from '../discord.js/BushCommandInteraction';
@@ -57,7 +57,6 @@ import { BushInhibitorHandler } from './BushInhibitorHandler';
import { BushListenerHandler } from './BushListenerHandler';
import { BushTaskHandler } from './BushTaskHandler';
-export type BotConfig = typeof config;
export type BushReplyMessageType = string | MessagePayload | ReplyMessageOptions;
export type BushEditMessageType = string | MessageEditOptions | MessagePayload;
export type BushSendMessageType = string | MessagePayload | MessageOptions;
@@ -96,7 +95,7 @@ export class BushClient extends AkairoClient {
Structures.extend('SelectMenuInteraction', () => BushSelectMenuInteraction);
}
- public config: BotConfig;
+ public config: Config;
public listenerHandler: BushListenerHandler;
public inhibitorHandler: BushInhibitorHandler;
public commandHandler: BushCommandHandler;
@@ -107,7 +106,7 @@ export class BushClient extends AkairoClient {
public logger: BushLogger;
public constants = BushConstants;
public cache = BushCache;
- public constructor(config: BotConfig) {
+ public constructor(config: Config) {
super(
{
ownerID: config.owners,
@@ -164,9 +163,9 @@ export class BushClient extends AkairoClient {
this.commandHandler = new BushCommandHandler(this, {
directory: path.join(__dirname, '..', '..', '..', 'commands'),
prefix: async ({ guild }: { guild: Guild }) => {
- if (this.config.dev) return 'dev ';
+ if (this.config.isDevelopment) return 'dev ';
const row = await GuildModel.findByPk(guild.id);
- return (row?.prefix || this.config.prefix) as string;
+ return (row?.prefix || this.config.isBeta ? 'bush ' : this.config.prefix) as string;
},
allowMention: true,
handleEdits: true,
@@ -193,12 +192,17 @@ export class BushClient extends AkairoClient {
});
this.util = new BushClientUtil(this);
- this.db = new Sequelize(this.config.dev ? 'bushbot-dev' : 'bushbot', this.config.db.username, this.config.db.password, {
- dialect: 'postgres',
- host: this.config.db.host,
- port: this.config.db.port,
- logging: this.config.logging.db ? (sql) => this.logger.debug(sql) : false
- });
+ this.db = new Sequelize(
+ this.config.isDevelopment ? 'bushbot-dev' : 'bushbot',
+ this.config.db.username,
+ this.config.db.password,
+ {
+ dialect: 'postgres',
+ host: this.config.db.host,
+ port: this.config.db.port,
+ logging: this.config.logging.db ? (sql) => this.logger.debug(sql) : false
+ }
+ );
this.logger = new BushLogger(this);
}
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index 6a08c54..46e81df 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -527,8 +527,7 @@ export class BushClientUtil extends ClientUtil {
key: keyof typeof BushCache['global'],
value: any
): Promise<Global | void> {
- const environment = this.client.config.dev ? 'development' : 'production';
- const row = await Global.findByPk(environment);
+ const row = await Global.findByPk(this.client.config.environment);
const oldValue: any[] = row[key];
const newValue = this.addOrRemoveFromArray(action, oldValue, value);
row[key] = newValue;