6ce1fdf67d
move to bun workspaces bump zod begin adding fluxer
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import { type CommandsType, Commands } from "commands";
|
|
import config from "config";
|
|
import type { CacheType, ChatInputCommandInteraction, Interaction } from "discord.js";
|
|
import { checkPermission } from "permissions";
|
|
|
|
export class DebugService {
|
|
|
|
async handleInteraction(
|
|
interaction: Interaction<CacheType>
|
|
) {
|
|
if (interaction.isChatInputCommand()) {
|
|
await this.handleChatInputCommand(interaction);
|
|
return;
|
|
}
|
|
|
|
}
|
|
async handleChatInputCommand(interaction: ChatInputCommandInteraction<CacheType>) {
|
|
const commandName = interaction.commandName as CommandsType;
|
|
switch (commandName) {
|
|
case Commands.Enum.version:
|
|
await this.version(interaction);
|
|
return;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
async version(interaction: ChatInputCommandInteraction<CacheType>) {
|
|
try {
|
|
console.log("version command");
|
|
if (await checkPermission(interaction.member) !== true) {
|
|
await interaction.reply({
|
|
content: "du hast keine rechte fuer diesen befehl",
|
|
ephemeral: true,
|
|
});
|
|
return;
|
|
}
|
|
await interaction.reply({
|
|
content: "version: " + config.discord.version,
|
|
});
|
|
|
|
}
|
|
catch (error) {
|
|
console.error("error while sending version msg:", error);
|
|
}
|
|
}
|
|
|
|
} |