Quotation marks interfering with code

I have a command with some js code but whenever someone types a " in the word after the command, Nightbot gives a “Right-hand side of ‘instanceof’ is not an object” error. I know where the issues is situated (eval a="$(query)"; so the double quotation mark in the word messes with the code) but changing the double quotation marks to single one gives the same problem when a ’ used in that word. Is there any way to fix this?

Hey @brecht_vh!

Using ` (backticks), $(querystring) instead of $(query), as well as decodeURIComponent() should prevent most issues in the future:

a=decodeURIComponent(`$(querystring)`)
1 Like

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