/[sudobot]/trunk/src/index.ts
ViewVC logotype

Diff of /trunk/src/index.ts

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 51 by rakin, Mon Jul 29 17:28:23 2024 UTC revision 66 by rakin, Mon Jul 29 17:28:27 2024 UTC
# Line 4  import { Intents } from 'discord.js'; Line 4  import { Intents } from 'discord.js';
4  import { config } from 'dotenv';  import { config } from 'dotenv';
5  import { existsSync } from 'fs';  import { existsSync } from 'fs';
6  import path from 'path';  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({  const client = new DiscordClient({
28      partials: ["CHANNEL"],      partials: ["CHANNEL"],
# Line 20  const client = new DiscordClient({ Line 39  const client = new DiscordClient({
39      ]      ]
40  }, path.resolve(__dirname, '..'));  }, path.resolve(__dirname, '..'));
41    
 if (existsSync(path.join(__dirname, '../.env'))) {  
     config();  
 }  
 else {  
     process.env.ENV = 'prod';  
 }  
   
42  (async () => {  (async () => {
43        await registrationStart();
44      await registerCommands(client, '../commands');      await registerCommands(client, '../commands');
45        await registrationEnd();
46        
47        await registrationStart();
48      await registerEvents(client, '../events');      await registerEvents(client, '../events');
49        await registrationEnd();
50        
51      await client.login(process.env.token);      await client.login(process.env.token);
52  })();  })();

Legend:
Removed from v.51  
changed lines
  Added in v.66

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26