mirror of
https://github.com/osmarks/autobotrobot
synced 2025-01-09 15:10:27 +00:00
fixed timedelta thing
This commit is contained in:
parent
0ef9aaa8c3
commit
fd4585a12f
@ -72,17 +72,18 @@ timeparts = (
|
||||
("y", "years"),
|
||||
("mo", "months"),
|
||||
("d", "days"),
|
||||
("h", "hours"),
|
||||
("m", "minutes"),
|
||||
("s", "seconds")
|
||||
)
|
||||
|
||||
def format_timedelta(from_, to):
|
||||
d = relativedelta(to, from_)
|
||||
out = "0s" if d.seconds == 0 else ""
|
||||
out = ""
|
||||
for short, attr in timeparts:
|
||||
x = getattr(d, attr)
|
||||
if x != 0: out += str(x) + short
|
||||
return out
|
||||
return "0s" if out == "" else out
|
||||
|
||||
CODEBLOCK_REGEX = "^[^`]*```[a-zA-Z0-9_\-+]*\n(.+)```$"
|
||||
CODELINE_REGEX = "^[^`]*`(.*)`$"
|
||||
|
Loading…
Reference in New Issue
Block a user