38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import { ButtonInteraction, ModalSubmitInteraction, StringSelectMenuInteraction } from "discord.js";
|
|
|
|
type InteractionHandler = (interaction: any) => Promise<void>;
|
|
|
|
interface InteractionRoute {
|
|
predicate: (interaction: ButtonInteraction | StringSelectMenuInteraction | ModalSubmitInteraction) => boolean;
|
|
handler: () => Promise<any>;
|
|
method: string;
|
|
}
|
|
|
|
export const interactionRoutes: InteractionRoute[] = [
|
|
{
|
|
predicate: (i) => i.customId.startsWith("trade_") || i.customId === "amount",
|
|
handler: () => import("@/modules/trade/trade.interaction"),
|
|
method: 'handleTradeInteraction'
|
|
},
|
|
{
|
|
predicate: (i) => i.isButton() && i.customId.startsWith("shop_buy_"),
|
|
handler: () => import("@/modules/economy/shop.interaction"),
|
|
method: 'handleShopInteraction'
|
|
},
|
|
{
|
|
predicate: (i) => i.isButton() && i.customId.startsWith("lootdrop_"),
|
|
handler: () => import("@/modules/economy/lootdrop.interaction"),
|
|
method: 'handleLootdropInteraction'
|
|
},
|
|
{
|
|
predicate: (i) => i.customId.startsWith("createitem_"),
|
|
handler: () => import("@/modules/admin/item_wizard"),
|
|
method: 'handleItemWizardInteraction'
|
|
},
|
|
{
|
|
predicate: (i) => i.isButton() && i.customId === "enrollment",
|
|
handler: () => import("@/modules/user/enrollment.interaction"),
|
|
method: 'handleEnrollmentInteraction'
|
|
}
|
|
];
|