From 8d8a5d6b247efe38e83bd2323fe3b5ada35d4697 Mon Sep 17 00:00:00 2001 From: almeidx Date: Fri, 2 Sep 2022 20:02:10 +0100 Subject: [PATCH] fix(SlashCommandBuilder): missing methods in subcommand builder Fixes #8562 --- .../interactions/SlashCommands/SlashCommands.test.ts | 12 ++++++++++++ .../slashCommands/SlashCommandBuilder.ts | 3 +-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/builders/__tests__/interactions/SlashCommands/SlashCommands.test.ts b/packages/builders/__tests__/interactions/SlashCommands/SlashCommands.test.ts index 863dc61b1015..39f3a4546f75 100644 --- a/packages/builders/__tests__/interactions/SlashCommands/SlashCommands.test.ts +++ b/packages/builders/__tests__/interactions/SlashCommands/SlashCommands.test.ts @@ -371,6 +371,18 @@ describe('Slash Commands', () => { ).not.toThrowError(); }); + test('GIVEN builder with subcommand THEN has regular slash command fields', () => { + expect(() => + getBuilder() + .setName('name') + .setDescription('description') + .addSubcommand((option) => option.setName('ye').setDescription('ye')) + .addSubcommand((option) => option.setName('no').setDescription('no')) + .setDMPermission(false) + .setDefaultMemberPermissions(1n), + ).not.toThrowError(); + }); + test('GIVEN builder with already built subcommand group THEN does not throw error', () => { expect(() => getNamedBuilder().addSubcommandGroup(getSubcommandGroup())).not.toThrowError(); }); diff --git a/packages/builders/src/interactions/slashCommands/SlashCommandBuilder.ts b/packages/builders/src/interactions/slashCommands/SlashCommandBuilder.ts index c7b88d094cc5..ffdac17122dd 100644 --- a/packages/builders/src/interactions/slashCommands/SlashCommandBuilder.ts +++ b/packages/builders/src/interactions/slashCommands/SlashCommandBuilder.ts @@ -188,8 +188,7 @@ export class SlashCommandBuilder { export interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {} export interface SlashCommandSubcommandsOnlyBuilder - extends SharedNameAndDescription, - Pick {} + extends Omit> {} export interface SlashCommandOptionsOnlyBuilder extends SharedNameAndDescription,