feat: added all buttons to dynamic commands

This commit is contained in:
TresAbhi committed 2023-06-28 18:45:14 +00:00
1 parent dd39563d6d
commit d1d8aad6c7
9 files changed
+157 -57

No files matched your search

@@ -1,11 +1,13 @@
import { ButtonInteraction, CacheType } from 'discord.js';
import { CYCLIC_API } from '../../../constants/cyclic.js';
import normalizeInteractionReturnable from '../../../core/discord/normalizeInteractionReturnable.js';
import { commands } from '../index.js';
export default async function handleButton(
interaction: ButtonInteraction<CacheType>,
) {
const commandName = interaction.customId.split('/')[0];
const url = new URL(`${CYCLIC_API}/${interaction.customId}`);
const commandName = url.pathname.split('/')[1];
const button = commands[commandName]?.button;
if (!button) {