Global variable

@denniskarbon

Global variables are not possible to set up natively in Nightbot, but a workaround exists using ehsan’s quote API.


Click this link. It will generate three links and two tokens, a public token (8 characters long) and a private token (16 characters long). The public token is located within the first generated link. The private token is located within both the second and third generated links. The tokens are found after token= and before &data=$(querystring) Copy them down and keep them somewhere safe!

Below I have set up !editlink (mod-only) which stores the user input in the “global variable”. New input will overwrite the previously stored input. Replace PRIVATE_TOKEN with your private token.

!addcom -ul=mod !editlink $(eval a=`$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(querystring))`;`The global variable is now set to "${decodeURIComponent(`$(querystring)`)}"`)

To set the global variable, type:

!editlink [input]

The following will then be the “global variable”. Replace PUBLIC_TOKEN with your public token:

$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&data=-1&no_id=1)