F
F
FurryFandom2020-06-29 12:35:23
Node.js
FurryFandom, 2020-06-29 12:35:23

Random picture code error from PC.?

I tried to somehow send a random image for the bot, I wrote a function, but somehow it doesn’t want to work, I don’t understand why. Math especially does not want to work. Is there a better or better solution?

function randomimage(robot, mess ,args) {
        number = 7;
        imageNumber = Math.floor {Math.random() * (number - 1 *1)} + 1;
        mess.reply( {files: ["./images/" + imageNumber +".png" && ".jpg"]} )
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-06-29
@FurryFandom

var random = Math.floor(Math.random() * 6);

  if (random === 1) {
          mess.reply( {files: [""]} )
  } else if (random === 2) {
           mess.reply( {files: [""]} )
  } else if (random === 3) {
            mess.reply( {files: [""]} )
  } else if (random === 4) {
            mess.reply( {files: [""]} )
  } else if (random === 5) {
            mess.reply( {files: [""]} )
  } // и т.д

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question