Hi guys! So I have this command string that works like a magic 8 ball. The command must be followed by a question (doesn’t even need to end in a question mark; there just has to be text).
This is what I currently have:
$(eval responses=[Yes
, No
, Maybe
, Try again later
]; $(querystring)
.trim() == `` ? Please ask a question first.
: responses[Math.floor(Math.random()*responses.length)])
I now have a website that generates a random response - literally just a url that says “yes” and then when refreshed will randomly select another response like “no” or “maybe”. How do I incorporate $(urlfetch) into this?
I’ve tried just doing the below, but it doesn’t work right:
$(eval responses=[$(urlfetch https://api.scorpstuff.com/catfacts.php); $(querystring)
.trim() == `` ? Please ask a question first.
: responses[Math.floor(Math.random()*responses.length)])
I’ve also tried doing other variants too like the below but while the url works, the query verification doesn’t:
$(urlfetch https://api.scorpstuff.com/catfacts.php); $(querystring).trim() == `` ?
Please ask a question first.`
Any tips would be appreciated!