User input randomizer

Hi! I want to create a user input randomizer for my twitch chat.

The user inputs many words separated by the spaces and the Nightbot will choose randomly one of the words and reply it to the user.

User inputs - !command [word1] [word2] [word3] [word4]
Nightbot replys - $(user) [word2]

I hope you could understand what I want from that. Coding is too complex for me, so I ask for your help.
Thank you!


!addcom -cd=5 !commandname $(eval a=decodeURIComponent(`$(querystring)`).split(` `);a[0]==``?`Missing input!`:`$(user) `+a[Math.floor(Math.random()*a.length)])

@RokettoJanpu Thank you very much! works better than I wanted!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.