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:
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user