-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
38 lines (32 loc) · 1.19 KB
/
index.js
File metadata and controls
38 lines (32 loc) · 1.19 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
//https://discordapp.com/oauth2/authorize?client_id=422433314347941896&scope=bot&permissions=2146958847
//Consts that make the bot work!
global.Discord = require("discord.js");
const client = new Discord.Client();
global.config = require("./config.js")
global.fs = require("fs");
global.moment = require("moment");
global.SQLite = require("better-sqlite3");
global.ms = require("ms");
global.request = require("request");
global.path = require("path");
global.ytdl = require("ytdl-core");
global.YouTube = require("simple-youtube-api");
const Enmap = require("enmap");
client.settings = new Enmap({name: "settings"});
require("./global/functions.js")(client);
global.bot = client;
//Music stuffs
client.youtube = new YouTube(config.GoogleAPIKey); // YouTube Client
client.queue = new Map() // Music Queue
client.votes = new Map(); // Vote Skip
//Event handler
fs.readdir('./events/', (err, files) => {
files = files.filter(f => f.endsWith('.js'));
files.forEach(f => {
const event = require(`./events/${f}`);
client.on(f.split('.')[0], event.bind(null, client));
delete require.cache[require.resolve(`./events/${f}`)];
});
});
//Allow the bot to log into discord
client.login(config.token);