Custom response for the uptime command

Hello, I mod for a few streamers, and a couple of them have users that love to do the “uptime” command at 4 hours and 20 minutes into the stream. Is there a way that we can have the command say something different if the uptime is between 4:20:00 - 4:20:59 (I can come up with the verbiage later).

Hey @kyle_cgb!

Yes you can, you just need to use JavaScript!

$(eval t = '$(twitch $(channel) "{{uptimeLength}}")'; t.includes('4 hours 20 minutes') ? 'SPECIAL_MESSAGE' : t;)

If your SPECIAL_MESSAGE contains apostrophes (') you need to “escape” them by putting a backslash (\) before them, for example: That\'s cool!

Thank you so much @Emily Is there a way I can put something before the uptime part? Like, "$(user) Streamer has been live for ‘uptime’. But when it hits 4:20, it says something custom?

When I go to put text before the command, it errors out.

Not sure why you get an error, but you can simply replace the very last t with `YOUR_REGULAR_MESSAGE ${t}`, so according to your example: `$(user) Streamer has been live for ${t}`.

In context:

$(eval t = '$(twitch $(channel) "{{uptimeLength}}")'; t.includes('4 hours 20 minutes') ? 'SPECIAL_MESSAGE' : `$(user) Streamer has been live for ${t}`;)
1 Like

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