feat: use cmd manager
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
} from 'discord.js';
|
||||
import { Logger } from './utils/log';
|
||||
import { config } from './utils/config';
|
||||
import { CommandManager } from './commands';
|
||||
|
||||
type BotEventListeners = {
|
||||
messageCreate: (message: Message) => void;
|
||||
@@ -23,6 +24,7 @@ export class Bot {
|
||||
|
||||
private readonly token: string;
|
||||
private readonly clientId: string;
|
||||
private cmdMgr: CommandManager;
|
||||
|
||||
private readonly log: Logger;
|
||||
|
||||
@@ -38,6 +40,7 @@ export class Bot {
|
||||
|
||||
this.token = config.token;
|
||||
this.clientId = config.client_id;
|
||||
this.cmdMgr = new CommandManager('./commands');
|
||||
}
|
||||
|
||||
public async init(): Promise<void> {
|
||||
@@ -46,6 +49,9 @@ export class Bot {
|
||||
if (this.client)
|
||||
throw new Error('Client already exists, was init called twice?');
|
||||
|
||||
this.log.info('Loading commands');
|
||||
await this.cmdMgr.init();
|
||||
|
||||
this.log.info('Instantiating client');
|
||||
this.client = new Client({
|
||||
intents: [
|
||||
|
||||
Reference in New Issue
Block a user