1
1
mirror of https://github.com/Burn-E99/GroupUp.git synced 2026-06-04 08:53:49 -04:00

Finish most of the create event

This commit is contained in:
Ean Milligan (Bastion)
2023-02-02 21:33:27 -05:00
parent d5f0b08e08
commit 8c6a3749df
9 changed files with 167 additions and 41 deletions

View File

@@ -1,6 +1,7 @@
import { Bot, BotWithCache, Interaction } from '../../deps.ts';
import { buttons } from '../buttons/_index.ts';
import { commands } from '../commands/_index.ts';
import { idSeparator } from '../buttons/event-creation/utils.ts'
const commandNames: Array<string> = commands.map((command) => command.details.name);
const buttonNames: Array<string> = buttons.map((button) => button.customId);
@@ -14,13 +15,14 @@ export const interactionCreate = (rawBot: Bot, interaction: Interaction) => {
return;
}
const customId = interaction.data.customId ? interaction.data.customId.replace(/\$/g, '') : '';
const tempCustomId = interaction.data.customId ? interaction.data.customId.replace(/\$/g, '') : '';
const customId = tempCustomId.split(idSeparator)[0] || '';
if (customId && buttonNames.includes(customId)) {
const btnIdx = buttonNames.indexOf(customId);
buttons[btnIdx].execute(bot, interaction);
return;
}
console.log('interaction NOT HANDLED');
console.log('interaction NOT HANDLED', interaction);
}
};