-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
79 lines (69 loc) · 3.07 KB
/
main.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
70
71
72
73
74
75
76
77
78
79
const Discord = require('discord.js');
const client = new Discord.Client();
const fs = require('fs');
const guild = client.guilds.cache.get("YOUR_GUILD_ID");
client.commands = new Discord.Collection();
require('dotenv').config()
const prefix = "//";
const userName = "foxy";
const status = {
text: "//help",
type: "LISTENING"
}
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
client.once('ready', () => {
console.log('Bot is ready and online!');
});
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/); //for multiple arguments
const command = args.shift().toLowerCase();
if (command === 'ping') { //reads out commands from chat
client.commands.get('ping').execute(message, args);
} else if (command === 'test') {
client.commands.get('test').execute(message, args);
} else if (command === 'deaf' || command === 'd') {
client.commands.get('deaf').execute(message, args);
} else if (command === 'undeaf' || command === 'ud') {
client.commands.get('undeaf').execute(message, args);
} else if (command === 'mute' || command === 'm') {
client.commands.get('mute').execute(message, args);
} else if (command === 'unmute' || command === 'um') {
client.commands.get('unmute').execute(message, args);
} else if (command === 'meme') {
client.commands.get('meme').execute(message, args);
} else if (command === 'cat') {
client.commands.get('cat').execute(message, args);
} else if (command === 'nature') {
client.commands.get('nature').execute(message, args);
} else if (command === 'catfact' || command === 'cat_fact') {
client.commands.get('catfact').execute(message, args);
} else if (command === 'fact') {
client.commands.get('fact').execute(message, args);
} else if (command === 'help' || command === 'info') {
client.commands.get('help').execute(message, args);
} else if (command === 'rps' || command === 'rockpaperscissors') {
client.commands.get('rps').execute(message, args);
} else if (command === 'ttt' || command === 'tictactoe'){
message.channel.send('Tic Tac Toe is my worst enemy :angry:')
// client.commands.get('ttt').execute(message, args);
} else if (command === 'update'){
client.commands.get('update').execute(message, args);
} else if (command === 'strat') {
client.commands.get('strat').execute(message, args);
} else {
message.channel.send('Unknown command! Try **//help**.')
}
})
client.on('ready', async () => {
await client.user.setUsername(userName);
await client.user.setActivity(status.text, {
type: status.type,
});
});
// client.login(process.env.DISCORD_TOKEN); //keep at last line of file
client.login(process.env.TEST_TOKEN); //optional login for test bot