-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
44 lines (38 loc) · 1.08 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
39
40
41
42
43
44
import { Client, GatewayIntentBits, Partials, Collection } from 'discord.js';
import chalk from 'chalk';
import { eventHandler } from './src/handlers/event';
import { slashHandler } from './src/handlers/slash';
import { env } from './env';
import { prefixHandler } from './src/handlers/message';
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
partials: [
Partials.User,
Partials.Message,
Partials.GuildMember,
Partials.ThreadMember,
Partials.Channel,
],
});
// ! Modify discord.d.ts if you want to add more collections
client.slashCommands = new Collection();
client.prefixCommands = new Collection();
client.aliasCommands = new Collection();
console.log(chalk.magenta('Discord Bot Template'));
client
.login(env.DISCORD_TOKEN)
.then(() => {
console.log(chalk.magenta('Loading...'));
eventHandler(client);
slashHandler(client);
prefixHandler(client);
})
.catch(err => {
console.error(chalk.red('Failed to login: '), err);
});
export { client };