1
1
mirror of https://github.com/Burn-E99/GroupUp.git synced 2026-01-08 04:17:54 -05:00
Files
GroupUp/src/events/interactionCreate.ts
Ean Milligan (Bastion) e0497b8526 slash command system added
2023-01-11 21:21:43 -05:00

17 lines
572 B
TypeScript

import { Bot, BotWithCache, Interaction } from '../../deps.ts';
import { commands } from '../commands/_index.ts';
const commandNames: Array<string> = commands.map((command) => command.details.name);
export const interactionCreate = (rawBot: Bot, interaction: Interaction) => {
const bot = rawBot as BotWithCache;
if (interaction.data && interaction.id) {
if (interaction.data.name) {
if (commandNames.includes(interaction.data.name)) {
const cmdIdx = commandNames.indexOf(interaction.data.name);
commands[cmdIdx].execute(bot, interaction);
}
}
}
};