I want a bot to send random messages only but one message only once

Viewed 45

It Is Something Like This

I have these 5 messages

hello1 hello2 hello3 hello4 hello5

And I want to send a random message

like hello3

But It Could Be Sent Only Once

Its Shortly Bot Sends Random Messages. But Messages Could Not Be Repeated

I want to do this in discord.js v14

1 Answers

Your post is kinda confusing, but if you wanted to send a random message, use an array.

let randomStrings = ["message1", "message2", "message3", "message4", "message5"];
let randomLength = randomStrings.length;
let RN = Math.floor(Math.random() * randomLength);
let sendRandomString = randomStrings[RN]

Here's the snippet:

let randomStrings = ["message1", "message2", "message3", "message4", "message5"];
let randomLength = randomStrings.length;
let RN = Math.floor(Math.random() * randomLength);
let sendRandomString = randomStrings[RN]
console.log(sendRandomString)

Since you don't provide any code of yours. This is only the code I can give as tips.

Related