From 97ecf6fa0f69a54cb8a473779bd06ff06a2eb9fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Fri, 3 May 2024 20:13:21 +0200 Subject: [PATCH] fix: use application command instead slash command --- src/commands/docs.tsx | 14 +++++++++----- src/commands/github.tsx | 10 +++++----- src/commands/ping.tsx | 8 ++++---- src/commands/tag.tsx | 14 +++++++++----- src/commands/version.tsx | 8 ++++---- 5 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/commands/docs.tsx b/src/commands/docs.tsx index 76fb832..2b99114 100644 --- a/src/commands/docs.tsx +++ b/src/commands/docs.tsx @@ -1,5 +1,9 @@ -import { ApplicationCommand, StringOption, UserOption } from "@lilybird/jsx"; -import { SlashCommand } from "@lilybird/handlers"; +import { + ApplicationCommand as JSXApplicationCommand, + StringOption, + UserOption, +} from "@lilybird/jsx"; +import { ApplicationCommand } from "@lilybird/handlers"; import algoliasearch from "algoliasearch"; // @ts-expect-error It is callable, but algolia for some reason has a namespace with the same name @@ -12,7 +16,7 @@ const algoliaIndex = algoliaClient.initIndex("bun"); export default { post: "GLOBAL", data: ( - + - + ), autocomplete: async (interaction) => { const query = interaction.data.getFocused().value; @@ -77,7 +81,7 @@ export default { // } }); }, -} satisfies SlashCommand; +} satisfies ApplicationCommand; function getHitName(hit: any) { const type = hit.hierarchy.lvl0 === "Documentation" ? "πŸ“–" : "πŸ—ΊοΈ"; diff --git a/src/commands/github.tsx b/src/commands/github.tsx index 2a7acd1..0d0f3d7 100644 --- a/src/commands/github.tsx +++ b/src/commands/github.tsx @@ -1,10 +1,10 @@ import { - ApplicationCommand, + ApplicationCommand as JSXApplicationCommand, BooleanOption, CommandOptions, StringOption, } from "@lilybird/jsx"; -import { SlashCommand } from "@lilybird/handlers"; +import { ApplicationCommand } from "@lilybird/handlers"; import { safeSlice, silently } from "../util.ts"; type State = @@ -40,7 +40,7 @@ interface Item { export default { post: "GLOBAL", data: ( - @@ -72,7 +72,7 @@ export default { - + ), run: async (interaction) => { const hide = interaction.data.getBoolean("hide") ?? false; @@ -124,7 +124,7 @@ export default { ) ); }, -} satisfies SlashCommand; +} satisfies ApplicationCommand; function stateToText(item: Item) { switch (item.emoji.state) { diff --git a/src/commands/ping.tsx b/src/commands/ping.tsx index 922c986..7bcdc0a 100644 --- a/src/commands/ping.tsx +++ b/src/commands/ping.tsx @@ -1,9 +1,9 @@ -import { ApplicationCommand } from "@lilybird/jsx"; -import { SlashCommand } from "@lilybird/handlers"; +import { ApplicationCommand as JSXApplicationCommand } from "@lilybird/jsx"; +import { ApplicationCommand } from "@lilybird/handlers"; export default { post: "GLOBAL", - data: , + data: , run: async (interaction) => { await interaction.deferReply(); @@ -13,4 +13,4 @@ export default { content: `πŸ“ WebSocket: \`${ws}ms\` | Rest: \`${rest}ms\``, }); }, -} satisfies SlashCommand; +} satisfies ApplicationCommand; diff --git a/src/commands/tag.tsx b/src/commands/tag.tsx index e1d81c1..24f6b1d 100644 --- a/src/commands/tag.tsx +++ b/src/commands/tag.tsx @@ -1,11 +1,15 @@ -import { ApplicationCommand, StringOption, UserOption } from "@lilybird/jsx"; +import { + ApplicationCommand as JSXApplicationCommand, + StringOption, + UserOption, +} from "@lilybird/jsx"; import { getTags, searchTag } from "../loaders/tags.ts"; -import { SlashCommand } from "@lilybird/handlers"; +import { ApplicationCommand } from "@lilybird/handlers"; export default { post: "GLOBAL", data: ( - + - + ), run: async (interaction) => { if (!interaction.inGuild()) return; @@ -51,4 +55,4 @@ export default { return await interaction.showChoices(getTags(interaction.channel, 25)); }, -} satisfies SlashCommand; +} satisfies ApplicationCommand; diff --git a/src/commands/version.tsx b/src/commands/version.tsx index 2a79a43..d873f63 100644 --- a/src/commands/version.tsx +++ b/src/commands/version.tsx @@ -5,12 +5,12 @@ import { LILYBIRD_HANDLERS_VERSION, LILYBIRD_JSX_VERSION, } from "../constants.ts"; -import { ApplicationCommand } from "@lilybird/jsx"; -import { SlashCommand } from "@lilybird/handlers"; +import { ApplicationCommand as JSXApplicationCommand } from "@lilybird/jsx"; +import { ApplicationCommand } from "@lilybird/handlers"; export default { post: "GLOBAL", - data: , + data: , run: (interaction) => { interaction.reply({ content: [ @@ -26,4 +26,4 @@ export default { ephemeral: true, }); }, -} satisfies SlashCommand; +} satisfies ApplicationCommand;