-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
50 lines (39 loc) · 1.39 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
const fs = require('fs');
const Discord = require('discord.js');
const config = require('./config.json');
const client = new Discord.Client(
{ intents: ["GUILD_MESSAGES", "GUILD_MEMBERS", "GUILDS"] }
);
const commands = {};
fs.readdirSync('./commands')
.filter(file => file.endsWith('.js'))
.forEach(file => {
const command = require(`./commands/${file}`);
commands[command.name] = command.execute;
});
client.on('ready', () => {
console.log('Have you seen the movie Hackers?');
});
client.login(config.TOKEN);
let messageBuffer = new Array(10);
client.on('messageCreate', async message => {
if (message.author.bot) { return; }
if (config.DEBUG) {
console.log(message.content);
}
if (message.content.startsWith(config.PREFIX)) {
const args = message.content.slice(config.PREFIX.length).split(" ");
const command = args.shift().toLowerCase();
if (commands[command]) {
if (config.DEBUG) {
console.log("Command: " + command);
}
if (!commands[command](message, args, messageBuffer)) {
message.reply("OOPSIE WOOPSIE!! Uwu We made a fucky wucky!! A wittle fucko boingo! The code monkeys at our headquarters are working VEWY HAWD to fix this!")
}
}
} else {
messageBuffer.push(message.content);
messageBuffer.shift();
}
});