Skip to content

Commit

Permalink
Adjusted last active and death time formatting to account for these v…
Browse files Browse the repository at this point in the history
…ariables already being datetime objects. strptime is unneccesary
  • Loading branch information
TanyaPegasus authored and connorhsm committed Sep 6, 2023
1 parent ef94b63 commit 82aaaff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions dictator/cogs/informational.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ async def info(self, interaction: discord.Interaction, user: discord.User) -> No
member = interaction.guild.get_member(user.id)

# Time formatting
last_active = datetime.strptime(user_info[3], "%Y-%m-%d %H:%M:%S")
last_active = last_active.replace(tzinfo=timezone.utc)
last_active = user_info[3].replace(tzinfo=timezone.utc)
now = discord.utils.utcnow()
difference = humanize.naturaltime(now - last_active)
joined_guild = humanize.naturaltime(now - member.joined_at)
Expand Down
3 changes: 1 addition & 2 deletions dictator/cogs/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,7 @@ async def whowas(

else:
# Format death time as timezone aware
death_time = datetime.strptime(u[1], "%Y-%m-%d %H:%M:%S")
death_time = death_time.replace(tzinfo=timezone.utc)
death_time = u[1].replace(tzinfo=timezone.utc)
difference = humanize.naturaltime(discord.utils.utcnow() - death_time)
embed.add_field(name="Username:", value=f"{u[2]}", inline=True)
embed.add_field(name="Member:", value=f"{found_user}", inline=True)
Expand Down

0 comments on commit 82aaaff

Please sign in to comment.