Files
illegitimate-bot/src/events/server/interactions/logBtnsCmds.ts
2024-01-18 15:34:55 +01:00

50 lines
1.5 KiB
TypeScript

import { ChatInputCommandInteraction, ButtonInteraction } from "discord.js"
import color from "utils/functions/colors"
import { Event } from "interfaces"
export = {
name: "logBtnsCmds",
description: "Logs all button and command interactions",
event: "interactionCreate",
execute(interaction: ChatInputCommandInteraction | ButtonInteraction) {
if (interaction.isCommand()) {
try {
console.log(
color(
interaction.user.username +
" ran " +
interaction.commandName +
" " +
interaction.options.getSubcommand(),
"pink",
),
)
} catch {
console.log(
color(
interaction.user.username +
" ran " +
interaction.commandName,
"pink",
),
)
}
}
if (interaction.isButton()) {
console.log(
color(
interaction.user.username +
"#" +
interaction.user.discriminator +
" clicked " +
interaction.customId,
"pink",
),
)
return
}
},
} as Event