Replying to a keyword sometimes / at random

Asked Nov 11, 2021·2 replies·Last activity 4 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Heyyyo! I want to make Nightbot respond sometimes to a specific keyword (emote) and then cooldown

For example, if my chat starts to catJAM, I want Nightbot to join in with a catJAM after a few catJAM in chat ... instead of the 1st catJAM that a keyword typically triggers

So I'm thinking it's a probability thing to kinda randomize it, but I have no idea how to write that. Thank you!

2 replies

This should work the bot crates a random numer between 0-7 and if the number is less tan 5 it will send the message, change the numbers (7 or 5) for less or more frequency:

$(eval var N=Math.floor((Math.random() * 7) + 1); if(N < 5){"catJAM"}else{" "})

Brilliant!! That's working perfectly ... Thank you so much for taking the time to solve that for me!!