mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: simpler subcommands
This commit is contained in:
1 parent
f965452c5d
commit
78e4c82f20
28 files changed
+397
-461
No files matched your search
@@ -1,6 +1,5 @@
|
||||
import { ButtonInteraction, CacheType } from 'discord.js';
|
||||
import { commands } from '..';
|
||||
import { CYCLIC_API } from '../../../constants/cyclic';
|
||||
import normalizeInteractionReturnable from '../../../core/discord/normalizeInteractionReturnable';
|
||||
import throwError from '../../../core/node/throwError';
|
||||
|
||||
@@ -9,7 +8,7 @@ export default async function handleButton(
|
||||
) {
|
||||
await interaction.deferUpdate();
|
||||
|
||||
const url = new URL(`${CYCLIC_API}/${interaction.customId}`);
|
||||
const url = new URL(`https://example.com/${interaction.customId}`);
|
||||
const commandName = url.pathname.split('/')[1];
|
||||
const button = (await commands)[commandName]?.button;
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ export default async function handleChatInputCommand(
|
||||
) {
|
||||
const registry = (await commands)[interaction.commandName];
|
||||
|
||||
console.log(interaction.toString());
|
||||
await interaction.deferReply();
|
||||
|
||||
try {
|
||||
|
||||
@@ -44,7 +44,8 @@ export type InteractionRawReturnable =
|
||||
| EmbedBuilder
|
||||
| ButtonBuilder
|
||||
| AttachmentBuilder
|
||||
| JSX.Element;
|
||||
| JSX.Element
|
||||
| null;
|
||||
export type InteractionIterableReturnable =
|
||||
| InteractionRawReturnable
|
||||
| InteractionRawReturnable[];
|
||||
|
||||
Reference in new issue
Block a user