Nightbot variables from random list / Invalid Variables

Asked Apr 4, 2020·1 reply·Last activity 6 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.

I gotten this to work successfully in stream elements

$(user) is $(random.pick 'random1' 'Random2' Random3') $(user)

the list of "random" would be a bit longer but when I use this code it just says I have invalid variables. The other question I could ask is what is the valid way to input variables

1 reply

StreamElements is not related to Nightbot in any way. Nightbot command variables are documented at https://docs.nightbot.tv/

To output a random item from a list, you may consider using $(eval) to execute some JavaScript code like so:

$(user) is $(eval a=[`random1`,`random2`,`random3`];a[Math.floor(Math.random()*a.length)]) $(user)