Apostrophe querystring Error

I want to apologize if this has already been answered but I was trying to set up a command to add quotes with a specific format but I’m running into an error. Any time the quote is too long (around 20 or characters), it gives me the error “missing ) after argument list” but it does not give this error if the query is shorter.

Edit: The issue is not length. I found out from testing that the issue is actually that apostrophe returns errors

Here’s the command:
$(urlfetch //https://twitch.center/customapi/addquote?token=XXXXXXX&data=%22$(eval a=decodeURIComponent(’$(querystring)’);a.substr(a.indexOf(" “) + 1);a.substr(a.indexOf(” ") + 1))%22 by $(touser) on $(time Canada/Newfoundland “MMMM Do YYYY”))

The $(urlfetch) is a part of the nightbot quote system I am using by eksankia. It calls an API that stores text and adds a new line to it depending on whatever comes after data coded in URI Component. I then have %22 as the code for the quotation mark (") to simplify the addition process. After the eval (full extent listed below), it then ends the quotation and adds “by $(touser) on” and it gives only a date based on Newfoundland Standard Time (streamer’s timezone) given only in month day year format.

$(eval a = decodeURIComponent('$(querystring)');
  a.substr(a.indexOf(" ") + 1);
  a.substr(a.indexOf(" ") + 1);)

The eval is meant to turn the querystring into a string, then it skips past 2 spaces because it includes the first space that is between !addquote and $(touser) and then skip the second one between $(touser) and the message. The purpose of this is to get the whole quotation while removing the $(touser) at the beginning.

I have done testing and found out that the eval part is the problem in this but I wanted to include it all in case I’m missing anything.

It’s not clear what the eval does. Please repost it but formatted in Markdown. Put 3 backticks before and after like

this

Also remove the token from your post. Anyone can use it to add to your list.

Is there a reason you don’t just use $(query) or $(querystring) in the first place?

I apologize about how vague the original post was. I have updated it to provide more info to help

Because to remove the $(touser) return, it needs to be a string and $(query) and $(querystring) return a URI Component so that’s why I have the decodeURIComponent step

heres a simpler version that should work the same way.

$(urlfetch //https://twitch.center/customapi/addquote?token=XXXXXXX&data=%22$(eval `$(query)`.split(` `).splice(1,).join(` `))%22 by $(touser) on $(time Canada/Newfoundland “MMMM Do YYYY”))

This does work! I really appreciate the help with this!

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