简体   繁体   中英

How can I make my Discord bot (Javascript) answer a random number to a specific question an user asks?

The code I am using

I am using this code, and when the question is asked (in a different language:D,sorry,) the same answer is given, when I restart the bot and ask the again question it's a different generated number. but when I ask the question again (without restarting the bot) it repeats the answer it gave after restart. It's basically only generating a new random number every time the bot turns on..

Sure, here you go

bot.on('message', message => {
       var Randomnumber = (Math.floor(Math.random() * 1000000000) + 1);
       
       .... rest of your code goes here
    });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM