Combined Timer Command

duhhh… l feel… ughhh; Thank you!

1 Like

How different would it be if I wanted to also use seconds? like “!timer s 90” or “!timer m 2”

I understand that !timer currently checks that it is a number between 1 and 5 so would need different logic . I still don’t quite understand the 60000 so not too sure how to change !timer

if the first character is m, allow from 1-5, then use _timer
else character is s, allow from 30 to 600, then use _timers

Feel free to tell me to shush :smiley:

The 60000 is in milliseconds, because the API works with milliseconds, so it’s 1 minute.
Therefore, if you want to use seconds, there isn’t much to edit:

!addcom !timer -a=_timer $(eval q=`$(1)`; isNaN(q)||q<5?i=5000:q>300?i=300000:i=q*1000;i)
!addcom _timer $(urlfetch https://vxrl.xyz/smm/$(eval `${$(query)/1000} seconds timer starting...`)/The timer ended.?i=$(query)&d=1)
1 Like

is this a second command? How is this used?

Yes, and same as before, just with the number of seconds, so for 1min30s for example, it’s !timer 90, just like you asked.

Oh, sorry, I completely misread your message…
Well, okay, if you want to start including m and s as extra variables, it’s gonna be a bit different.

So I’ll make the command default to seconds, therefore if you don’t specify m it’ll be seconds, and whether you specify m before or after the number won’t matter either:

!addcom !timer -a=_timer $(eval q=`$(query)`.toLowerCase(); n=q.match(/\s*\d+\s*/i); n?n=n[0]:n=0; if(q.includes(`m`)){n*=60} n<5?i=5*1000:n>290?i=290*1000:i=n*1000;i)
!addcom _timer $(urlfetch https://vxrl.xyz/smm/$(eval `${Math.floor($(query)/(60*1000))} minute(s) and ${($(query)/1000)%60} seconds timer starting...`)/The timer ended.?i=$(query)&d=1)

Edit: it appears the maximum amount of time allowed by the API is 4 minutes 50 seconds, and not 5 minutes, so I updated the code accordingly.

1 Like

@Emily YOU’RE NUTS… I finally got a chance to add it and I love it!!! I wish I knew how to split up code logic in my brain like you do!

1 Like

Glad to hear! And it’s just practice, I was a beginner and didn’t know much a few years ago. :wink:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.