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 ) { if (interaction.isChatInputCommand()) { await this.handleChatInputCommand(interaction); return; } } async handleChatInputCommand(interaction: ChatInputCommandInteraction) { const commandName = interaction.commandName as CommandsType; switch (commandName) { case Commands.Enum.version: await this.version(interaction); return; default: break; } } async version(interaction: ChatInputCommandInteraction) { 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); } } }