Skip to content
Advertisement

i need a way my bot can respond with a random response like and 8ball command

Preferably through a const such as const responses = ["response1", "response2", response3"] using discord.js v12.2.0.

Advertisement

Answer

// Creating an array with responses.
const Responses = ["Response1", "Response2", "Response3", "Response4"];

// Picking a random response and logging it.
console.log(Responses[Math.floor(Math.random() * Responses.length)]);
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement