Automatically alarm everyday

Hi!

Are there any option to config a “timer” witch show a message everyday at 12:00pm?
I am trying to get it but in timer section I can only config a timer every 60 min.

Thank you!!

Hey @turbbii!

You can do so by combining a timer with $(eval) and $(time).

Hi @Emily thanks for your answer, could you please help me doing that command? I am reading about that two commands but I can’t understand how to do it correctly.

Okay, so what you want to do is have your timer set up to 60 minutes, then $(eval) contains Javascript that checks the value of $(time), and if it’s the awaited value it executes code:

$(eval parseInt($(time TIMEZONE "H")) === 12 ? `It's noon!` : ` `)

All you have to do now is replace the TIMEZONE field by yours, replace the message if needed, and it should be working!

2 Likes

Thank you for the tip, Emily!
I tried this timer, and it looks like Nightbot will display an empty message if it is not noon. Is there any way to make him not to do that?

Thank you! :slight_smile:

I don’t know about YouTube, I’m pretty sure it works the same, but on Twitch an empty message won’t send, so this shouldn’t be an issue. If you remove the space you’ll get an error though.

If you see that it sends empty messages — I’d be very surprised — you can always replace the code by:

$(eval if (parseInt($(time TIMEZONE "H")) === 12) { `It's noon!` })

it’s basically the same thing.

1 Like

Tried this syntax and got an error on YouTube (undefined)

2022-02-11_17-01-48 NB undefined

1 Like

Interesting, well then the second command should work without issue then. Thanks for getting back to me, I’ll keep that in mind in the future when dealing with commands for YouTube.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.