Skip to content

Commit 239ee7d

Browse files
committed
refactor: improve bot uptime formatting in ping command
1 parent 3e97a4c commit 239ee7d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tux/cogs/utility/ping.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,13 @@ async def ping(self, ctx: commands.Context[Tux]) -> None:
4444
minutes, seconds = divmod(remainder, 60)
4545

4646
# Format it for the command
47-
bot_uptime_readable = " ".join(
48-
[f"{days}d" if days else "", f"{hours}h" if hours else "", f"{minutes}m" if minutes else "", f"{seconds}s"],
49-
).strip()
47+
bot_uptime_parts = [
48+
f"{days}d" if days else "",
49+
f"{hours}h" if hours else "",
50+
f"{minutes}m" if minutes else "",
51+
f"{seconds}s",
52+
]
53+
bot_uptime_readable = " ".join(part for part in bot_uptime_parts if part).strip()
5054

5155
# Get the CPU usage and RAM usage of the bot
5256
cpu_usage = psutil.Process().cpu_percent()

0 commit comments

Comments
 (0)