It returns 3 cases
-There are no quotes added (empty list)
-number.user (find user)
-0.last user (don’t find user)
When r is my user and i’m in a quote ( r=1.manito ) nightbot display “manito ya está en el listado” and enter and execute de else sentence too (adding me in a new quote)
So you’d have your first command (assuming your current code works), and in the else you put your PRIVATE_TOKEN (which you call TOKEN2) along with what you want to add to the quote API:
$(eval var r =’$(urlfetch https://twitch.center/customapi/quote?token=TOKENHERE&data=$(touser))’;
if(r.charAt(0)==‘0’){
r=’’;}
if(r== ‘There are no quotes added’){
r=’’;}
if®{
‘$(touser) ya está en el listado’;}
else{
`TOKEN2HERE&data=$(touser)`}
)
That way, it’ll only add the user to the quote API if else is executed, otherwise you’ll get the expected output.
To add an alias from the chat use !addcom !command_name -a=alias_command_name response, but in general you want to avoid adding commands that contain sensible information such as a PRIVATE_TOKEN through your chat, anyone seeing the message can then edit your quote API, so do it through the dashboard, and don’t forget to fill the Alias field of the first command with the name of the second command.
!addcom !turno -a=!NEWCOMMAND $(eval var r =’$(urlfetch https://twitch.center/customapi/quote?token=TOKENHERE&data=$(touser))’;
if(r.charAt(0)==‘0’){
r=’’;}
if(r== ‘There are no quotes added’){
r=’’;}
if®{
‘$(touser) ya está en el listado’;}
else{ TOKEN2HERE&data=$(touser);
} )
be careful with copy-paste, i only need the name of the user and use touser