aboutsummaryrefslogtreecommitdiff
path: root/index.ts
blob: 4f00d0599b227a6989f74ee281e19aeefa2b7bee (plain)
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
import { REST } from '@discordjs/rest';
import { Routes } from 'discord-api-types/v9';
import * as fs from 'fs';
import { LogManager } from "./core/LogManager";
import { DJPon3 } from "./core/DJPon3";
import { CommandsLoader } from "./core/CommandsLoader";

const commands = [{
    name: 'ping',
    description: 'Replies with Pong!'
}];

const rest = new REST({ version: '9' }).setToken(fs.readFileSync("token.txt").toString().trim());

(async () => {
    try {
        const commandsLoader = new CommandsLoader();
        LogManager.info('Started refreshing application (/) commands.');

        await rest.put(
            Routes.applicationCommands("974199964978794499"),
            { body: commandsLoader.slashCommands() },
        );

        LogManager.info('Successfully reloaded application (/) commands. Changes may take a while to appear of Discord.');
        LogManager.verbose("Starting Discord bot...");
        new DJPon3();
    } catch (error) {
        console.error(error);
    }
})();