mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 04:10:59 -05:00
Add new switch for dailyMsgs operation
This commit is contained in:
parent
283f5a622a
commit
ebe4607029
@ -16,6 +16,7 @@
|
||||
"message": "1023699243183112192"
|
||||
},
|
||||
"botSwitches": {
|
||||
"dailyMsgsBackup": true,
|
||||
"registerCommands": true,
|
||||
"commands": true,
|
||||
"logs": true,
|
||||
|
@ -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<number>)=>x[0] === formattedDate)){
|
||||
if (client.config.botSwitches.dailyMsgsBackup && !dailyMsgs.some((x:Array<number>)=>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<number>)=>x[0] === formattedDate - 1);
|
||||
if (total < yesterday) total = yesterday // messages went down.
|
||||
|
1
src/typings/interfaces.d.ts
vendored
1
src/typings/interfaces.d.ts
vendored
@ -141,6 +141,7 @@ export interface Config {
|
||||
message: string
|
||||
},
|
||||
botSwitches: {
|
||||
dailyMsgsBackup: boolean,
|
||||
registerCommands: boolean,
|
||||
commands: boolean,
|
||||
logs: boolean,
|
||||
|
Loading…
Reference in New Issue
Block a user