Stay Healthy

whisper
commands
webpanel
audio
javascript

#1

Since people seemed to like the program I made for water reminders a few days back I decided to make a new program that has a reminder for: Water, Food, and Movement/breaks.
The Program includes:

  1. Ability to change the timer length on all reminders in Minutes. (Default: water:60 movement/stretch:120 food:480) (E.X. !hydration settimer 60)
  2. Ability to toggle reminders on and off. (Default: ON)
  3. Ability to toggle an audio alert for reminders on and off. (Default: OFF)
  4. Ability to set the audio alert to any audio hook that the bot has loaded. (Default: bell_ring) (E.x. !hydration setalert tap)
  5. Ability to have command responses whispered to the sender instead of filling chat with the responses. (Main Reminders still appear in chat)
  6. Ability to have the bot change name color to red when a command is entered wrong, or if it is telling you how to use a command. (This can also be used to change the bot’s name color without toggling the color change on, uses hex, or twitch name colors) –My testing bot does not have turbo/prime so i was not able to fully test the hex color input if someone could test this and inform me of any issues it would be greatly appreciated
  7. A Lang file that you can edit if you don’t like the default messages.
  8. Ability to change the oz per hour the bot reminds you of. (Default: 5oz)
  9. adds $.changeBotColor to api (Because I guess there wasnt a need for it yet?) basically just runs /color but with an easier call. (E.x. $.changeBotColor(#aabbcc))
  10. Base commands: !health (is mainly for settings/toggles), !hydration, !food, !movement

UPDATE 11/20/18: Added option to color alerts, and added optional panel for beta-panel:
System folder File: healthSystem.js (22.1 KB)
Lang - system File: systems-healthSystem.js (4.2 KB)
web - Beta-Panel - pages - extra File: healthsystem.html (10.2 KB)
web -Beta-Panel - js - pages - extra File: healthsystem.js (11.1 KB)

To use the new panel you will need to go into web- betapanel - index and go down the Extras and add a link for the “healthSystem” in.

As always with new files, please let me know if there is any issues with the program and i will fix them as soon as possible :slight_smile:


Old Files:
Only use if you want the version before colorable alerts.

System folder File: healthSystem.js (19.4 KB)
Lang - system File: systems-healthSystem.js (3.6 KB)

Lang file is required for the program otherwise it wont say anything.

Feedback, or suggestions on code optimization would be greatly appreciated.


#2

Hey I love your script so far!

how can I change it so that the bot says the hourly reminder to drink as /me? This would make it easier to see … I’m currently using only hydration …

So far, i Change OZ to ML (Mililiter) because i am from austria (EU)… I haven’t try it but i hope it works… I edit only the lang file…

Thanks for the script


#3

I’ve thought about it, I think behind OZ to change ML is more behind it or? Do not I have to change the complete calculation? 5oz are about 150ml … I rounded up to 200ml … Could you maybe write the whole script on ML ( 5oz = 150ml)? Or tell me what I have to change?


#4

You can go into the Lang file and change water.timer.reminder to have /me at the start, before the $1. Also I am from the United States, so no i am not going to write an entire script for a measurement i don’t use. I could add ml into the message if people would like that.


#5

(Edit: Optimized first load to reduce lag. Added ml reading to water message: “5oz(147.87ml)” still requires oz entry when using command though. Please download both new files for these to apply)


#6

@ShadowDragon7015 thank you for this awesome module! I have it install and it’s working great so far!

Would you please explain how to change the bot’s color for this module? As in, I would like the health alerts in chat to be a different color than the bot’s normal text. Is this possible? If so, would you please explain how I can configure/set this? :slight_smile:


#7

Twitch does not have a way to change colors in chat.


#8

@IllusionaryOne yes it does. @ShadowDragon7015 even uses this feature to change the color for error messages. :slight_smile:


#9

No, he is changing the bot color with a Twitch command, you cannot change the colors of a chat message though in the Twitch IRC API. He is simply calling /color to change the bot-color on demand.

My first thought you when you asked if you could change colors in chat was, literally, can you set a color in chat, and no, you can’t. You can, of course, change the color that the account uses to obtain a type of color change.

Sorry for the misunderstanding.


#10

In other words, this:

Color
Allows you to change the color of your username. Normal users can choose between Blue, Coral, DodgerBlue, SpringGreen, YellowGreen, Green, OrangeRed, Red, GoldenRod, HotPink, CadetBlue, SeaGreen, Chocolate, BlueViolet, and Firebrick. Twitch Turbo users can use any Hex value (i.e: #000000).
Usage (Non-Turbo): /color <colorname>
Usage (Turbo): /color <hex value> or /color <colorname>

#11

@IllusionaryOne I uderstand he is changing the color of the bot’s name… but he sends the error messages with the /me in twitch and that makes the text the same color as the name.

What I’m asking for, is it possible to do the same thing that error messages do but for normal health alerts. This will help make the message stand out in chat.


#12

Yes, with the /color command. In the script they have a wrapper around that (setBotNameColor()), you can review that and see how to make that work in the script for your needs.


#13

In short, everywhere you see a sendmessage() other than in senderrormessage() you could setBotNameColor('Color') to change the bot color. I am not entirely sure how it is swapped back to the original, I didn’t look any further into the script.

Cheers


#14

Ok, now that I read the language file, the “errorcolor” is the default color for your bot, so look at how senderrormessage() works and you can see how to set the color. Personally, I’d probably do something like…

    //Send error response, change bot color during response
    function senderrormessage(message, sender){
        if($.getIniDbBoolean('healthSystem', 'errorcolortoggle') && !$.getIniDbBoolean('healthSystem', 'whisperresponse')){
            setBotNameColor('Red');
            sendmessageraw(message, sender);
            setBotNameColor($.inidb.get('healthSystem', 'errorcolor'));
        }
        else{
            sendmessageraw(message,sender);
        }
    }

    //Send message
    function sendmessage(message, sender){
        setBotNameColor('Green');  // You could also look to make this configurable, like the default color is.
        sendmessageraw(message, sender);
        setBotNameColor($.inidb.get('healthSystem', 'errorcolor'));
    }

    //Send raw message
    function sendmessageraw(message, sender){
        if($.getIniDbBoolean('healthSystem', 'whisperresponse')){
            $.say('/w ' + sender + ' ' + message);
        }
        else{
            $.say('/me ' + message);
        }
    }

To minimize changes to the script. It is a hack, and there are better ways to do that. This of course makes everything a different color. The other option is to write a copy of the above sendmessage() perhaps called sendcolormessage() and use that whenever you want to have a different color message come out.


#15

@IllusionaryOne Thank you! This points me in the right direction. :slight_smile:


#16

I plan to update this in the future to add more options once the new panel comes out. I could add an option for coloring reminders if thats an option people think would be useful. I also plan to make a panel for it later to make changing settings easier. Just waiting on the update :slight_smile:


#17

@ShadowDragon7015 That would be very cool! Thanks!


#18

You bet! Sorry for the initial back and forth, I got confused at the first question. Hopefully that gets you most of the way the way there in the meantime.

Cheers


#19

Updated: to add panel and the alert stuff :smiley: