#IMPORTANT subcommands not throwing argument error

1 messages · Page 1 of 1 (latest)

full schoonerBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

gleaming field
#
import type { Message } from 'discord.js';
import { Args } from '@sapphire/framework';
import { Subcommand } from '@sapphire/plugin-subcommands';

export class ExecuteJadesCommand extends Subcommand {
  constructor(context: Subcommand.LoaderContext) {
    super(context, {
      name: 'execute-jades',
      description: '<amount> [userId]',
      aliases: ['ej'],
      subcommands: [
        {
          name: 'set',
          messageRun: 'messageSet'
        },
        {
          name: 'add',
          messageRun: 'messageAdd'
        },
        {
          name: 'remove',
          messageRun: 'messageRemove'
        }
      ]
    });
  }

  async messageSet(message: Message<true>, args: Args) {
    const amount = await args.pick('integer', {
      minimum: 1,
      maximum: 1000000000
    });
    const user = await args.pick('user').catch(() => message.author);

    ....
  }

  async messageAdd(message: Message<true>, args: Args) {
  }

  async messageRemove(message: Message<true>, args: Args) {
  }
}
gleaming field
#

its working for normal commands