My bad, I thought you had a command already. I've had an intense migraine these last couple days so I'm sorry if I miss some things. Poking me gently about it like you did is the way to go.
There are two options to fix your code:
• the first one is to keep your JSON in your Pastebin intact and build your code around it:
→ Pastebin:
["pepeMeltdown GO GO GO pepeMeltdown",
"pepeMeltdown GOTTA GO pepeMeltdown",
"pepeMeltdown IM OUTTA HERE pepeMeltdown"]
→ code:
$(eval satfact=$(urlfetch json https://pastebin.com/raw/XXXXXXXX); satfact[Math.floor(Math.random() * satfact.length)];)
Replace XXXXXXXX with your paste ID.
• the second option is to edit your Pastebin so it's just strings separated by a separator and write your code around it:
→ Pastebin:
pepeMeltdown GO GO GO pepeMeltdown;
pepeMeltdown GOTTA GO pepeMeltdown;
pepeMeltdown IM OUTTA HERE pepeMeltdown
→ code:
$(eval satfact='$(urlfetch json https://pastebin.com/raw/XXXXXXXX)'.split(';'); satfact[Math.floor(Math.random() * satfact.length)];)
Replace XXXXXXXX with your paste ID.
Explanations:
- the error you were receiving was because you were calling a non-raw Pastebin.
- you would only have gotten the 2 first options at random:
Math.floor(Math.random() * N) gives you a random integer between 0 and N-1,
here satfact.length is equal to 3, so it'll give you a random number between 0 and 2,
and the first item of an array is always at index 0 and the last one at length - 1.
about the first solution:
- you would have had an issue because you put the
$(urlfetch) between double quotes " and tried to split it to build an array, when it already is an array.
about the second solution: