-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
41 lines (31 loc) · 1.2 KB
/
index.js
File metadata and controls
41 lines (31 loc) · 1.2 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
const Discord = require('discord.js');
const client = new Discord.Client({ partials: ['MESSAGE', 'CHANNEL', 'REACTION'] });
require('dotenv').config()
const fs = require('fs');
//client.login("Njg1NTQyMzQxNDM1NzE5Njg2.XmKLDg.3G87GK1Y6nFy3gisErOmF_Q_uY0");
client.login(process.env.TOKEN);
client.commands = new Discord.Collection();
fs.readdir("./Commandes/",(error,f) => {
if(error) console.log(error);
let commandes = f.filter(f => f.split(".").pop() === "js");
if(commandes.length <= 0) return console.log("Aucune commande trouvé");
commandes.forEach((f) => {
let commande = require(`./Commandes/${f}`);
console.log(`${f} commandes chargée`);
client.commands.set(commande.help.name, commande);
});
});
fs.readdir("./Events/", (error, f) => {
if(error) console.log(error);
console.log(`${f.length} events en chargement`);
f.forEach((f) =>{
const events = require(`./Events/${f}`);
const event = f.split(".")[0];
client.on(event, events.bind(null, client));
})
})
var http = require('http');
http.createServer(function (req, res) {
res.write("I'm alive");
res.end();
}).listen(8080);