I saw this command in another thread but when I use it when offline it still shows.
$(eval u=$(twitch $(channel) "{{uptimeLength}}");if(u.toLowerCase()===channel is not live){Just offline} else{$(lastfm LASTFMNAMEACC "{{title}} by {{artist}}")})
6 replies
Polar Cat
Hey @Topaz Jellyfish!
The key is to check whether the streamer is live, and if not, send a string that's made of a space, the bot won't throw an error, and the chat will automatically discard the message as empty:
The following commands can be tried,Replace the following text with "MESSAGE_LIVE" and "MESSAGE_OFFLIVE".
$(eval s = $(twitch $(touser) "{{status}}"); s == 'live' ? $(twitch $(touser) "{{displayName}} is now ${s} MESSAGE_LIVE") : s == 'offline' ?$(twitch $(touser) "{{displayName}} is now ${s} MESSAGE_OFFLIVE") : ``;)
Topaz Jellyfish
Thanks for the help, I am trying this way, it looks like it is working in offline chat.
Polar Cat
Topaz Jellyfish said: it looks like it is working in offline chat.
What do you mean by that? Because that command doesn't send a response when I'm not live, so if it does for you, then you must have made a mistake in editing the code I provided.
Topaz Jellyfish
Oh sorry, I meant that as working as intended (not showing in offline chat). But I messed it up for how it shows when online because now it shows an error:
What I think happened is that the quotes in your code were updated from " and ' to “” and ‘’, which usually happens when the code is copied in a word processor app, such as Microsoft Word for example, the issue is that JavaScript doesn't recognize the latter quotes. To avoid it, copy/paste the code we provide on the forum directly in your Twitch chat, or in Nightbot's dashboard, and edit the code there, or use a note app, they don't usually format the quotes, such as Notepad for example.
Didn't find your answer? The community is on Discord.