Skip to content

Commit 0591b2c

Browse files
committed
Use consistent time module import
1 parent 3af14eb commit 0591b2c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

bot/exts/moderation/slowmode.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from bot.converters import Duration, DurationDelta
1414
from bot.log import get_logger
1515
from bot.utils import time
16-
from bot.utils.time import format_relative, humanize_delta
1716

1817
log = get_logger(__name__)
1918

@@ -57,7 +56,7 @@ async def get_slowmode(self, ctx: Context, channel: MessageHolder) -> None:
5756
if cached_data is not None:
5857
original_delay, expiration_time = cached_data.partition(", ")
5958
humanized_original_delay = time.humanize_delta(seconds=int(original_delay))
60-
expiration_timestamp = format_relative(expiration_time)
59+
expiration_timestamp = time.format_relative(expiration_time)
6160
await ctx.send(
6261
f"The slowmode delay for {channel.mention} is {humanized_delay}"
6362
f" and will revert to {humanized_original_delay} {expiration_timestamp}."
@@ -104,7 +103,7 @@ async def set_slowmode(
104103
return
105104

106105
if expiry is not None:
107-
expiration_timestamp = format_relative(expiry)
106+
expiration_timestamp = time.format_relative(expiry)
108107

109108
# Only cache the original slowmode delay if there is not already an ongoing temporary slowmode.
110109
if not await self.slowmode_cache.contains(channel.id):
@@ -114,12 +113,12 @@ async def set_slowmode(
114113
delay_to_cache = cached_data.split(", ")[0]
115114
self.scheduler.cancel(channel.id)
116115
await self.slowmode_cache.set(channel.id, f"{delay_to_cache}, {expiry}")
117-
humanized_original_delay = humanize_delta(seconds=int(delay_to_cache))
116+
humanized_original_delay = time.humanize_delta(seconds=int(delay_to_cache))
118117

119118
self.scheduler.schedule_at(expiry, channel.id, self._revert_slowmode(channel.id))
120119
log.info(
121120
f"{ctx.author} set the slowmode delay for #{channel} to {humanized_delay}"
122-
f" which will revert to {humanized_original_delay} in {humanize_delta(expiry)}."
121+
f" which will revert to {humanized_original_delay} in {time.humanize_delta(expiry)}."
123122
)
124123
await channel.edit(slowmode_delay=slowmode_delay)
125124
await ctx.send(

0 commit comments

Comments
 (0)