-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrun.js
More file actions
51 lines (47 loc) · 1.38 KB
/
run.js
File metadata and controls
51 lines (47 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const pm2 = require('pm2')
const cron = require('node-cron');
//const fs = require('fs-extra')
pm2.connect((error) => {
if (error) {
console.error(error)
}
pm2.start({ script: 'index.js' }, (error, apps) => {
pm2.disconnect()
if (error) {
console.error(error)
}
})
cron.schedule("*/10 * * * *", function(){
//fs.writeFileSync('./lib/database/user/antispam.json', JSON.stringify([]))
pm2.restart('index', (error) => {
if (error) {
console.error(error)
}
})
console.log('[INFO] Time to restart!');
})
/*cron.schedule("0 0 * * *", function(){
let hitsCount = JSON.parse(fs.readFileSync('./lib/database/bot/hits.json'))
const ResetHitsCount = (_dir) => {
let position = false
Object.keys(_dir).forEach((i) => {
if (_dir[i].id === 'today') {
position = i
}
})
if (position !== false) {
console.log('Reset Hits')
_dir[position].hits = 0
fs.writeFileSync('./lib/database/bot/hits.json', JSON.stringify(_dir))
}
}
ResetHitsCount(hitsCount)
console.log('succes')
pm2.restart('index', (error) => {
if (error) {
console.error(error)
}
})
console.log('[INFO] Time to restart!');
})*/
})