Updated event layout

This commit is contained in:
2025-01-03 15:46:34 +01:00
parent 02d7178fa2
commit 022694396e
11 changed files with 122 additions and 173 deletions

View File

@@ -0,0 +1,51 @@
import { IEvent } from "~/interfaces"
import { log } from "~/utils/Logger.js"
const event: IEvent<"interactionCreate"> = (interaction) => {
if (interaction.isChatInputCommand()) {
let subcommand: string | null
try {
subcommand = interaction.options.getSubcommand()
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {
subcommand = null
}
if (subcommand) {
log(
interaction.user.username + " ran " +
interaction.commandName + " " +
subcommand,
"info",
{ type: "preset", color: "pink" }
)
} else {
log(
interaction.user.username + " ran " +
interaction.commandName,
"info",
{ type: "preset", color: "pink" }
)
}
}
if (interaction.isButton()) {
const customId = interaction.customId
let btnId: string = ""
if (customId.startsWith("tempbutton-")) {
btnId = customId.split("-")[1]
btnId = btnId.split("-")[0]
}
log(
interaction.user.username + " clicked " + btnId,
"info",
{ type: "preset", color: "pink" }
)
return
}
}
export default event