Share feedback, ideas and get community help

Updated 10 months ago

How can i split the bot depending the real hour time ?

I use the bot to give support, and i would like to do this:

Its working hour ? > goes to Chatwoot
Its night ? > goes to create a ticket

How can i do that ? javascript maybe ?
V
a
5 comments
You can use the set variable to now, and do whatever you want with the time variable.
Attachment
image.png
But to easy manipulate just the time, I would do something like this:
Plain Text
const now = new Date();
return now.getHours() + now.getMinutes() / 60;
`
This way, time will be translated to a number:
9:30 would be 9.5
17:45 would be 17.75
It works like charm !! thanks !!!
Add a reply
Sign up and join the conversation on Discord