Hi! I am trying to set up a command that counts the days since last PB, but can’t figure out how to set it up with a customized output in the form of only stating the days since.
I have done:
!addcom !lastpb It has been $(countup Jan 06 2022 America/Los_Angeles) since last PB
However the output of this is:
“It has been 6 months 13 days 6 hours 35 minutes since last PB”
Whereas I want the command’s output to have the time-format of “It has been 194 days since last PB”
Does anyone know how to set this up? It doesn’t have to be based off my original command in any way, I just want it to be formatted as only counting days hehe
On the Nightbot docs i looked up “time”
and I found “countup” variables. Perhaps this count help you?
I used the days since Christmas example:
!commands add !pb It has been days since last pb $(countup Dec 25 2014 12:00:00 AM EST)
The wording could be changed around a bit to make more sense but it does work.
This isn’t possible because of how the library used under the hood does things.
What we usually do is cut the response in categories, then multiply each value by a “magic” number (called magic because they’re “arbitrary,” static and will generate erroneous conversions: a month has between 28 and 31 days, a year is either 365 or 366 days, that’s difficult to keep up with).
You can see an example of a similar command here, but for them it works because they wouldn’t stream for more than a day or so, they don’t reach months.
That’s my bad I didn’t read this properly at all Sorry
I hope this works.
It has been $(eval d = new Date('1/6/2022'); $(urlfetch json https://pastebin.com/raw/w4qiZbX0)) days since last PB
That’s a good suggestion! I wanted to try something similar, but I didn’t have time.
It will work properly with the following fixes:
- have the date under the format:
1 to the result
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.