Hi, I don’t speak English very well, so excuse me if there is an error when writing, I have a problem with this command that I am “doing” to play rock, paper or scissors, I really don’t know what is wrong and I only get missing ) after argument list
when should I use the pasterbin links if someone could guide me or tell me what I’m doing wrong I would appreciate it a lot since I’m still very new to this.
Using the Multiple Messages API makes things a bit more complicated, for example you can’t call other $(urlfetch) inside the API because it cuts messages at slashes, so all your API calls inside the Multiple Messages API are creating new messages, the way to make it work would be using an alias command to trigger the API once you wrote all the messages for it:
$(eval u = '$(user)'; u === '$(touser)' ? t = '$(urlfetch https://2g.be/twitch/randomviewer.php?channel=$(channel))' : t = '$(touser)'; r = Math.floor(Math.random() * 2); o = $(urlfetch json https://pastebin.com/raw/XXXXXXXX); encodeURI(`${u} ha retado a ${t} jugar piedra, papel, o tijera/${r === 0 ? u : t} ${o[Math.floor(Math.random() * o.length)]}`);)
In the command above I generate both sentences to feed the Multiple Messages API, then in the alias I use $(querystring) to recover that sentence URL-encoded, as it’s required:
Thank you very much for helping me with my problem, I really didn’t know it could be done that way, you solved everything for me, excellent work, have a good night and thanks again.
Maybe I explained myself wrong but by any chance do you know how to make nightbot give an answer in different parts?
Right, I was worried this might be an issue, you see $(querystring) encodes using encodeURIComponent(), which encodes the slash (/) as well, I thought the API would still work as intended, but turns out it’s not the case, so we want the slash to remain as is, for that we can use encodeURI() instead.
I’ve fixed the code in my answer above, both commands were edited.
I had time to test the fix, it works as intended now.
Oooh thank you very much for completely solving my problem and also giving you the time to correct the previous message and try it also, I really appreciate it very much and I hope you have a good day, see you soon!