1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-12 23:20:17 +00:00
musix-oss/src/funcs/checkDB.js
2024-02-10 09:33:59 +02:00

52 lines
2.2 KiB
JavaScript

module.exports = async function (client) {
client.guilds.cache.forEach((guild) => {
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,
autoPlay: client.config.autoPlay,
});
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,
autoPlay: client.config.autoPlay,
};
return;
}
if (!client.global.db.guilds[guild.id].prefix)
client.global.db.guilds[guild.id].prefix = client.config.prefix;
if (!client.global.db.guilds[guild.id].defaultVolume)
client.global.db.guilds[guild.id].defaultVolume =
client.config.defaultVolume;
if (!client.global.db.guilds[guild.id].permissions)
client.global.db.guilds[guild.id].permissions = client.config.permissions;
if (!client.global.db.guilds[guild.id].dj)
client.global.db.guilds[guild.id].dj = client.config.dj;
if (!client.global.db.guilds[guild.id].djrole)
client.global.db.guilds[guild.id].djrole = client.config.djrole;
if (!client.global.db.guilds[guild.id].startPlaying)
client.global.db.guilds[guild.id].startPlaying =
client.config.startPlaying;
if (!client.global.db.guilds[guild.id].bass)
client.global.db.guilds[guild.id].bass = client.config.bass;
if (!client.global.db.guilds[guild.id].blacklist)
client.global.db.guilds[guild.id].blacklist = [];
if (!client.global.db.guilds[guild.id].premium)
client.global.db.guilds[guild.id].premium = false;
if (!client.global.db.guilds[guild.id].autoPlay) client.global.db.guilds[guild.id].autoPlay = client.config.autoPlay
});
};