-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
62 lines (49 loc) · 1.81 KB
/
index.js
File metadata and controls
62 lines (49 loc) · 1.81 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
52
53
54
55
56
57
58
59
60
61
62
const { Client, Message, MessageEmbed, Collection } = require("discord.js");
const mongoose = require("mongoose")
const fs = require("fs");
const db =require("quick.db");
const Db = require("storage.json")
const client = new Client({
messageCacheLifetime: 60,
fetchAllMembers: false,
messageCacheMaxSize: 10,
restTimeOffset: 0,
restWsBridgetimeout: 100,
shards: "auto",
allowedMentions: {
parse: ["roles", "users", "everyone"],
repliedUser: true,
},
partials: ["MESSAGE", "CHANNEL", "REACTION"],
intents: 32767,
});
module.exports = client;
const config = require("./settings/config.json");
// Global Variables
client.commands = new Collection();
client.aliases = new Collection();
client.events = new Collection();
client.cooldowns = new Collection();
client.slashCommands = new Collection();
client.functions = require("./functions.js");
client.categories = fs.readdirSync("./commands/");
// Initializing the project
//Loading files, with the client variable like Command Handler, Event Handler, ...
["command_handler", "event_handler"].forEach((handler) => {
require(`./handlers/${handler}`)(client)
});
// MongoDB Connection
mongoose.connect(config.mongo, {
useNewUrlParser: true,
useUnifiedTopology: true
}).then(() => {
console.log("Connected to Database".green)
let hi = client.functions.successEmbed("Connecting!", "Database Connected")
client.functions.logger("Paste your pvt channel id", hi)//both
}).catch((error) => {
console.log(`Error while connecting to database: ${error}`.red)
//paste your pvt channel id
let hii = client.functions.failEmbed("Connecting!", "Database Connection Failed")
client.functions.logger("paste your pvt channel id", hii)
})
client.login(" paste your bot token"); //paste your bot token