From 1c5b78fd2130f09c951459cf4c2d637f46c3c2c9 Mon Sep 17 00:00:00 2001 From: Almeida Date: Thu, 15 Sep 2022 19:19:13 +0100 Subject: [PATCH] fix(SlashCommandBuilder): missing methods in subcommand builder (#8583) --- .../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 863dc61b1..39f3a4546 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 c7b5a76c3..8bdb6c49e 100644 --- a/packages/builders/src/interactions/slashCommands/SlashCommandBuilder.ts +++ b/packages/builders/src/interactions/slashCommands/SlashCommandBuilder.ts @@ -190,8 +190,7 @@ export class SlashCommandBuilder { export interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {} export interface SlashCommandSubcommandsOnlyBuilder - extends SharedNameAndDescription, - Pick {} + extends Omit> {} export interface SlashCommandOptionsOnlyBuilder extends SharedNameAndDescription,