mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-18 00:31:00 -05:00
It's like trying to repair a hole in a car tire.
This commit is contained in:
parent
a86efd78a5
commit
6c34752c0b
@ -66,7 +66,10 @@ setInterval(async()=>{
|
|||||||
if (!dailyMsgs.find(x=>x.dataValues.day === formattedDate)) {
|
if (!dailyMsgs.find(x=>x.dataValues.day === formattedDate)) {
|
||||||
let total = (await client.userLevels.fetchEveryone()).reduce((a,b)=>a + b.messages, 0); // Sum of all users
|
let total = (await client.userLevels.fetchEveryone()).reduce((a,b)=>a + b.messages, 0); // Sum of all users
|
||||||
const yesterday = dailyMsgs.find(x=>x.day === formattedDate - 1)
|
const yesterday = dailyMsgs.find(x=>x.day === formattedDate - 1)
|
||||||
if (total < yesterday?.total) total = yesterday.total; // Messages went down.
|
if (yesterday && total < yesterday.total) Logger.console('log', 'DailyMsgs', `Total messages for day ${formattedDate} is less than total messages for day ${formattedDate - 1}.`);
|
||||||
|
// Update total if it's the same as yesterday's total
|
||||||
|
if (yesterday && total === yesterday.total) total = (await client.userLevels.fetchEveryone()).reduce((a,b)=>a + b.messages, 0); // Recalculate total
|
||||||
|
|
||||||
await client.dailyMsgs.newDay(formattedDate, total);
|
await client.dailyMsgs.newDay(formattedDate, total);
|
||||||
Logger.console('log', 'DailyMsgs', `Pushed [${formattedDate}, ${total}]`)
|
Logger.console('log', 'DailyMsgs', `Pushed [${formattedDate}, ${total}]`)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user