-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
38 lines (28 loc) · 1.27 KB
/
index.ts
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 Discord from 'discord.js';
import SuperClient from './extensions/super_client';
import { prefix } from './extensions/preferences.json';
require('dotenv').config();
console.log('\n');
const client = new SuperClient();
client.once('ready', () => {
console.log('\n ❱❱ Online. \n');
client.user!.setPresence({ activities: [{
name: 'the sky',
type: 'WATCHING'
}], status: 'dnd' });
});
client.commands = new Discord.Collection();
client.aliases = new Discord.Collection();
import Handler from './extensions/command_handler';
Handler(client);
client.on('messageCreate', async (message) => {
if ((message.content.split(' '))[0] === `<@${client.user!.id}>`)
message.channel.send(`\`⚡ Lightyear's prefix is "${prefix}".\``);
if (message.author.bot || !message.guild || !message.content.startsWith(prefix))
return;
const args = message.content.substring(prefix.length).split(" ");
const cmd = client.commands.get(args[0].toLowerCase())
|| client.commands.get(client.aliases.get(args[0].toLowerCase()));
if(cmd) cmd.default.run(client, message, args.slice(1));
})
client.login(process.env.TOKEN);