-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
executable file
·34 lines (32 loc) · 789 Bytes
/
Copy pathapp.js
File metadata and controls
executable file
·34 lines (32 loc) · 789 Bytes
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
const mongoose = require('mongoose');
const config = require('./config.json');
const bot = require('./bot');
const wykopNotifier = require('./wykopNotifier');
const CronJob = require('cron').CronJob;
const mongoHost = `mongodb://${config.DB_USERNAME}:${config.DB_PASS}@${config.DB_HOST}/${config.DB_NAME}`;
mongoose
.connect(mongoHost, {
useNewUrlParser: true,
useCreateIndex: true,
useFindAndModify: false,
useUnifiedTopology: true,
})
.then(async () => {
console.log('DB connected!');
bot();
try {
new CronJob(
'00 00 06 * * *',
() => {
wykopNotifier();
},
null,
true
);
} catch (cronerr) {
console.log('Invalid cron');
}
})
.catch((err) => {
console.log(err);
});