1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 00:10:58 -05:00

Automate the dailyMsgs backup

This commit is contained in:
AnxietyisReal 2023-07-07 15:54:48 +10:00
parent dd251cef9b
commit f589ddc9ec

View File

@ -90,6 +90,7 @@ setInterval(async()=>{
dailyMsgs.push([formattedDate, total]); dailyMsgs.push([formattedDate, total]);
writeFileSync('./src/database/dailyMsgs.json', JSON.stringify(dailyMsgs)) writeFileSync('./src/database/dailyMsgs.json', JSON.stringify(dailyMsgs))
console.log(client.logTime(), `Pushed [${formattedDate}, ${total}] to dailyMsgs`); console.log(client.logTime(), `Pushed [${formattedDate}, ${total}] to dailyMsgs`);
client.guilds.cache.get(client.config.mainServer.id).commands.fetch().then((commands)=>(client.channels.resolve(client.config.mainServer.channels.logs) as Discord.TextChannel).send(`:pencil: Pushed \`[${formattedDate}, ${total}]\` to </rank leaderboard:${commands.find(x=>x.name == 'rank').id}>`)) client.guilds.cache.get(client.config.mainServer.id).commands.fetch().then(commands=>(client.channels.resolve(client.config.mainServer.channels.logs) as Discord.TextChannel).send(`:pencil: Pushed \`[${formattedDate}, ${total}]\` to </rank leaderboard:${commands.find(x=>x.name === 'rank').id}>`));
(client.channels.resolve(client.config.mainServer.channels.thismeanswar) as Discord.TextChannel).send({files:['./database/dailyMsgs.json']}).catch(fileErr=>console.log(fileErr))
} }
}, 5000) }, 5000)