2023-06-04 01:00:04 +02:00
|
|
|
import { CommandInteractionOptionResolver } from "discord.js"
|
|
|
|
import { ExtendedInteraction } from "../types/commandTypes"
|
|
|
|
import { client } from "../.."
|
|
|
|
import { logger } from "../logger"
|
|
|
|
|
|
|
|
export const name = 'interactionCreate'
|
|
|
|
export async function execute(interaction: ExtendedInteraction) {
|
2023-06-24 21:09:56 +02:00
|
|
|
//console.dir(interaction, { depth: null })
|
|
|
|
if (interaction.isCommand()) {
|
|
|
|
logger.info(`Interaction is a command.`, { guildId: interaction.guild?.id })
|
|
|
|
await interaction.deferReply({ ephemeral: true })
|
|
|
|
const command = client.commands.get(interaction.commandName)
|
|
|
|
if (!command)
|
|
|
|
return interaction.followUp('Invalid command')
|
|
|
|
command.run({
|
|
|
|
args: interaction.options as CommandInteractionOptionResolver,
|
|
|
|
client,
|
|
|
|
interaction
|
|
|
|
})
|
|
|
|
}
|
2023-06-04 01:00:04 +02:00
|
|
|
}
|