Home > Software design >  Error with .addNumberOption (slash command)
Error with .addNumberOption (slash command)

Time:10-11

I would like to make a commander (cmd slash) to activate maintenance on a remote server. Most of the order is done and functional. But when I want to put the number of minutes via a .addNumberOption, I get the error

Option "minutes" is of type: 10; expected 3.

  data: new SlashCommandBuilder()
    .setName('maintenancemc-staff')
    .setDescription('Active ou désactive le mode maintenance du serveur Minecraft')
    .addStringOption((option) =>
      option
        .setName('raison')
        .setDescription('Raison du changement de statut')
        .setRequired(true)
    )
    .addNumberOption((option) =>
      option
        .setName('minutes')
        .setDescription("Décompte d'activation du mode maintenance en minute")
        .setRequired(true)
    ),
    async execute(interaction, client) {
      await interaction.deferReply({ fetchReply: true, ephemeral: true });
      const { options } = interaction; 
      const raison = options.getString("raison");
      const timer = options.getString("minutes");
...

Thank you in advance for your help!

  • Related