Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[about] format uptime, makes it look better #504

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions ballsdex/packages/info/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@ async def about(self, interaction: discord.Interaction):
players_count = await row_count_estimate("player")
balls_instances_count = await row_count_estimate("ballinstance")

days, hours, minutes, seconds = 0, 0, 0, 0
if self.bot.startup_time is not None:
uptime_duration = datetime.now() - self.bot.startup_time
days, remainder = divmod(int(uptime_duration.total_seconds()), 86400)
hours, remainder = divmod(remainder, 3600)
minutes, seconds = divmod(remainder, 60)
formatted_uptime = str(uptime_duration).split(".")[0]
else:
formatted_uptime = "N/A"

assert self.bot.user
assert self.bot.application
Expand Down Expand Up @@ -125,8 +124,7 @@ async def about(self, interaction: discord.Interaction):
f"{' '.join(str(x) for x in balls)}\n"
f"{settings.about_description}\n"
f"*Running version **[{ballsdex_version}]({settings.github_link}/releases)***\n"
f"The bot has been online for **{days} days, {hours} hours, {minutes} minutes, "
f"and {seconds} seconds.**\n\n"
f"The bot has been online for **{formatted_uptime}.**\n\n"
f"**{balls_count:,}** {settings.plural_collectible_name} to collect\n"
f"**{players_count:,}** players that caught "
f"**{balls_instances_count:,}** {settings.plural_collectible_name}\n"
Expand Down
Loading