generated from sapphiredev/sapphire-template
-
-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
Description of the bug
Provided the following subcommand array:
subcommands: [
{
type: 'group',
name: 'config',
entries: [
{ name: 'edit', messageRun: 'configEdit' },
{ name: 'show', messageRun: 'configShow', default: true },
{ name: 'remove', messageRun: 'configRemove' },
{ name: 'reset', messageRun: 'configReset' }
]
}
]The expected behaviour is that running !command config would execute show as that is the configured default.
Currently however an error is thrown due to subcommandName.isSome() returning false here:
| if (mapping.type === 'group' && subcommandOrGroup.isSome() && subcommandName.isSome()) { |
Steps To Reproduce
- Copy the following subcommand code as a new command:
import { Subcommand } from '@sapphire/plugin-subcommands';
import type { Message } from 'discord.js';
export class UserCommand extends Subcommand {
public constructor(context: Subcommand.Context) {
super(context, {
aliases: ['sg'],
description: 'A message command with some subcommand groups',
subcommands: [
{
type: 'group',
name: 'config',
entries: [
{ name: 'edit', messageRun: 'configEdit' },
{ name: 'show', messageRun: 'configShow', default: true },
{ name: 'remove', messageRun: 'configRemove' },
{ name: 'reset', messageRun: 'configReset' }
]
}
]
});
}
public async configShow(message: Message) {
return message.channel.send('Showing!');
}
public async configEdit(message: Message) {
return message.channel.send('Editing!');
}
public async configRemove(message: Message) {
return message.channel.send('Removing!');
}
public async configReset(message: Message) {
return message.channel.send('Resetting!');
}
}- Run
!sg config - Observe that
showsubcommand does not get executed and instead amessageSubcommandNoMatcherror is thrown.
Expected behavior
The default subcommand within the subcommand group executes as described
Screenshots
No response
Additional context
No response
Reactions are currently unavailable