-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
61 lines (52 loc) · 1.65 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const express = require('express')
const app = express();
const port = 3000
app.get('/', (req, res) => res.send('Join for help https://discord.gg/gdsdWZZZpy'))
app.listen(port, () =>
console.log(`Your app is listening a http://localhost:${port}`)
);
const discord = require("discord.js");
const client = new discord.Client({
disableEveryone: true,
});
module.exports=client
const { Database } = require("quickmongo");
require("discord-buttons")(client);
client.config = require("./config.json");
client.prefix = client.config.default_prefix;
client.db = new Database(client.config.DB);
client.formatDuration = require("./utility/formatDuration");
require("./utility/Player");
client.commands = new discord.Collection();
client.aliases = new discord.Collection();
client.colors = require("./utility/colors");
client.embeds = require("./utility/embeds");
require("dotenv").config();
["commands", "events"].forEach((handler) => {
require(`./handlers/${handler}`)(client);
});
client.db.on("ready", () => {
console.log("MONGODB CONNECTED");
});
const mongoose = require("mongoose");
const dbOptions = {
useNewUrlParser: true,
autoIndex: false,
poolSize: 5,
connectTimeoutMS: 10000,
family: 4,
useUnifiedTopology: true,
};
mongoose.connect(client.config.DB, dbOptions);
mongoose.set("useFindAndModify", false);
mongoose.Promise = global.Promise;
mongoose.connection.on("connected", () => {
console.log("[DB] DATABASE CONNECTED");
});
mongoose.connection.on("err", (err) => {
console.log(`Mongoose connection error: \n ${err.stack}`);
});
mongoose.connection.on("disconnected", () => {
console.log("Mongoose disconnected");
});
client.login(process.env.TOKEN);