Skip to content

Commit 205fd46

Browse files
committed
Replace all utcnow with just now
1 parent 7a0d9b3 commit 205fd46

14 files changed

Lines changed: 34 additions & 34 deletions

File tree

techsupport_bot/bot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ async def on_ready(self: Self) -> None:
218218
"""Callback for when the bot is finished starting up.
219219
This function may be called more than once and should not have discord interactions in it
220220
"""
221-
self.startup_time = datetime.datetime.utcnow()
221+
self.startup_time = datetime.datetime.now()
222222
await self.logger.send_log(
223223
message="Bot online", level=LogLevel.INFO, console_only=True
224224
)
@@ -242,7 +242,7 @@ async def log_DM(self: Self, sent_from: str, source: str, content: str) -> None:
242242
embed = auxiliary.generate_basic_embed(
243243
f"{source} recieved a PM", f"PM from: {sent_from}\n{content}"
244244
)
245-
embed.timestamp = datetime.datetime.utcnow()
245+
embed.timestamp = datetime.datetime.now()
246246
await owner.send(embed=embed)
247247

248248
async def on_message(self: Self, message: discord.Message) -> None:
@@ -362,7 +362,7 @@ async def write_new_config(self: Self, guild_id: str, config: str) -> None:
362362
).gino.first()
363363
if database_config:
364364
await database_config.update(
365-
config=str(config), update_time=datetime.datetime.utcnow()
365+
config=str(config), update_time=datetime.datetime.now()
366366
).apply()
367367
else:
368368
new_database_config = self.models.Config(

techsupport_bot/botlogging/embed.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(self: Self, message: str) -> None:
2727
super().__init__(
2828
title=self.title.upper(), description=message, color=self.color
2929
)
30-
self.timestamp = datetime.datetime.utcnow()
30+
self.timestamp = datetime.datetime.now()
3131

3232
def modify_embed(self: Self, embed: discord.Embed) -> discord.Embed:
3333
"""This modifies an existing embed to match with the LogEmbed style
@@ -41,7 +41,7 @@ def modify_embed(self: Self, embed: discord.Embed) -> discord.Embed:
4141
embed.title = self.title
4242
embed.color = self.color
4343
embed.description = self.description
44-
embed.timestamp = datetime.datetime.utcnow()
44+
embed.timestamp = datetime.datetime.now()
4545

4646
return embed
4747

techsupport_bot/commands/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ async def patch_config(self: Self, ctx: commands.Context) -> None:
109109

110110
json_file = discord.File(
111111
io.StringIO(json.dumps(json_config, indent=4)),
112-
filename=f"{ctx.guild.id}-config-{datetime.datetime.utcnow()}.json",
112+
filename=f"{ctx.guild.id}-config-{datetime.datetime.now()}.json",
113113
)
114114

115115
await ctx.send(file=json_file)

techsupport_bot/commands/factoids.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,7 @@ async def _json(self: Self, ctx: commands.Context, factoid_name: str) -> None:
14571457
json_file = discord.File(
14581458
io.StringIO(formatted),
14591459
filename=(
1460-
f"{aliases_list[0]}-factoid-embed-config-{datetime.datetime.utcnow()}.json"
1460+
f"{aliases_list[0]}-factoid-embed-config-{datetime.datetime.now()}.json"
14611461
),
14621462
)
14631463

@@ -1892,7 +1892,7 @@ async def send_factoids_as_file(
18921892
yaml_file = discord.File(
18931893
io.StringIO(yaml.dump(output_data)),
18941894
filename=(
1895-
f"factoids-for-server-{guild.id}-{datetime.datetime.utcnow()}.yaml"
1895+
f"factoids-for-server-{guild.id}-{datetime.datetime.now()}.yaml"
18961896
),
18971897
)
18981898

techsupport_bot/commands/hangman.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def __init__(self: Self, word: str, max_guesses: int = 6) -> None:
129129
self.guesses = set()
130130
self.step = 0
131131
self.max_guesses = max_guesses
132-
self.started = datetime.datetime.utcnow()
132+
self.started = datetime.datetime.now()
133133
self.id = uuid.uuid4()
134134

135135
def draw_word_state(self: Self) -> str:

techsupport_bot/commands/listen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def format_message_in_embed(self: Self, message: discord.Message) -> discord.Emb
6060
"""
6161
embed = auxiliary.generate_basic_embed(description=message.clean_content)
6262

63-
embed.timestamp = datetime.datetime.utcnow()
63+
embed.timestamp = datetime.datetime.now()
6464
embed.set_author(
6565
name=message.author.name, icon_url=message.author.display_avatar.url
6666
)

techsupport_bot/commands/members.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async def get_members_with_role(
9191
yaml_file = discord.File(
9292
io.StringIO(yaml.dump(yaml_output_data)),
9393
filename=f"members-with-{role.name}-in"
94-
+ f"-{ctx.guild.id}-{datetime.datetime.utcnow()}.yaml",
94+
+ f"-{ctx.guild.id}-{datetime.datetime.now()}.yaml",
9595
)
9696

9797
await ctx.send(file=yaml_file)

techsupport_bot/commands/modmail.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ async def on_message_edit(
165165
title="Message edit",
166166
description=f"Message ID: {before.id}",
167167
)
168-
embed.timestamp = datetime.utcnow()
168+
embed.timestamp = datetime.now()
169169

170170
# This is here to save space if this listener is triggered by something other than
171171
# a content modification, i.e. a message being pinned
@@ -318,7 +318,7 @@ async def handle_dm(message: discord.Message) -> None:
318318

319319
embed = discord.Embed(color=discord.Color.blue(), description=message.content)
320320
embed.set_footer(text=f"Message ID: {message.id}")
321-
embed.timestamp = datetime.utcnow()
321+
embed.timestamp = datetime.now()
322322
if message.author.avatar:
323323
embed.set_author(name=message.author, icon_url=message.author.avatar.url)
324324
else:
@@ -495,7 +495,7 @@ async def create_thread(
495495
# has to be done like this because of member handling
496496
embed.description = description
497497
embed.set_author(name=user, icon_url=url)
498-
embed.timestamp = datetime.utcnow()
498+
embed.timestamp = datetime.now()
499499
embed.set_footer(text=f"User ID: {user.id}")
500500

501501
# Handling for roles to ping, not performed if the func was invoked by the contact command
@@ -523,7 +523,7 @@ async def create_thread(
523523
embed = discord.Embed(color=discord.Color.blue(), description=message.content)
524524
embed.set_author(name=user, icon_url=url)
525525
embed.set_footer(text=f"Message ID: {message.id}")
526-
embed.timestamp = datetime.utcnow()
526+
embed.timestamp = datetime.now()
527527

528528
attachments = None
529529
if message.attachments:
@@ -541,7 +541,7 @@ async def create_thread(
541541
)
542542
embed.set_author(name="Thread Created")
543543
embed.set_footer(text="Your message has been sent.")
544-
embed.timestamp = datetime.utcnow()
544+
embed.timestamp = datetime.now()
545545

546546
await message.author.send(embed=embed)
547547

@@ -634,7 +634,7 @@ async def reply_to_thread(
634634
# No need to reconfirm
635635
user_attachments = await build_attachments(thread=thread, message=message)
636636

637-
embed.timestamp = datetime.utcnow()
637+
embed.timestamp = datetime.now()
638638
embed.set_footer(text="Response")
639639

640640
if automatic:
@@ -701,7 +701,7 @@ async def close_thread(
701701
embed.set_footer(
702702
text="Closing will be cancelled if a message is sent, or if the command is run again."
703703
)
704-
embed.timestamp = datetime.utcnow()
704+
embed.timestamp = datetime.now()
705705

706706
await thread.send(embed=embed)
707707

@@ -766,7 +766,7 @@ async def close_thread(
766766
description="Please wait 24 hours before creating a new one.",
767767
)
768768
embed.set_author(name="Thread Closed")
769-
embed.timestamp = datetime.utcnow()
769+
embed.timestamp = datetime.now()
770770

771771
await user.send(embed=embed)
772772

@@ -813,7 +813,7 @@ async def log_closure(
813813
icon_url=closed_by.avatar.url,
814814
text=f"Thread closed by {closed_by.name}",
815815
)
816-
embed.timestamp = datetime.utcnow()
816+
embed.timestamp = datetime.now()
817817

818818
await log_channel.send(embed=embed)
819819

@@ -1347,7 +1347,7 @@ async def modmail_commands(self: Self, ctx: commands.Context) -> None:
13471347
description=f"*You can use these by typing `{prefix}<command>` in a modmail thread*",
13481348
title="Modmail commands",
13491349
)
1350-
embed.timestamp = datetime.utcnow()
1350+
embed.timestamp = datetime.now()
13511351

13521352
# First three are reply commands
13531353
for command in list_of_modmail_commands[:3]:

techsupport_bot/commands/protect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ async def purge_duration(
12511251
)
12521252
return
12531253

1254-
timestamp = datetime.datetime.utcnow() - datetime.timedelta(
1254+
timestamp = datetime.datetime.now() - datetime.timedelta(
12551255
minutes=duration_minutes
12561256
)
12571257

techsupport_bot/commands/rules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ async def edit_rules(self: Self, ctx: commands.Context) -> None:
127127

128128
json_file = discord.File(
129129
io.StringIO(json.dumps(rules_data, indent=4)),
130-
filename=f"{ctx.guild.id}-rules-{datetime.datetime.utcnow()}.json",
130+
filename=f"{ctx.guild.id}-rules-{datetime.datetime.now()}.json",
131131
)
132132

133133
await ctx.send(content="Re-upload this file to apply new rules", file=json_file)

0 commit comments

Comments
 (0)