diff --git a/src/config.json b/src/config.json index e5b9af1..f5e970c 100644 --- a/src/config.json +++ b/src/config.json @@ -16,6 +16,7 @@ "message": "1023699243183112192" }, "botSwitches": { + "dailyMsgsBackup": true, "registerCommands": true, "commands": true, "logs": true, diff --git a/src/index.ts b/src/index.ts index da1c307..db3eb15 100644 --- a/src/index.ts +++ b/src/index.ts @@ -84,7 +84,7 @@ setInterval(async()=>{ const formattedDate = Math.floor((now - client.config.LRSstart)/1000/60/60/24); const dailyMsgs = JSON.parse(readFileSync('./src/database/dailyMsgs.json', {encoding: 'utf8'})) - if (!dailyMsgs.some((x:Array)=>x[0] === formattedDate)){ + if (client.config.botSwitches.dailyMsgsBackup && !dailyMsgs.some((x:Array)=>x[0] === formattedDate)){ let total = (await client.userLevels._content.find({})).reduce((a,b)=>a + b.messages, 0); // sum of all users const yesterday = dailyMsgs.find((x:Array)=>x[0] === formattedDate - 1); if (total < yesterday) total = yesterday // messages went down. diff --git a/src/typings/interfaces.d.ts b/src/typings/interfaces.d.ts index 2979dbc..c59d698 100644 --- a/src/typings/interfaces.d.ts +++ b/src/typings/interfaces.d.ts @@ -141,6 +141,7 @@ export interface Config { message: string }, botSwitches: { + dailyMsgsBackup: boolean, registerCommands: boolean, commands: boolean, logs: boolean,