fix uptime for uptime of less than a second (#3009)

* fix uptime for uptime of less than a second

* changelog

* More conclusive fix
This commit is contained in:
Michael H
2019-09-28 15:35:26 -04:00
committed by GitHub
parent c288185a16
commit e38c08ab12
3 changed files with 13 additions and 3 deletions

View File

@@ -327,9 +327,10 @@ class Core(commands.Cog, CoreLogic):
"""Shows Red's uptime"""
since = ctx.bot.uptime.strftime("%Y-%m-%d %H:%M:%S")
delta = datetime.datetime.utcnow() - self.bot.uptime
uptime_str = humanize_timedelta(timedelta=delta) or _("Less than one second")
await ctx.send(
_("Been up for: **{}** (since {} UTC)").format(
humanize_timedelta(timedelta=delta), since
_("Been up for: **{time_quantity}** (since {timestamp} UTC)").format(
time_quantity=uptime_str, timestamp=since
)
)