-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.js
69 lines (51 loc) · 1.62 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const Discord = require('discord.js');
const client = new Discord.Client();
const fs = require('fs');
const config = require('./config.json');
client.config = config;
// Init discord giveaways
const { GiveawaysManager } = require('discord-giveaways');
client.giveawaysManager = new GiveawaysManager(client, {
storage: "./database.json",
updateCountdownEvery: 3000,
default: {
botsCanWin: false,
embedColor: "#FF0000",
reaction: "🎉"
}
});
//Coded by Mukesh
/* Load all events */
fs.readdir("./events/", (_err, files) => {
files.forEach((file) => {
if (!file.endsWith(".js")) return;
const event = require(`./events/${file}`);
let eventName = file.split(".")[0];
console.log(`👌 Event loaded: ${eventName}`);
client.on(eventName, event.bind(null, client));
delete require.cache[require.resolve(`./events/${file}`)];
});
});
client.commands = new Discord.Collection();
/* Load all commands */
fs.readdir("./commands/", (_err, files) => {
files.forEach((file) => {
if (!file.endsWith(".js")) return;
let props = require(`./commands/${file}`);
let commandName = file.split(".")[0];
client.commands.set(commandName, props);
console.log(`👌 Command loaded: ${commandName}`);
});
});
client.on("message", message => {
if(message.content === "prefix") {
message.channel.send("My prefix is {prefix}")
}
})
client.on("message", message => {
if(message.content === "<@789884331245436928>") {
message.channel.send("My prefix is g")
}
})
// Login through the client
client.login(process.env.token);