Hello!
I was wondering if anyone has any clue how could I get this to work properly:
!addcom !setstream -a=!editcom !nextstream $(eval x="$"+"(countdown $(query) US/Eastern)"; if (x.match(/ago/g)) {"User should be đ´Live! (If not, stay tuned!)"} else {"đ´ The next stream is planned in "+x})
Basically I want the !nextstream command to display how long until the next planned stream, and if the countdown reaches 0 (when the timer starts going in reverse) the command will tell the user the Streamer should be live.
The trick is that I want to be able to set the date for !nextstream using !setstream, but if I were to use that command as is in the snippet above, the command would parse the IF and edit !nextstream with the output of the condition, instead of embedding the entire code into it.
I used the trick of â$â+"(countdown)" to make sure the countdown doesnât get parsed until itâs in the right command, but I canât figure out how to do the same for the entire code >_<
Thanks so much in advance!
EDIT NOTE: For those interested yet wondering about the if (x.match(/ago/g))
bit of the code:
When a specific Date is added to the $(countdown) variable, and that countdown reaches zero, the count will go in reverse and Nightbotâs response will look something like "10 seconds ago"
. What the code is doing is searching the response for that word, and if found it means the countdown must have reached 0, so it responds with "The streamer should be live!"
.