From cc73cad8ce9415f636da7979b804c8764181b3cd Mon Sep 17 00:00:00 2001 From: hzmi Date: Sun, 5 May 2024 11:23:51 +0000 Subject: [PATCH] fix(Command): fix ApplicationCommand type with @discordjs/builders --- packages/framework/src/Stores/Command.ts | 6 +++--- packages/framework/src/Stores/CommandStore.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/framework/src/Stores/Command.ts b/packages/framework/src/Stores/Command.ts index bf1efff1..70947cec 100644 --- a/packages/framework/src/Stores/Command.ts +++ b/packages/framework/src/Stores/Command.ts @@ -6,7 +6,7 @@ import { Lexer, PrefixedStrategy } from "@sapphire/lexure"; import type { AliasPieceOptions, LoaderPieceContext } from "@sapphire/pieces"; import { AliasPiece } from "@sapphire/pieces"; import type { Awaitable } from "@sapphire/utilities"; -import type { APIApplicationCommandOption } from "discord-api-types/v10"; +import type { APIApplicationCommandOption, RESTPostAPIApplicationCommandsJSONBody } from "discord-api-types/v10"; import { PermissionFlagsBits } from "discord-api-types/v10"; import type { CommandContext } from "../Lib/CommandContext.js"; import type { FlagStrategyOptions } from "../Lib/FlagUnorderedStrategy.js"; @@ -94,8 +94,8 @@ export type CommandOptions = AliasPieceOptions & FlagStrategyOptions & { quotes?: [string, string][]; strategy?: IUnorderedStrategy; preconditions?: PreconditionEntryResolvable[]; - chatInput?: APIApplicationCommandOption; - contextMenu?: APIApplicationCommandOption; + chatInput?: APIApplicationCommandOption | RESTPostAPIApplicationCommandsJSONBody; + contextMenu?: APIApplicationCommandOption | RESTPostAPIApplicationCommandsJSONBody; meta?: CommandMeta; clientPermissions?: { voice?: bigint[]; diff --git a/packages/framework/src/Stores/CommandStore.ts b/packages/framework/src/Stores/CommandStore.ts index 9eb4d1e2..a4d04bee 100644 --- a/packages/framework/src/Stores/CommandStore.ts +++ b/packages/framework/src/Stores/CommandStore.ts @@ -1,5 +1,5 @@ import { AliasStore } from "@sapphire/pieces"; -import type { APIApplicationCommandOption } from "discord-api-types/v10"; +import type { APIApplicationCommandOption, RESTPostAPIApplicationCommandsJSONBody } from "discord-api-types/v10"; import { Routes } from "discord-api-types/v10.js"; import { Events } from "../Utilities/EventEnums.js"; import { Command } from "./Command.js"; @@ -11,7 +11,7 @@ export class CommandStore extends AliasStore { public async postCommands(): Promise { const commands = [...this.values()]; - const registerAbleCommands: APIApplicationCommandOption[] = []; + const registerAbleCommands: (APIApplicationCommandOption | RESTPostAPIApplicationCommandsJSONBody)[] = []; for (const command of commands) { if (command.options.chatInput) {