1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-10 05:10:17 +00:00
musix-oss/events/ready.js

18 lines
717 B
JavaScript
Raw Normal View History

2019-09-15 06:18:33 +00:00
module.exports = {
name: 'ready',
async execute(client) {
const remoteMusixGuildsData = await client.funcs.dbget('guilds', null, client);
remoteMusixGuildsData.forEach(guildData => {
client.global.db.musix_guilds[guildData.id] = guildData.d;
});
await client.user.setActivity(`music to ${client.users.size} users!`, { type: 'PLAYING' });
await client.user.setStatus('dnd');
setInterval(async () => {
client.guilds.forEach(guild => {
client.db.collection('guilds').doc(guild.id).set(client.global.db.musix_guilds[guild.id]);
});
client.global.lastDBwrite = Date.now();
}, 1200000);
}
}