Keep getting "Unexpected Identifier" in random response command

I have a custom command to pull a random dad joke from a Pastebin list, which I add new entries to sometimes. It’s an exclusive command for a specific user, with a default response if anyone else tries to use it. For namesake, I’ll use my username to present the command here rather than that specific user’s.

$(eval ‘$(user)’ == ‘iLLadelph267’ ? ‘$(eval a=“$(urlfetch json https://pastebin.com/raw/U0xphXnF)”.split(“;”);a[Math.floor(Math.random()*a.length)])’ : “Sorry, only iLLadelph267 can be blamed for dad jokes” )

I added a bunch of new ones today but keep getting an Unexpected Identifier. I’ve had this issue before and fixed the separator appearing within entries. But now its returning “Unexpected Identifier ‘Where’ context:1:59” after the latest change even though the only place a semicolon appears is between entries as intended.
Also, I’m very confused about the ‘Where’ context:1:59 part. Prior to the latest change, it returned Unexpected Identifier ‘What’ context:1:58 and I assumed it was pointing to line 58 in the Pastebin. On line 59 was a joke starting with the word “What” so I elected to delete that entry. Now it returns this ‘Where’ context:1:59 but line 59 doesn’t contain the word “where” telling me I misunderstood what the part meant.
I’ve no idea why any of the entries in there would cause an issue. Should I change my separator? Why is it pointing out words like ‘Where’ and ‘What’? What does context:number:number mean? Is there an issue with the way my command is written that I’m just not seeing?

made a few small tweaks and got it up and running… this should do it for ya…

$(eval `$(user)` == `$(user)`?`$(eval a=`$(urlfetch json https://pastebin.com/raw/U0xphXnF)`.split(`;`);a[Math.floor(Math.random()*a.length)])`:`Sorry, only iLLadelph267 can be blamed for dad jokes`)

p.s. i changed the comparison to $(user) to test the responses

also, i believe it was the quotes (" ") around the $(urlfetch) that caused the issue, due to some of the pastebin entries having quotes in them… so i changed them to backticks (` `) to avoid the complication

this worked perfectly! thank you so much, I suppose I ought to use backticks instead of quotes where possible from now on

lol, yeah, that’s what i do… and so far the only place i’ve found it to not work, is for the keys in the key/value pairs of json objects

Papo reto cria eu tava ta ligado visao mano valeu vlw

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