blob: 0f7cb497c868456257790fdcb8d8df498bb7858a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import {InteractionManager} from "./InteractionManager";
import {CommandInteraction} from "discord.js";
import {LogManager} from "./LogManager";
import {CommandsLoader} from "./CommandsLoader";
import {CommandAction} from "./CommandAction";
export class CommandInteractionManager extends InteractionManager {
public static commands = new CommandsLoader().getCommands();
constructor(interaction: CommandInteraction) {
super();
LogManager.verbose("CommandInteractionManager: " + interaction.commandName);
if (Object.keys(CommandInteractionManager.commands).includes(interaction.commandName)) {
CommandInteractionManager.commands[interaction.commandName].handle(new CommandAction(interaction.commandName, interaction));
} else {
LogManager.error("Command not found: " + interaction.commandName);
interaction.reply(":x: Command not found: `" + interaction.commandName + "`, this is most likely a bug.");
}
}
}
|