aboutsummaryrefslogtreecommitdiff
path: root/bot/src/bot.js
blob: 07b13a8b8e6e21a0e9aecf27413ba132766a3e26 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { Client, GatewayIntentBits } from 'discord.js';
import 'dotenv/config';
import { event } from './handlers/event.js';
import { command } from './handlers/command.js';
import { apiServer } from '../api/server.js';

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

command(client).then(() => console.log('[i] Command module loaded'));
event(client).then(() => console.log('[i] Event module loaded'));
apiServer(client);

if (process.argv.indexOf('--beta') === -1) {
    client.login(process.env.abtoken).catch(function() {
        console.log('[X] Login failed. The token that you have put in is invalid.');
        process.exit(0);
    });
} else {
    client.login(process.env.abbtoken).catch(function() {
        console.log('[X] Login failed. The token that you have put in is invalid.');
        process.exit(0);
    });
}