refactor(events/interaction): now using the new log system
This commit is contained in:
parent
7d76366893
commit
6c3a7587e8
1 changed files with 11 additions and 5 deletions
|
|
@ -1,18 +1,24 @@
|
|||
import { CommandInteraction, Events, Interaction, MessageFlags } from 'discord.js';
|
||||
import {
|
||||
CommandInteraction,
|
||||
Events,
|
||||
Interaction,
|
||||
MessageFlags,
|
||||
} from 'discord.js';
|
||||
import emoji from '../../../assets/emoji.json' assert { type: 'json' };
|
||||
import { log } from '@lib/log';
|
||||
|
||||
export default {
|
||||
name: Events.InteractionCreate,
|
||||
async execute(interaction: Interaction) {
|
||||
if (!interaction.isChatInputCommand()) return;
|
||||
const command: CommandInteraction = interaction.client.commands.get(interaction.commandName);
|
||||
const command: CommandInteraction = interaction.client.commands.get(
|
||||
interaction.commandName,
|
||||
);
|
||||
try {
|
||||
await command.execute(interaction);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(
|
||||
`⚠️ | Error when occured this command ${interaction.commandName}\n\t${err as Error}`,
|
||||
);
|
||||
log.error(err, `Error when occured this command ${interaction.commandName}`);
|
||||
if (interaction.replied || interaction.deferred) {
|
||||
await interaction.followUp({
|
||||
content: `${emoji.answer.error} | ${interaction.commandName} seems have a problem, thanks report that to the support (After Print)`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue