generated from FnrDev/fnr-template
-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.js
33 lines (29 loc) · 921 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
const Discord = require('discord.js');
const client = new Discord.Client({ intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_MEMBERS'] });
const mysql = require('mysql-database');
const database = new mysql();
client.commands = new Discord.Collection();
client.slash = new Discord.Collection();
client.aliases = new Discord.Collection();
require('dotenv').config();
require('colors');
['hanlders', 'events'].forEach(handler => {
require(`./handlers/${handler}`)(client);
});
(async () => {
const db = await database.connect({
host: process.env.HOST,
port: process.env.PORT,
user: process.env.USER,
database: process.env.DATABASE
});
client.db = db;
db.on('connected', () => {
console.log(`[DataBase] DataBase Connected.`.green);
});
db.create("tickets");
db.create("config");
db.create("blacklist");
})();
process.on('unhandledRejection', console.log)
client.login(process.env.TOKEN);