Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to make random responses

//I USE THIS IN DISCORD.JS V12. OTHER THINGS MAY NEED OTHER CODE.
const replies = ['reply1', 'reply2', 'reply3']; //Extend this if you want more messages.
const result = Math.floor(Math.random() * replies.length); //This will choose a random response.
//Use ${replies[result]} at your message if you want to add it to something else.
message.channel.send(`${replies[result]}`); //You can even change text around it, pretty cool.
 
PREVIOUS NEXT
Tagged: #random #responses
ADD COMMENT
Topic
Name
2+5 =