0

I am currently trying to make an improved !addquote command in which the quote number is fetched from a twitch api application with the OAuth Redirect URL "http://localhost". All the requests return as "Unexpected Identifier" although the correct api token was in place. Thanks in advance!

The following three I have already tried, longer ones sadly failed because of the 500 character command cap of nightbot. Both of these command return "Unexpected Identifier" and as such neither the quote number, nor the quote content is being correctly saved. (The twitch API token 100 % works when returning user details through curl)

!addcom -cd=5 !addquote -a=!commands add !quote $(eval a=$(urlfetch json https://twitch.center/customapi/addquote?token=API_TOKEN&data=$(querystring $(query)));a.length>10?"Fehler beim Hinzufügen der Quote.":"Quote wurde erfolgreich hinzugefügt.") $(user) hat Quote #$(query 1) hinzugefügt: $(query 2)
!addcom -cd=5 !addquote -a=!commands add !quote $(eval a=$(urlfetch json https://twitch.center/customapi/addquote?token=API_TOKEN&data=$(query));a.length>10?"Fehler beim Hinzufügen der Quote.":"Quote wurde erfolgreich hinzugefügt.") $(user) hat Quote #$(query 1) hinzugefügt: $(query 2)
!addcom -cd=5 !addquote -a=!commands add !quote $(eval a=$(urlfetch json https://twitch.center/customapi/addquote?token=API_TOKEN&data= + encodeURIComponent($(query))).then(response => response.text()).then(data => {return data.length>10 ? "Fehler beim Hinzufügen der Quote." : "$(user) hat Quote #" + $(query 1) + " hinzugefügt: " + $(query 2);} );)

When creating a command by !addquote, f. e.: !addquote test, nightbot successfully adds the command !quote (no number) and when calling that functions returns...

Unexpected identifier zebsy hat Quote #test hinzugefügt: test

... This implies that it wasn't able to call the quote number by twitch api. (although the api token works for calling User information by curl in cmd)

Logically when attempting to create a second command by !addquote nightbot fails...

@zebsy -> There was an error adding the command. Error: command name already exists

p.s.: I have removed the api token in order to not reveal sensitive information but all the commands have been executed with it in place (API_TOKEN)

zebsy
  • 13
  • 4

0 Answers0