style: run format:apply
This commit is contained in:
+15
-14
@@ -18,6 +18,7 @@ import {
|
|||||||
import { Logger } from './utils/log';
|
import { Logger } from './utils/log';
|
||||||
import { config } from './utils/config';
|
import { config } from './utils/config';
|
||||||
import { Bot } from './bot';
|
import { Bot } from './bot';
|
||||||
|
import { isModule } from './utils/misc';
|
||||||
|
|
||||||
export interface Command {
|
export interface Command {
|
||||||
name?: string;
|
name?: string;
|
||||||
@@ -51,8 +52,8 @@ export class CommandManager {
|
|||||||
private categories: Array<CommandCategory> = [];
|
private categories: Array<CommandCategory> = [];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public
|
public
|
||||||
*/
|
*/
|
||||||
public constructor(cmdFolder: string) {
|
public constructor(cmdFolder: string) {
|
||||||
this.folderPath = path.resolve(__dirname, cmdFolder);
|
this.folderPath = path.resolve(__dirname, cmdFolder);
|
||||||
this.log = new Logger('Command manager');
|
this.log = new Logger('Command manager');
|
||||||
@@ -95,8 +96,8 @@ export class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
internal
|
internal
|
||||||
*/
|
*/
|
||||||
private async populateCommands() {
|
private async populateCommands() {
|
||||||
if (!fs.existsSync(this.folderPath))
|
if (!fs.existsSync(this.folderPath))
|
||||||
throw new Error(`Command directory not found: ${this.folderPath}`);
|
throw new Error(`Command directory not found: ${this.folderPath}`);
|
||||||
@@ -176,8 +177,8 @@ export class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
cmd parsing
|
cmd parsing
|
||||||
*/
|
*/
|
||||||
private async attemptLoadCommand(filePath: string): Promise<Command | null> {
|
private async attemptLoadCommand(filePath: string): Promise<Command | null> {
|
||||||
try {
|
try {
|
||||||
const module = await import(`file://${filePath}`);
|
const module = await import(`file://${filePath}`);
|
||||||
@@ -193,8 +194,8 @@ export class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
misc functions
|
misc functions
|
||||||
*/
|
*/
|
||||||
private async registerSlashCommands(): Promise<void> {
|
private async registerSlashCommands(): Promise<void> {
|
||||||
this.log.info('Registering slash commands...');
|
this.log.info('Registering slash commands...');
|
||||||
|
|
||||||
@@ -219,8 +220,8 @@ export class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
interaction handling
|
interaction handling
|
||||||
*/
|
*/
|
||||||
private async executeCommandInteraction(
|
private async executeCommandInteraction(
|
||||||
interaction: ChatInputCommandInteraction
|
interaction: ChatInputCommandInteraction
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
@@ -295,12 +296,12 @@ export class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
event listeners
|
event listeners
|
||||||
*/
|
*/
|
||||||
private async onInteraction(interaction: BaseInteraction): Promise<void> {
|
private async onInteraction(interaction: BaseInteraction): Promise<void> {
|
||||||
/*
|
/*
|
||||||
cmd execution
|
cmd execution
|
||||||
*/
|
*/
|
||||||
if (interaction.isChatInputCommand())
|
if (interaction.isChatInputCommand())
|
||||||
return this.executeCommandInteraction(interaction);
|
return this.executeCommandInteraction(interaction);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user