2020-02-05 20:02:53 +00:00
|
|
|
const DBL = require("dblapi.js");
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
name: 'ready',
|
|
|
|
async execute(client, Discord) {
|
2020-03-03 20:24:41 +00:00
|
|
|
const debugChannel = await client.channels.fetch(client.config.debug_channel);
|
|
|
|
client.debug_channel = debugChannel
|
2020-02-05 20:02:53 +00:00
|
|
|
const remoteMusixGuildsData = await client.funcs.dbget('guilds', null, client);
|
|
|
|
remoteMusixGuildsData.forEach(guildData => {
|
|
|
|
client.global.db.guilds[guildData.id] = guildData.d;
|
|
|
|
});
|
2020-02-20 20:31:03 +00:00
|
|
|
if (client.config.devMode) {
|
|
|
|
console.log('dev mode');
|
2020-02-19 09:24:26 +00:00
|
|
|
client.guilds.cache.forEach(guild => {
|
2020-02-05 20:02:53 +00:00
|
|
|
client.global.db.guilds[guild.id] = {
|
|
|
|
prefix: client.config.prefix,
|
|
|
|
defaultVolume: client.config.defaultVolume,
|
|
|
|
permissions: client.config.permissions,
|
|
|
|
dj: client.config.dj,
|
|
|
|
djrole: client.config.djrole,
|
2020-02-20 20:31:03 +00:00
|
|
|
startPlaying: client.config.startPlaying,
|
2020-03-03 20:24:41 +00:00
|
|
|
bass: client.config.bass,
|
2020-02-05 20:02:53 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
2020-03-13 20:31:04 +00:00
|
|
|
console.log(`- DB Set - Shard: ${client.shard.ids} -`);
|
2020-02-05 20:02:53 +00:00
|
|
|
client.user.setActivity(`@${client.user.username} help | 🎶`, { type: 'LISTENING' });
|
2020-02-13 03:24:30 +00:00
|
|
|
client.user.setStatus('online');
|
2020-02-13 03:38:40 +00:00
|
|
|
const dbl = new DBL(client.config.dblKey, client);
|
2020-02-05 20:02:53 +00:00
|
|
|
if (client.config.dblApi && !client.config.devMode) {
|
2020-02-27 06:32:06 +00:00
|
|
|
dbl.on('posted', () => {
|
|
|
|
console.log('Server count posted!');
|
|
|
|
});
|
2020-02-05 20:02:53 +00:00
|
|
|
dbl.on('error', error => {
|
|
|
|
console.log('Error with DBL: ' + error);
|
2020-02-27 06:32:06 +00:00
|
|
|
});
|
2020-02-05 20:02:53 +00:00
|
|
|
dbl.postStats(client.guilds.size);
|
|
|
|
}
|
2020-03-13 20:31:04 +00:00
|
|
|
console.log(`- Activated - Shard: ${client.shard.ids} -`);
|
2020-02-05 20:02:53 +00:00
|
|
|
setInterval(async () => {
|
|
|
|
if (client.config.saveDB && !client.config.devMode) {
|
2020-02-12 19:59:36 +00:00
|
|
|
console.log('DB saved');
|
2020-02-19 09:24:26 +00:00
|
|
|
client.guilds.cache.forEach(guild => {
|
2020-02-05 20:02:53 +00:00
|
|
|
client.db.collection('guilds').doc(guild.id).set({
|
|
|
|
prefix: client.global.db.guilds[guild.id].prefix,
|
|
|
|
defaultVolume: client.global.db.guilds[guild.id].defaultVolume,
|
|
|
|
permissions: client.global.db.guilds[guild.id].permissions,
|
|
|
|
dj: client.global.db.guilds[guild.id].dj,
|
|
|
|
djrole: client.global.db.guilds[guild.id].djrole,
|
2020-02-20 20:31:03 +00:00
|
|
|
startPlaying: client.global.db.guilds[guild.id].startPlaying,
|
2020-03-04 21:22:20 +00:00
|
|
|
//bass: client.global.db.guilds[guild.id].bass,
|
2020-02-05 20:02:53 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (client.config.dblApi && !client.config.devMode) dbl.postStats(client.guilds.size);
|
|
|
|
}, 1800000);
|
|
|
|
setInterval(() => {
|
|
|
|
client.funcs.ffmpeg(client, Discord);
|
|
|
|
}, 7200000);
|
|
|
|
}
|
|
|
|
}
|