I am developing a discord bot, this is a random number generator command and when i use it it returns: random number from 5 to 10: 35 after a couple fo tries it returns fully rounded random numbers ignoring the parameters.
module.exports = {
name: 'random',
description: 'returns an aleatory number',
execute(message){
let arguments = message.content.split(' ')
let from = arguments[1]
let to = arguments[2]
let result = Math.floor(Math.random() * (to - from + 1) ) + from;
message.channel.send(`random number from ${from} to ${to}:\n${result}`)
}}
Aucun commentaire:
Enregistrer un commentaire