/[sudobot]/branches/2.x/src/index.ts
ViewVC logotype

Annotation of /branches/2.x/src/index.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 577 - (hide annotations)
Mon Jul 29 18:52:37 2024 UTC (8 months ago) by rakinar2
File MIME type: application/typescript
File size: 1570 byte(s)
chore: add old version archive branches (2.x to 9.x-dev)
1 rakinar2 577 import { registerCommands, registerEvents } from './utils/registry';
2     import DiscordClient from './client/Client';
3     import { Intents } from 'discord.js';
4     import { config } from 'dotenv';
5     import { existsSync } from 'fs';
6     import path from 'path';
7     import { registrationEnd, registrationStart } from './utils/debug';
8     import { yellow } from './utils/util';
9    
10     if (existsSync(path.join(__dirname, '../.env'))) {
11     config();
12     }
13     else {
14     process.env.ENV = 'prod';
15     }
16    
17     if (process.argv.includes('--prod')) {
18     console.warn(yellow('WARNING: Forcing production mode (--prod option passed)'));
19     process.env.ENV = 'prod';
20     }
21    
22     if (process.argv.includes('--dev')) {
23     console.warn(yellow('WARNING: Forcing development mode (--dev option passed)'));
24     process.env.ENV = 'dev';
25     }
26    
27     const client = new DiscordClient({
28     partials: ["CHANNEL"],
29     intents: [
30     Intents.FLAGS.GUILDS,
31     Intents.FLAGS.GUILD_MESSAGES,
32     Intents.FLAGS.DIRECT_MESSAGES,
33     Intents.FLAGS.DIRECT_MESSAGE_TYPING,
34     Intents.FLAGS.GUILD_PRESENCES,
35     Intents.FLAGS.GUILD_MEMBERS,
36     Intents.FLAGS.GUILD_BANS,
37     Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
38     Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS,
39     ]
40     }, path.resolve(__dirname, '..'));
41    
42     (async () => {
43     await registrationStart();
44     await registerCommands(client, '../commands');
45     await registrationEnd();
46    
47     await registrationStart();
48     await registerEvents(client, '../events');
49     await registrationEnd();
50    
51     await client.login(process.env.TOKEN);
52     await console.log('test');
53     })();

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26