forked from Snzy027/Uptimer-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
42 lines (38 loc) · 890 Bytes
/
index.js
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
const discord = require('discord.js');
const bot = new discord.Client();
const mongoose = require('mongoose');
const chalk = require('chalk');
const claudette = require('./module/links.js');
const fetch = require('node-fetch');
const config = require('./config.json');
mongoose
.connect(
config.mongodb,
{
useNewUrlParser: true,
useUnifiedTopology: true,
useCreateIndex: true,
useFindAndModify: false,
autoIndex: false
}
)
.then(() => {
console.log(chalk.green('MongoDB Connected'));
})
.catch(a => {
console.log(chalk.red(a));
});
setInterval(function() {
claudette.find({}, function(err, docs) {
if (err) console.log(err);
if (!docs) return;
docs.forEach(docs => {
fetch(docs.link);
});
});
}, 30000);
bot.on('ready', () => {
console.log(chalk.green(bot.user.tag));
});
require('./dashboard/server.js')(bot);
bot.login(process.env.token);