Skip to content

Commit

Permalink
[Discord] Update to use datetime.UTC alias in timestamp command
Browse files Browse the repository at this point in the history
  • Loading branch information
Harmon758 committed Dec 18, 2023
1 parent a672aa1 commit 7a21e6d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Discord/cogs/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ async def timestamp(
if ID:
ID = ID.id
time = discord.utils.snowflake_time(ID).replace(
tzinfo = datetime.timezone.utc
tzinfo = datetime.UTC
)
await ctx.embed_reply(
f"{discord.utils.format_dt(time)}\n{time}"
Expand All @@ -391,7 +391,7 @@ async def timestamp(
elif ctx.message.reference:
ID = ctx.message.reference.message_id
time = discord.utils.snowflake_time(ID).replace(
tzinfo = datetime.timezone.utc
tzinfo = datetime.UTC
)
referenced_message = (
ctx.message.reference.cached_message or
Expand All @@ -408,7 +408,7 @@ async def timestamp(

if time:
time = time.replace("from now", "")
now = datetime.datetime.now(datetime.timezone.utc)
now = datetime.datetime.now(datetime.UTC)
if not (matches := self.calendar.nlp(time, sourceTime = now)):
raise commands.BadArgument("Invalid time")
parsed_datetime, context, start_pos, end_pos, matched_text = matches[0]
Expand All @@ -418,10 +418,10 @@ async def timestamp(
second = now.second, microsecond = now.microsecond
)
time = parsed_datetime.replace(
tzinfo = datetime.timezone.utc
tzinfo = datetime.UTC
)
else:
time = datetime.datetime.now(datetime.timezone.utc)
time = datetime.datetime.now(datetime.UTC)

t = discord.utils.format_dt(time, style = 't')
T = discord.utils.format_dt(time, style = 'T')
Expand Down

0 comments on commit 7a21e6d

Please sign in to comment.