Unexpected token ':'

Asked May 31, 2021·2 replies·Last activity 5 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

I am trying to add a !dadjoke command that when called it random dad jokes from a pastebin link, but so far I've been running into errors and error.

The command:
!addcom !dadjoke $(eval responses = $(urlfetch json https://pastebin.com/raw/wKzWNmgQ):responses[Math.floor(Math.random() * responses.length)])

Error message:
Unexpected token ':'

any help is appreciated

2 replies

Hiya, try this:

$(eval responses = `$(urlfetch json https://pastebin.com/raw/wKzWNmgQ)`.split(`Q:`); `Q:` + responses[Math.ceil(Math.random() * responses.length)])

Thank you so much. It worked like a charm! ♥