mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-06 14:20:51 +02:00
Move Things Around
This commit is contained in:
@@ -1,23 +1,20 @@
|
||||
const Sequelize = require('sequelize');
|
||||
|
||||
const database = new Sequelize(process.env.DATABASE_URL, { logging: false });
|
||||
|
||||
class Database {
|
||||
module.exports = class Database {
|
||||
static get db() {
|
||||
return database;
|
||||
}
|
||||
|
||||
start() {
|
||||
database.authenticate()
|
||||
.then(() => console.log('Connection to database has been established successfully.'))
|
||||
.then(() => console.log('Synchronizing database...'))
|
||||
.then(() => console.log('[Database] Connection has been established successfully.'))
|
||||
.then(() => console.log('[Database] Synchronizing...'))
|
||||
.then(() => database.sync()
|
||||
.then(() => console.log('Synchronizing database done!'))
|
||||
.catch(error => console.error(`Error synchronizing the database: ${error}`))
|
||||
.then(() => console.log('[Database] Synchronizing complete!'))
|
||||
.catch(err => console.error(`[Database] Error synchronizing: ${err}`))
|
||||
)
|
||||
.then(() => console.log('Ready to rock!'))
|
||||
.catch(err => console.error(`Unable to connect to the database: ${err}`));
|
||||
.then(() => console.log('[Database] Ready!'))
|
||||
.catch(err => console.error(`[Database] Unable to connect: ${err}`));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Database;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
const request = require('superagent');
|
||||
|
||||
module.exports = class Stats {
|
||||
constructor() {
|
||||
throw new Error(`The ${this.constructor.name} class may not be instantiated.`);
|
||||
}
|
||||
|
||||
static discordBots(count, userID) {
|
||||
return request
|
||||
.post(`https://bots.discord.pw/api/bots/${userID}/stats`)
|
||||
.set({
|
||||
'Authorization': process.env.DISCORD_BOTS_KEY
|
||||
})
|
||||
.send({
|
||||
server_count: count
|
||||
});
|
||||
}
|
||||
|
||||
static carbon(count) {
|
||||
return request
|
||||
.post('https://www.carbonitex.net/discord/data/botdata.php')
|
||||
.send({
|
||||
key: process.env.CARBON_KEY,
|
||||
servercount: count
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user