Custom response for the uptime command

Asked Oct 18, 2022·3 replies·Last activity 3 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

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).

3 replies

Hey @Chilly Ladybug!

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 @Polar Cat 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}`;)