[go: up one dir, main page]

Menu

[7e998b]: / src / index.ts  Maximize  Restore  History

Download this file

53 lines (46 with data), 1.6 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { registerCommands, registerEvents } from './utils/registry';
import DiscordClient from './client/Client';
import { Intents } from 'discord.js';
import { config } from 'dotenv';
import { existsSync } from 'fs';
import path from 'path';
import { registrationEnd, registrationStart } from './utils/debug';
import { yellow } from './utils/util';
if (existsSync(path.join(__dirname, '../.env'))) {
config();
}
else {
process.env.ENV = 'prod';
}
if (process.argv.includes('--prod')) {
console.warn(yellow('WARNING: Forcing production mode (--prod option passed)'));
process.env.ENV = 'prod';
}
if (process.argv.includes('--dev')) {
console.warn(yellow('WARNING: Forcing development mode (--dev option passed)'));
process.env.ENV = 'dev';
}
const client = new DiscordClient({
partials: ["CHANNEL"],
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.DIRECT_MESSAGES,
Intents.FLAGS.DIRECT_MESSAGE_TYPING,
Intents.FLAGS.GUILD_PRESENCES,
Intents.FLAGS.GUILD_MEMBERS,
Intents.FLAGS.GUILD_BANS,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS,
]
}, path.resolve(__dirname, '..'));
(async () => {
await registrationStart();
await registerCommands(client, '../commands');
await registrationEnd();
await registrationStart();
await registerEvents(client, '../events');
await registrationEnd();
await client.login(process.env.TOKEN);
await console.log('test');
})();