-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.js
43 lines (39 loc) · 1.31 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
const { Client, Collection, Intents } = require("discord.js");
const { token, mongourl } = require("./config.json");
const { Database } = require("quickmongo");
const { commandsHelper } = require("./modules/commandsHelper");
const { Utils, APIs, StringUtils } = require("devtools-ts");
const Utilities = new Utils();
if (!token || !mongourl)
return logger(
"Please add your mongourl and bot token to config.json to start the bot!",
"error"
);
const client = new Client({
intents: [
Intents.FLAGS.GUILD_MEMBERS,
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_VOICE_STATES,
Intents.FLAGS.GUILD_BANS,
],
restRequestTimeout: 30000,
shards: "auto",
});
const { playerEvents } = require("./playerEvents/player");
const { Player } = require("discord-player");
const player = new Player(client);
client.player = player;
client.commands = new Collection();
client.logger = Utilities.logger;
client.db = new Database(mongourl);
client.apis = new APIs();
client.tools = new StringUtils();
// Register everything...
commandsHelper.registerAllCommands(__dirname + "/commands", client);
commandsHelper.registerAllEvents(__dirname + "/events", client);
playerEvents(client.player);
// Connect to DATABASE
Utilities.connectToDataBase(mongourl, client);
// ... and go!
client.login(token);