Skip to content

Instantly share code, notes, and snippets.

@Lokno
Last active January 4, 2021 22:53
Show Gist options
  • Select an option

  • Save Lokno/d1b0e5e5731472a5cc2d6433a6d6a712 to your computer and use it in GitHub Desktop.

Select an option

Save Lokno/d1b0e5e5731472a5cc2d6433a6d6a712 to your computer and use it in GitHub Desktop.
Add commands to add three night bot commands for using the internalization service.
Commands for adding the Internalization Commands (copy whole line and paste into chat)
!addcom -cd=5 !perc $(eval t='nick';vs=`$(query)`;if(vs.split(' ').length>1){t=`$(1)`;vs=`$(2)`;a=`$(urlfetch http://lokno.rabbitfury.com/avg/?key=MDAwMTAwMDMwSW50ZXJuYWxpemF0aW9uOiBQRVJDJQ==&name=$(1)&user=$(user)&value=$(2))`;}else{a=`$(urlfetch http://lokno.rabbitfury.com/avg/?key=MDAwMTAwMDMwSW50ZXJuYWxpemF0aW9uOiBQRVJDJQ==&name=nick&user=$(user)&value=$(1))`;}v=Math.min(Math.max(parseInt(vs,10)|0,0),100);t=t[0].toUpperCase()+t.slice(1);`$(user) added `+v+`% to `+t+`'s Internalization`)
!commands add !perc_reset -ul=moderator -cd=5 $(eval t='nick';if(`$(query)`.length>0){t=`$(1)`;a=`$(urlfetch http://lokno.rabbitfury.com/avg/?key=MDAwMTAwMDMwSW50ZXJuYWxpemF0aW9uOiBQRVJDJQ==&name=$(1)&clear=all)`;}else{a=`$(urlfetch http://lokno.rabbitfury.com/avg/?key=MDAwMTAwMDMwSW50ZXJuYWxpemF0aW9uOiBQRVJDJQ==&name=nick&clear=all)`;}t=t[0].toUpperCase()+t.slice(1);t+`'s Internalization has been reset`)
!commands add !perc_get -ul=everyone -cd=5 $(eval t='nick';if(`$(query)`.length>0){t=`$(1)`;a=`$(urlfetch http://lokno.rabbitfury.com/avg/?key=MDAwMTAwMDMwSW50ZXJuYWxpemF0aW9uOiBQRVJDJQ==&name=$(1))`;}else{a=`$(urlfetch http://lokno.rabbitfury.com/avg/?key=MDAwMTAwMDMwSW50ZXJuYWxpemF0aW9uOiBQRVJDJQ==&name=nick)`;}t=t[0].toUpperCase()+t.slice(1);t+`'s ` + a)
----
Alterative !perc body with name field limited to 'janel' (case-sensitive)
$(eval t='nick';vs=`$(query)`;if(vs.split(' ').length>1&&`$(1)`=='janel'){t=`$(1)`;vs=`$(2)`;a=`$(urlfetch http://lokno.rabbitfury.com/avg/?key=MDAwMTAwMDMwSW50ZXJuYWxpemF0aW9uOiBQRVJDJQ==&name=$(1)&user=$(user)&value=$(2))`;}else{a=`$(urlfetch http://lokno.rabbitfury.com/avg/?key=MDAwMTAwMDMwSW50ZXJuYWxpemF0aW9uOiBQRVJDJQ==&name=nick&user=$(user)&value=$(1))`;}v=Math.min(Math.max(parseInt(vs,10)|0,0),100);t=t[0].toUpperCase()+t.slice(1);`$(user) added `+v+`% to `+t+`'s Internalization`)
----
Alteratively, from the Nightbot Dashboard:
-Navigate to Commands->Custom
-For each line above (1,2,3):
-Click "Add Command"
-Type the name of the command into the first box (1) !perc (2) !perc_reset (3) !perc_get
-Copy the portion of each line starting with '$(eval ...' and extending to the ')' at the end
-Paste this into the 'Message' section
-Set Userlevel appropriately (1 !perc) Everyone, (2 !perc_reset) Moderator/Owner, (3 !perc_get) Everyone
-Consider changing the cooldown, default is 5 seconds until someone can execute the command again
-Click submit when ready
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment