Back to private :)

This commit is contained in:
Dragon Fire
2018-07-17 21:53:48 -04:00
parent 536e191e64
commit 11a8e26ddb
9 changed files with 14 additions and 355 deletions
-13
View File
@@ -1,13 +0,0 @@
const { CommandoClient } = require('discord.js-commando');
const Database = require('../structures/PostgreSQL');
class XiaoClient extends CommandoClient {
constructor(options) {
super(options);
this.database = Database.db;
Database.start();
}
}
module.exports = XiaoClient;
-23
View File
@@ -1,23 +0,0 @@
const Sequelize = require('sequelize');
const { DB_URL } = process.env;
const db = new Sequelize(DB_URL, { logging: false, operatorsAliases: false });
class PostgreSQL {
static get db() {
return db;
}
static async start() {
try {
await db.authenticate();
console.log('[DATABASE] Connection established! Syncing...');
await db.sync();
console.log('[DATABASE] Database sync complete!');
} catch (err) {
console.error('[DATABASE] Unable to connect to database:', err);
setTimeout(() => PostgreSQL.start(), 5000);
}
}
}
module.exports = PostgreSQL;