Skip to content

Commit

Permalink
A more precise display of time player for info command
Browse files Browse the repository at this point in the history
  • Loading branch information
connorhsm committed Aug 5, 2023
1 parent 5578b49 commit 2b1828b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dictator/cogs/informational.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from db_manager import db_connection as db_conn
import datetime
import math


class Informational(commands.Cog):
Expand Down Expand Up @@ -71,7 +72,7 @@ async def info(self, interaction: discord.Interaction, user: discord.User) -> No
title=f"Results for the user '{user.name}':", colour=0xFFBB35
)
embed.add_field(
name="Time played:", value=f"{round(user_info[0] / 60, 1)} hours"
name="Time played:", value=f"{math.floor(user_info[0]/60)}h {user_info[0]%60}m"
)
embed.add_field(name="Blocked:", value="Yes" if user_info[1] else "No")
embed.add_field(
Expand Down
2 changes: 1 addition & 1 deletion dictator/cogs/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ async def assign_role(self, interaction: discord.Interaction, role, reason) -> N
role_object = discord.utils.get(interaction.guild.roles, name=role)
await interaction.user.add_roles(role_object, reason=reason)

def playtime_less_than(self, discord_id, less_than_minutes) -> bool:
def playtime_less_than(self, discord_id: discord.User.id, less_than_minutes: int) -> bool:
with db_conn() as db:
db.execute(
f"SELECT time_played FROM ticketServer_tickets WHERE discord_id = {discord_id}"
Expand Down

1 comment on commit 2b1828b

@connorhsm
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolves #108

Please sign in to comment.