Created
February 4, 2018 05:48
-
-
Save anonymous/da39eeadddb488c39c1263975538ffc5 to your computer and use it in GitHub Desktop.
Water Version 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Basic equasion, I do it this way to increase reliablity because I trust JavaScript's date parsing more than writing a regex against nightbot. | |
$(eval Math.trunc((Date.now()- Date.parse('$(twitch mellana "{{uptimeAt}}")'))/(1000*60*60));) | |
#Version 1, repeats the math multiple times | |
@mellana You've been live for just over $(eval Math.trunc((Date.now()- Date.parse('$(twitch mellana "{{uptimeAt}}")'))/(1000*60*60));) hours. By this point in your broadcast you should have consumed at least $(eval 4*Math.trunc((Date.now()- Date.parse('$(twitch mellana "{{uptimeAt}}")'))/(1000*60*60));)oz ($(eval 120*Math.trunc((Date.now()- Date.parse('$(twitch mellana "{{uptimeAt}}")'))/(1000*60*60));)mL) of water to maintain optimum hydration. | |
#Version 2, builds string in Javascript, but only does math once! | |
$(eval const hours = Math.trunc((Date.now()- Date.parse('$(twitch mellana "{{uptimeAt}}")'))/(1000*60*60)); "@mellana You've been live for just over " + hours + " hours. By this point in your broadcast you should have consumed at least " + (4*hours) + "oz \(" + (120*hours) + "mL\) of water to maintain optimum hydration.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment