connexions: test

This commit is contained in:
Amazed 2020-09-26 18:00:38 +02:00
parent 8a448834f8
commit 4337af8d54
1 changed files with 6 additions and 6 deletions

View File

@ -361,19 +361,19 @@ class WynncraftCog(commands.Cog):
async def connexions(self, ctx): async def connexions(self, ctx):
def td_format(seconds): def td_format(seconds):
periods = [ periods = [
('year', 60 * 60 * 24 * 365), ('an', 60 * 60 * 24 * 365),
('month', 60 * 60 * 24 * 30), ('mois', 60 * 60 * 24 * 30),
('day', 60 * 60 * 24), ('jour', 60 * 60 * 24),
('hour', 60 * 60), ('heure', 60 * 60),
('minute', 60), ('minute', 60),
('second', 1) ('seconde', 1)
] ]
strings = [] strings = []
for period_name, period_seconds in periods: for period_name, period_seconds in periods:
if seconds > period_seconds: if seconds > period_seconds:
period_value, seconds = divmod(seconds, period_seconds) period_value, seconds = divmod(seconds, period_seconds)
has_s = 's' if period_value > 1 else '' has_s = 's' if period_value > 1 and period_name != "mois" else ''
strings.append("%s %s%s" % (int(period_value), period_name, has_s)) strings.append("%s %s%s" % (int(period_value), period_name, has_s))
break break