discord js random message

Solutions on MaxInterview for discord js random message by the best coders in the world

showing results for - "discord js random message"
Natan
19 Jun 2016
1// Add here the messages you want to be displayed.
2const messages = ["Message1", "Message2", "Message3", "Message4"]
3
4const randomMessage = messages[Math.floor(Math.random() * messages.length)];
5
6// The message will log into the console!
7console.log(randomMessage)
Victoria
21 Mar 2016
1module.exports = {
2    name: 'random',
3    description: 'random?',
4    execute(message, args){
5        // Now the randomMessage will be recalculated every time the command is run
6        const randomMessage = messages[Math.floor(Math.random() * messages.length)];
7        message.channel.send(randomMessage);
8    }
9}
10