So I’m trying to use the $(twitch) variable. It’s cool and all. But I don’t like how it gives way too many details. So I edited the message with this:
$(twitch $(query) “{{displayName}} is now live! They’re currently playing {{game}} for {{uptimeLength}} for {{viewers}} viewers. Here’s the link to their channel! → {{url}}”)
However, when I use this code for an offline channel, say, mine currently, it goes like this:
UltraGaming_1001 is now live! They’re currently playing Genshin Impact for channel is not live for 0 viewers. Here’s the link to their channel! → Twitch
And this is what happens when I put an invalid channel:
Error: internal server error
While the invalid channel is already fine, I want to make it more interactive. However, I have no idea how the conditional commands (if/else if/else), var, and $(eval) totally work. The only thing I use $(eval) for is for my “!math” command, and the response is just “Easy! The answer is $(eval)”, so I’ve not really fiddled with $(eval). Also I’m too lazy to make it work on my own, so can someone get me some code for that? I want it to go like this:
If the channel is online: $(twitch $(query) “{{displayName}} is now live! They’re currently playing {{game}} for {{uptimeLength}} for {{viewers}} viewers. Here’s the link to their channel! → {{url}}”)
If the channel is offline: $(twitch $(query) “{{displayName}} is currently offline, but here’s the link to their channel! → {{url}}”)
If the $(query) input is invalid:- In-Twitch Response: Bozo, you dreamin’ or somethin’? That channel ain’t existin’, snap out of it!
Hey @UltraGaming_1001!
Thank you for giving all these details, I really appreciate it, if you could have made your text breathe a bit that would have been better, but at least you gave me what lacks most of the time.
Here’s the command you’re looking for:
$(eval s = `$(twitch $(touser) "{{status}}")`; s === 'live' ? `$(twitch $(touser) "{{displayName}} is now ${s}! They're currently playing {{game}} for {{uptimeLength}} for {{viewers}} viewers. Here's the link to their channel! → {{url}}")` : s === 'offline' ? `$(twitch $(touser) "{{displayName}} is currently ${s}, but here's the link to their channel! → {{url}}")` : `Bozo, you dreamin' or somethin'? That channel ain't existin', snap out of it!`;)
I like to understand a few things, so what does $(touser) do? I remember using it a lot before, but that was about a year ago, so I have forgotten about it.
Also another thing, this is more of a status command, but it is sort of a shoutout command if users misuse it. Thus why I have made it a Moderator command. It can be used as a lazy-to-use command, where if someone were to raid/host, they can just type this command and get the details instead of having to load up the given streamer on the browser, this can be used for devices that take a lot of time to load in the browser.
Also I’ve tried out the command, it totally works! Thanks. A. LOT!
Have a read of the nightbot docs: ToUser - Nightbot Docs
“The touser variable just prints the first argument given to a command.”
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.