-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
38 lines (32 loc) · 1.28 KB
/
index.js
File metadata and controls
38 lines (32 loc) · 1.28 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
/* Import Modules */
const { Client, Collection } = require('discord.js');
const client = new Client({disableEveryone: true}, { partials: ["MESSAGE", "CHANNEL", "REACTION" ]});
const Discord = require('discord.js')
const chalk = require('chalk')
const config = require('./config.json')
/* Client Collections */
client.commands = new Collection();
client.aliases = new Collection();
["handler"].forEach(handler => {
require(`./handler/${handler}`)(client);
});
/* Ready Event */
client.on('ready', () => {
console.log(chalk.grey("==========================================="))
console.log(chalk.cyan(`[INIT] ${client.user.tag} started`))
client.user.setActivity(`for commands | ${config.prefix}`, { type: "WATCHING"})
})
/* Message Event */
client.on('message', async message => {
if(!message.guild) return;
if(message.author.bot) return;
if(!message.content.startsWith(config.prefix)) return;
let args = message.content.slice(config.prefix.length).trim().split(/ +/g);
let cmd = args.shift().toLowerCase();
if(cmd.length == 0 ) return;
let command = client.commands.get(cmd)
if(!command) command = client.commands.get(client.aliases.get(cmd));
if(command) command.run(client, message, args)
})
/* Login using token */
client.login(config.token)