Can't add unicode word quote that in eval

such as title,i have a code like this:
$(urlfetch http://twitch.center/customapi/addquote?token=2c918790b386a896&data=$(querystring $(time Asia/Hong_Kong “YYYY/MM/DD LTS”) $(touser): —edit status: processing))
and $10 is command name

when i enter $10 測試,the add result is:
2017/10/18 9:45:39 AM 測試: —edit status: processing

that is normal,but when i put it in the eval,the code will be
$(eval “$(urlfetch http://twitch.center/customapi/addquote?token=2c918790b386a896&data=$(querystring $(time Asia/Hong_Kong “YYYY/MM/DD LTS”) $(touser): —edit status: processing))”)

the add result is:
$(time Asia/Hong_Kong “YYYY/MM/DD LTS”) $(touser): —edit status: processing
well…i think is $(querystring) cause this result…so i remove it

and now code is:
$(eval “$(urlfetch http://twitch.center/customapi/addquote?token=2c918790b386a896&data=$(time Asia/Hong_Kong “YYYY/MM/DD LTS”) $(touser): —edit status: processing)”)

the add result is:
2017/10/18 9:54:52 AM ,f: —edit status: processing
hmmmm…how i change word ,f to 測試?

測試 is becoming ,f because you left out $(querystring), so your data is not properly encoded for a URL.

There appears to be a Nightbot bug, where a Nightbot variable within another variable is not evaluated if they are both inside an eval.

This means that you want to use eval, you will need to split your command into two commands. The $10 command will visit the url, and the helper command will wrap the output in an eval.

Here is the code for these two commands:

!commands add $10 -a=$10helper $(urlfetch http://twitch.center/customapi/addquote?token=2c918790b386a896&data=$(querystring $(time Asia/Hong_Kong “YYYY/MM/DD LTS”) $(touser): —edit status: processing))

!commands add $10helper -ul=owner $(eval `$(query)`)

Now you can edit the message for $10helper to put whatever you want inside the eval.

ok,it seems work,but now i want to shield this message:
Successfully added entry #6

because the output doesn’t need,and how i shield this message?

If you don’t want Nightbot to send that message, then use this code for $10helper:

!commands add $10helper -ul=owner $(eval " ")

Thanks! now i can put the if else judgment in second eval and output it

You should generate a new token, or anyone can add/remove quotes.

This token i already use for public

Well,now i want use this to do a check in system and seems have new problem

The command checkin code is
$(urlfetch http://twitch.center/customapi/addquote?token=2c918790b386a896&data=$(querystring $(touser)))

and checkinhelper code is
$(eval " “)$(eval var p=”$(touser)",q="$(urlfetch http://twitch.center/customapi/quote?token=de83b97b&no_id=1&data=$(touser))";if(q.indexOf("$(touser)")!==-1){“Today you are already checked in,please come tomorrow!”}else{p+“check in successfully,get five 932 coin”;})

the helper can add quote normally,but the output seems have problem
ex:if i enter checkin 測試
the add in quote will be 測試
but the output is:Successfully check in successfully,get five 932 coin
(Normal output is:測試 check in successfully,get five 932 coin)

when i enter this twice,normally it will be Today you are already checked in,please come tomorrow!
but the output still is:Successfully check in successfully,get five 932 coin

BTW,before this version the code is
$(eval var p="$(touser)",q="$(urlfetch http://twitch.center/customapi/quote?token=de83b97b&no_id=1&data=$(touser))";if(q.indexOf("$(touser)")!==-1){“Today you are already checked in,please come tomorrow!”}else{"$(urlfetch http://twitch.center/customapi/addquote?token=2c918790b386a896&data=$(touser))";p+“check in successfully,get five 932 coin”;})

Although it can’t add 測試 in quote but another like ? 932 can add in
other function also work normally

When i enter checkin ?
first time,it say:? check in successfully,get five 932 coin
over 2 times it says:Today you are already checked in,please come tomorrow!

so it work normally

and now how i solve this problem with 2 split commands?

I really have no idea what you are trying to do with this command. Please explain in detail.

For Example:When user check in first(mean he/she enter this command first time)
the Nightbot will reply:(username)check in successfully,get five 932 coin (932 coin is a type of virtual currency)
When this user chack in second times or more times will reply:Today you are already checked in,please come tomorrow!

now i turn above text to english and 測試 mean testing
and if you don’t understand the code,i can explain

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