discord_allnight/events/interactionCreate.js

16 lines
397 B
JavaScript

import pingCommand from '../commands/ping.js';
import colorCommand from '../commands/color.js';
const commands = {
ping: pingCommand,
color: colorCommand,
};
export default async function interactionCreateEvent(interaction) {
if (!interaction.isChatInputCommand()) return;
const command = commands[interaction.commandName];
if (command) {
await command.execute(interaction);
}
}