-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
33 lines (29 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
import 'reflect-metadata';
import './lib/Extensions';
import { Client, GatewayIntentBits, Partials } from 'discord.js';
import { Logger } from 'winston';
import { Config } from './lib/Config';
import { bootstrap as bootstrapContainer, container } from './lib/Container';
import { bootstrap as bootstrapEvents } from './lib/Events';
import { Scheduler } from './lib/Jobs/Scheduler';
import { PlayerCleanup } from './lib/Player/PlayerCleanup';
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.MessageContent,
],
partials: [Partials.Channel, Partials.Message, Partials.User],
});
bootstrapContainer(client);
bootstrapEvents(client);
const logger = container.resolve<Logger>('Logger');
client
.login(container.resolve<Config>('Config').discordToken)
.then(() => Scheduler.start())
.then(() => container.resolve(PlayerCleanup).attatch(process))
.catch((error) => {
logger.error('Uncaught initialization error', error);
setTimeout(() => process.exit(1), 1250);
});