-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.ts
37 lines (30 loc) · 840 Bytes
/
app.ts
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
import { program } from 'commander';
import sourceMapSupport from 'source-map-support';
import { Bot } from './lib/Bot';
import { isCommand } from './lib/interfaces/ICommandProvider';
sourceMapSupport.install();
const bot = new Bot();
const botSetup = bot.setup();
program.command('run')
.description('Start the bot')
.action(
() => {
bot.logger.info('Connecting to discord...');
void bot.connectToDiscord();
});
program.command('deregister')
.description('Deregister The interactions this bot has registered.')
.action(async () => {
await bot.deregisterInteractions();
});
void botSetup.then(() => {
for (const cogName in bot.loadedCogs) {
const cog = bot.loadedCogs[cogName]
if (isCommand(cog)) {
for (const command of cog.getCommands()) {
program.addCommand(command);
}
}
}
program.parse()
});