From e05d473668a18282033634f90616f9039a6c3cc3 Mon Sep 17 00:00:00 2001 From: Outlandish0191 Date: Wed, 29 May 2024 21:33:12 -0500 Subject: [PATCH 1/2] changed uptime command to use discord formatted timestamp --- bot/exts/core/ping.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/bot/exts/core/ping.py b/bot/exts/core/ping.py index cb32398e0a..7fef6e6a8f 100644 --- a/bot/exts/core/ping.py +++ b/bot/exts/core/ping.py @@ -2,6 +2,7 @@ from dateutil.relativedelta import relativedelta from discord import Embed from discord.ext import commands +from discord.utils import format_dt from bot import start_time from bot.bot import Bot @@ -29,16 +30,7 @@ async def ping(self, ctx: commands.Context) -> None: @commands.command(name="uptime") async def uptime(self, ctx: commands.Context) -> None: """Get the current uptime of the bot.""" - difference = relativedelta(start_time - arrow.utcnow()) - uptime_string = start_time.shift( - seconds=-difference.seconds, - minutes=-difference.minutes, - hours=-difference.hours, - days=-difference.days - ).humanize() - - await ctx.send(f"I started up {uptime_string}.") - + await ctx.reply(f"I started up {format_dt(start_time.datetime, 'R')}.") async def setup(bot: Bot) -> None: """Load the Ping cog.""" From dc815d443ad18880b65d214073547a53248bcbb0 Mon Sep 17 00:00:00 2001 From: Outlandish0191 Date: Wed, 29 May 2024 21:33:28 -0500 Subject: [PATCH 2/2] added formatting to ping command --- bot/exts/core/ping.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/core/ping.py b/bot/exts/core/ping.py index 7fef6e6a8f..91601ec831 100644 --- a/bot/exts/core/ping.py +++ b/bot/exts/core/ping.py @@ -21,7 +21,7 @@ async def ping(self, ctx: commands.Context) -> None: embed = Embed( title=":ping_pong: Pong!", colour=Colours.bright_green, - description=f"Gateway Latency: {round(self.bot.latency * 1000)}ms", + description=f"Gateway Latency: `{round(self.bot.latency * 1000)}`ms", ) await ctx.send(embed=embed)