I’m trying to create a command that randomly decides between the viewer using the command and either a viewer they submit or a random user. My code currently looks like this:
$(eval u='$(user)'; '$(touser)' === u ? t = '$(urlfetch https://2g.be/twitch/randomviewer.php?channel=$(channel))' : t = '$(touser)'; a = [u, t]; `${a[Math.floor(Math.random() * a.length)]} wins!`;)
You were close, your biggest mistake was the semi-colon (;) inside of your ternary operator (?:) when you put just one only at the end, here’s how you should have written it to avoid errors:
'$(query)' ? u = ['$(user)', '$(touser)'] : u = ['$(user)', '$(urlfetch https://2g.be/twitch/randomviewer.php?channel=$(channel))'];