Hello! I am trying to make a command that will return a message if my current time is in between a certain time frame, but I keep getting error messages like “unexpected identifier” and “Unexpected token ‘<=’”. I’ve searched the forums and google and I’m not new to coding but JS is a bit confusing, so would appreciate any help/suggestions!
Command code:
$(eval var a = “$(time timezone “H:mm”)”;
var b = false;
if (a >= “22:30” && <= “6:00”) b = true;
else if (a >= “6:00” && <= “22:30”) b = false;)
Here’s the thing: 22:30 and 6:00 aren’t numbers, but text, therefore you can’t use the greater/lesser than comparison.
You can however get numbers from the $(time) variable, and then do the comparison.
Also, I understand that true is for the time period it’ll send a message, and false should result in no message, if that’s not the case, your explanation isn’t clear.
I’ll also simplify your code a bit: