So, i was following a tutorial about random messages, a very recent one, made by unknownemerald on ytb, and he used the folllowing code to create the command
$(user), $(eval a="$(urlfetch json https://pastebin.com/raw/YOURCODE)".split(";");a[Math.floor(Math.random()*a.length)])
but when I mae my own code all i get is this error message.
Hiya, what error message are you getting?
This should work:
$(user), $(eval a=$(urlfetch json https://pastebin.com/raw/XXXXX).split(";");a[Math.floor(Math.random()*a.length)])
It would also be easier to help you if we knew what is the code in your paste.
I was getting the error message on the tittle (code genration from strings disallowed for ths context)
with this code you gave (which uses a raw option from pastebin) I am getting yet another error, it says "unexpected token “;” ".
I realized now I should have used a raw option in my first attempt, I’m clearly pretty dumb in regards to all sorts of codings, but I still don’t know how to fix this current error.
my code is just a test code, as folllows:
tried with and without numbers. got slightly different erros, unexpected token and unexpected indetifier.
@Emily too, thanks!
If you’re gonna put different responses in the Pastebin, here’s how to do it:
No numbers unless you want them in the responses, and the last response shouldn’t end with a semicolon.
Also xgerhard forgot to put the
$(urlfetch) between quotation marks, although it would have been correct if the content of your Pastebin was actually JS code (you wouldn’t want to split with the semicolon in that case btw) instead of just various text responses:
$(user), $(eval a='$(urlfetch json https://pastebin.com/raw/XXXXX)'.split(';');a[Math.floor(Math.random()*a.length)])
So, I ended up forgetting to stop by and say you guys fixed my issues! everything is running perfectly, thanks!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.