mirror of
https://github.com/ahmadk953/poixpixel-discord-bot.git
synced 2025-06-07 15:39:30 +00:00
Added Warn and Ban Commands, Added Logging, and Much More
This commit is contained in:
parent
d89de72e08
commit
86adac3f08
33 changed files with 2200 additions and 204 deletions
38
src/events/interactionCreate.ts
Normal file
38
src/events/interactionCreate.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
import { Events, Interaction } from 'discord.js';
|
||||
import { ExtendedClient } from '../structures/ExtendedClient.js';
|
||||
|
||||
export default {
|
||||
name: Events.InteractionCreate,
|
||||
execute: async (interaction: Interaction) => {
|
||||
if (!interaction.isCommand()) return;
|
||||
|
||||
const client = interaction.client as ExtendedClient;
|
||||
const command = client.commands.get(interaction.commandName);
|
||||
|
||||
if (!command) {
|
||||
console.error(
|
||||
`No command matching ${interaction.commandName} was found.`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await command.execute(interaction);
|
||||
} catch (error) {
|
||||
console.error(`Error executing ${interaction.commandName}`);
|
||||
console.error(error);
|
||||
|
||||
if (interaction.replied || interaction.deferred) {
|
||||
await interaction.followUp({
|
||||
content: 'There was an error while executing this command!',
|
||||
flags: ['Ephemeral'],
|
||||
});
|
||||
} else {
|
||||
await interaction.reply({
|
||||
content: 'There was an error while executing this command!',
|
||||
flags: ['Ephemeral'],
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue