Answer the question
In order to leave comments, you need to log in
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
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 questionAsk a Question
731 491 924 answers to any question