aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/BushClient.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-06-20 22:52:50 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-06-20 22:52:50 -0400
commit5c3da90f441c321f55ae735d6002f4da91f2481e (patch)
treeac6a993595eebe38fd5e7bd79ade4c5ec71be373 /src/lib/extensions/BushClient.ts
parent87e77ae8cc69d0d7f1e3d6f614b03c9297e85ab3 (diff)
downloadtanzanite-5c3da90f441c321f55ae735d6002f4da91f2481e.tar.gz
tanzanite-5c3da90f441c321f55ae735d6002f4da91f2481e.tar.bz2
tanzanite-5c3da90f441c321f55ae735d6002f4da91f2481e.zip
feat(*): aaaaa
Diffstat (limited to 'src/lib/extensions/BushClient.ts')
-rw-r--r--src/lib/extensions/BushClient.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/extensions/BushClient.ts b/src/lib/extensions/BushClient.ts
index 8592281..ad22cfe 100644
--- a/src/lib/extensions/BushClient.ts
+++ b/src/lib/extensions/BushClient.ts
@@ -9,6 +9,7 @@ import * as config from '../../config/options';
import * as Models from '../models';
import AllowedMentions from '../utils/AllowedMentions';
import { BushCache } from '../utils/BushCache';
+import { BushConstants } from '../utils/BushConstants';
import { BushLogger } from '../utils/BushLogger';
import { BushClientUtil } from './BushClientUtil';
import { BushCommandHandler } from './BushCommandHandler';
@@ -34,6 +35,7 @@ export class BushClient extends AkairoClient {
public declare ownerID: Snowflake[];
public db: Sequelize;
public logger: BushLogger;
+ public constants = BushConstants;
constructor(config: BotConfig) {
super(
{
@@ -107,7 +109,7 @@ export class BushClient extends AkairoClient {
dialect: 'postgres',
host: this.config.db.host,
port: this.config.db.port,
- logging: false
+ logging: (a, b) => this.logger.debug(a)
});
this.logger = new BushLogger(this);
}
@@ -116,6 +118,10 @@ export class BushClient extends AkairoClient {
return this.logger;
}
+ get consts(): typeof BushConstants {
+ return this.constants;
+ }
+
// Initialize everything
private async _init(): Promise<void> {
this.commandHandler.useListenerHandler(this.listenerHandler);
@@ -152,17 +158,20 @@ export class BushClient extends AkairoClient {
public async dbPreInit(): Promise<void> {
try {
await this.db.authenticate();
+ Models.Global.initModel(this.db);
Models.Guild.initModel(this.db, this);
Models.Modlog.initModel(this.db);
Models.Ban.initModel(this.db);
Models.Level.initModel(this.db);
+ Models.StickyRole.initModel(this.db);
await this.db.sync(); // Sync all tables to fix everything if updated
this.console.success('Startup', `Successfully connected to <<database>>.`, false);
} catch (error) {
- this.console.error('Startup', `Failed to connect to <<database>> with error:\n` + error, false);
+ this.console.error('Startup', `Failed to connect to <<database>> with error:\n` + error?.stack, false);
}
}
+ /** Starts the bot */
public async start(): Promise<void> {
try {
await this._init();
@@ -173,6 +182,7 @@ export class BushClient extends AkairoClient {
}
}
+ /** Logs out, terminates the connection to Discord, and destroys the client. */
public destroy(relogin = false): void | Promise<string> {
super.destroy();
if (relogin) {