fix(SlashCommandBuilder): missing methods in subcommand builder (#8583)

This commit is contained in:
Almeida
2022-09-15 19:19:13 +01:00
committed by GitHub
parent 053da5bc91
commit 1c5b78fd21
2 changed files with 13 additions and 2 deletions

View File

@@ -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();
});

View File

@@ -190,8 +190,7 @@ export class SlashCommandBuilder {
export interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {}
export interface SlashCommandSubcommandsOnlyBuilder
extends SharedNameAndDescription,
Pick<SlashCommandBuilder, 'addSubcommand' | 'addSubcommandGroup' | 'toJSON'> {}
extends Omit<SlashCommandBuilder, Exclude<keyof SharedSlashCommandOptions, 'options'>> {}
export interface SlashCommandOptionsOnlyBuilder
extends SharedNameAndDescription,