1 |
rakin |
348 |
import 'reflect-metadata'; |
2 |
rakin |
51 |
import { registerCommands, registerEvents } from './utils/registry'; |
3 |
|
|
import DiscordClient from './client/Client'; |
4 |
|
|
import { Intents } from 'discord.js'; |
5 |
|
|
import { config } from 'dotenv'; |
6 |
|
|
import { existsSync } from 'fs'; |
7 |
|
|
import path from 'path'; |
8 |
rakin |
58 |
import { registrationEnd, registrationStart } from './utils/debug'; |
9 |
|
|
import { yellow } from './utils/util'; |
10 |
rakin |
51 |
|
11 |
|
|
if (existsSync(path.join(__dirname, '../.env'))) { |
12 |
|
|
config(); |
13 |
|
|
} |
14 |
|
|
else { |
15 |
|
|
process.env.ENV = 'prod'; |
16 |
|
|
} |
17 |
|
|
|
18 |
rakin |
58 |
if (process.argv.includes('--prod')) { |
19 |
|
|
console.warn(yellow('WARNING: Forcing production mode (--prod option passed)')); |
20 |
|
|
process.env.ENV = 'prod'; |
21 |
|
|
} |
22 |
|
|
|
23 |
|
|
if (process.argv.includes('--dev')) { |
24 |
|
|
console.warn(yellow('WARNING: Forcing development mode (--dev option passed)')); |
25 |
|
|
process.env.ENV = 'dev'; |
26 |
|
|
} |
27 |
|
|
|
28 |
rakin |
66 |
const client = new DiscordClient({ |
29 |
|
|
partials: ["CHANNEL"], |
30 |
|
|
intents: [ |
31 |
|
|
Intents.FLAGS.GUILDS, |
32 |
|
|
Intents.FLAGS.GUILD_MESSAGES, |
33 |
|
|
Intents.FLAGS.DIRECT_MESSAGES, |
34 |
|
|
Intents.FLAGS.DIRECT_MESSAGE_TYPING, |
35 |
|
|
Intents.FLAGS.GUILD_PRESENCES, |
36 |
|
|
Intents.FLAGS.GUILD_MEMBERS, |
37 |
|
|
Intents.FLAGS.GUILD_BANS, |
38 |
|
|
Intents.FLAGS.GUILD_MESSAGE_REACTIONS, |
39 |
|
|
Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS, |
40 |
|
|
] |
41 |
|
|
}, path.resolve(__dirname, '..')); |
42 |
|
|
|
43 |
rakin |
51 |
(async () => { |
44 |
rakin |
58 |
await registrationStart(); |
45 |
rakin |
51 |
await registerCommands(client, '../commands'); |
46 |
rakin |
58 |
await registrationEnd(); |
47 |
|
|
|
48 |
|
|
await registrationStart(); |
49 |
rakin |
51 |
await registerEvents(client, '../events'); |
50 |
rakin |
58 |
await registrationEnd(); |
51 |
|
|
|
52 |
rakin |
67 |
await client.login(process.env.TOKEN); |
53 |
rakin |
241 |
await console.log('test'); |
54 |
rakin |
51 |
})(); |