0

I don't know if the title was reliable on the actual problem.

    case 'shinymultiplier':
        case 'sm': {
            if (access >= 2) {
                if (args[0] && args[1]) {
                  let list = ["albino", "strange", "acidic", "sunburnt", "prismatic", "???"]
                  if (list.includes(args[0])) {
              //    if (parseInt(args[1]) != NaN) {
               //  if (parseInt(args[1]) != NaN) {
                //    if (typeof args[1] == 'string') {
                    if (parseInt(args[1]) !== NaN) {
                


                    if (args[0] == "albino") {
                        albinochance = 0.01 * parseInt(args[1])
                                console.log(parseInt(args[1]))
                    } else
                    if (args[0] == "strange") {
                        bluechance = 0.004 * parseInt(args[1])
                              console.log(parseInt(args[1]))
                    } else
                    if (args[0] == "acidic") {
                        greenchance = 0.002 * parseInt(args[1])
                      console.log(parseInt(args[1]))
                    } else
                    if (args[0] == "sunburnt") {
                        orangechance = 0.001 * parseInt(args[1])
                            console.log(parseInt(args[1]))
                    } else
                    if (args[0] == "prismatic") {
                        prismchance = 0.0004 * parseInt(args[1])
                    console.log(parseInt(args[1]))
                    } else
                    if (args[0] == "???") {
                        epicchance = 0.0002 * parseInt(args[1])
                      console.log(parseInt(args[1]))

                    } else {
                        embed
                            .setTitle('Error')
                            .setDescription("You must specify what shape you want to change the chance of!")
                            .setColor("#FF0000");
                    }

                    embed
                        .setTitle('Success')
                        .setDescription(`Successfully changed the chance of ` + `${args[0]}` + ` to ` + `${args[1]}`)
                        .setColor('#2bbefc');
                  } else {
                    embed
                    .setTitle("Error")
                    .setDescription("Multplier must be a number!")
                    .setColor("#FF0000")
                  }
                  } else {
                    embed
                    .setTitle("Error")
                    .setDescription("Invalid shape specified!")
                    .setColor("#FF0000")
                  }

                } else {
                    embed


                        .setTitle('Error')
                        .setDescription("Invalid syntax! Expected usage: shinymultiplier [shape] [multiplier]")
                        .setColor('#FF0000');
                }
            } else {
                embed
                    .setTitle('Error')
                    .setDescription("You don't have neccessary permissions")
                    .setColor('#FF0000');
            }

            embed.setFooter({
                text: "Celestials.io"
            })

        }
        break;

As you can see in the code, I've tried multiple times, but failed. But basically what I am trying to do, if the value isn't a number, return the "Multiplier must be a number!" error. typeof 'number' doesn't work. It returns the error, but in return it doesn't allow numbers. If that wasn't detailed... I am trying to make args[1] to work only with numbers. Can someone help me?

PMagic
  • 1
  • 2
    NaN is special in that comparisons to itself are always false. You have to use `Number.isNaN` to explicitly check if a value is NaN. – hittingonme Apr 06 '22 at 17:16

0 Answers0