mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Use discord native timestamp in [p]uptime (#5323)
* support for discord's timestamp on uptime * woops not supposed to remove `_`. * ups * ups x2 * Apply suggested change. * hehe
This commit is contained in:
parent
cbbb9d9b9b
commit
d69326b1fe
@ -558,12 +558,12 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
@commands.command()
|
@commands.command()
|
||||||
async def uptime(self, ctx: commands.Context):
|
async def uptime(self, ctx: commands.Context):
|
||||||
"""Shows [botname]'s uptime."""
|
"""Shows [botname]'s uptime."""
|
||||||
since = ctx.bot.uptime.strftime("%Y-%m-%d %H:%M:%S")
|
|
||||||
delta = datetime.datetime.utcnow() - self.bot.uptime
|
delta = datetime.datetime.utcnow() - self.bot.uptime
|
||||||
uptime_str = humanize_timedelta(timedelta=delta) or _("Less than one second")
|
uptime = self.bot.uptime.replace(tzinfo=datetime.timezone.utc)
|
||||||
|
uptime_str = humanize_timedelta(timedelta=delta) or _("Less than one second.")
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
_("Been up for: **{time_quantity}** (since {timestamp} UTC)").format(
|
_("Been up for: **{time_quantity}** (since {timestamp})").format(
|
||||||
time_quantity=uptime_str, timestamp=since
|
time_quantity=uptime_str, timestamp=f"<t:{int(uptime.timestamp())}:f>"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user