Hi I’m trying to make an if/than shoutout command that recognizes that the user hasn’t played a game, and therefore isn’t likely to stream…
I have no idea what I’m doing lol but after a few hours this is the closest I could come up with…
$(eval var r = true; if(‘twitch game $(touser)’ == ‘no game’) r = ‘They don’t stream’; else ‘check out $(touser) They were last playing $(twitch game $(touser))’
It’s not recognizing the “no game” like I thought it might…
@astrohippieet I don’t know much about the JavaScript, as far I know. if else should be like this:
if (condition) {
// block of code to be executed if the condition is true
} else {
// block of code to be executed if the condition is false
}
Or there is a shortcut
condition ? exprIfTrue : exprIfFalse
In your case, it’s bit different. consider using toLowerCase(). Tho’ it’s not needed I guess.
$(eval “$(twitch game $(touser))”.toLowerCase() == “no game” ? “They don’t stream” : “Check out $(touser). They were last playing $(twitch game $(touser))”)
Regards
Edit
$(eval '$(twitch $(touser) "{{game}}")'.toLowerCase() == 'no game' ? 'They do not stream' : 'Check out $(touser). They were last playing $(twitch $(touser) "{{game}}")')
Thank you both so much, again I’m very new to this and made the original command by Frankenstein-ing some other commands I could find lol I appreciate it so much!