1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-14 03:30:18 +00:00
musix-oss/src/funcs/checkDB.js

52 lines
2.2 KiB
JavaScript
Raw Normal View History

2020-03-21 17:49:25 +00:00
module.exports = async function (client) {
2020-04-19 17:00:16 +00:00
client.guilds.cache.forEach((guild) => {
2020-06-04 05:26:33 +00:00
if (!client.global.db.guilds[guild.id]) {
client.db.collection("guilds").doc(guild.id).set({
prefix: client.config.prefix,
defaultVolume: client.config.defaultVolume,
permissions: client.config.permissions,
dj: client.config.dj,
djrole: client.config.djrole,
startPlaying: client.config.startPlaying,
bass: client.config.bass,
blacklist: [],
premium: false,
2020-06-30 18:08:18 +00:00
autoPlay: client.config.autoPlay,
2020-06-04 05:26:33 +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,
startPlaying: client.config.startPlaying,
bass: client.config.bass,
blacklist: [],
premium: false,
2020-06-30 18:08:18 +00:00
autoPlay: client.config.autoPlay,
2020-06-04 05:26:33 +00:00
};
return;
}
2020-06-30 17:43:00 +00:00
if (!client.global.db.guilds[guild.id].prefix)
2020-04-19 17:00:16 +00:00
client.global.db.guilds[guild.id].prefix = client.config.prefix;
2020-06-30 17:43:00 +00:00
if (!client.global.db.guilds[guild.id].defaultVolume)
2020-04-19 17:00:16 +00:00
client.global.db.guilds[guild.id].defaultVolume =
2020-06-04 05:26:33 +00:00
client.config.defaultVolume;
2020-06-30 17:43:00 +00:00
if (!client.global.db.guilds[guild.id].permissions)
2020-04-19 17:00:16 +00:00
client.global.db.guilds[guild.id].permissions = client.config.permissions;
2020-06-30 17:43:00 +00:00
if (!client.global.db.guilds[guild.id].dj)
2020-04-19 17:00:16 +00:00
client.global.db.guilds[guild.id].dj = client.config.dj;
2020-06-30 17:43:00 +00:00
if (!client.global.db.guilds[guild.id].djrole)
2020-04-19 17:00:16 +00:00
client.global.db.guilds[guild.id].djrole = client.config.djrole;
2020-06-30 17:43:00 +00:00
if (!client.global.db.guilds[guild.id].startPlaying)
2020-04-19 17:00:16 +00:00
client.global.db.guilds[guild.id].startPlaying =
2020-06-04 05:26:33 +00:00
client.config.startPlaying;
2020-06-30 17:43:00 +00:00
if (!client.global.db.guilds[guild.id].bass)
2020-04-19 17:00:16 +00:00
client.global.db.guilds[guild.id].bass = client.config.bass;
2020-06-30 22:49:34 +00:00
if (!client.global.db.guilds[guild.id].blacklist)
2020-04-19 17:00:16 +00:00
client.global.db.guilds[guild.id].blacklist = [];
2020-06-30 17:43:00 +00:00
if (!client.global.db.guilds[guild.id].premium)
2020-04-19 17:34:38 +00:00
client.global.db.guilds[guild.id].premium = false;
2020-06-30 18:08:18 +00:00
if (!client.global.db.guilds[guild.id].autoPlay) client.global.db.guilds[guild.id].autoPlay = client.config.autoPlay
2020-04-19 17:00:16 +00:00
});
2020-06-04 05:26:33 +00:00
};