Skip to content

Commit 13138fd

Browse files
committed
Store timestamp instead of DateTime object
1 parent 78f9d39 commit 13138fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

forward/forward.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,10 @@ async def tblock(self, ctx, user: discord.Member, time: Optional[MuteTime] = Non
252252
userid = str(user.id)
253253
if userid not in blocked:
254254
duration = time.get("duration") if time else MuteTime("5d").get("duration")
255-
blocked[userid] = datetime.now(timezone.utc) + duration # until
256-
await ctx.maybe_send_embed("Blocked <@{id}> from send messages to the bot until {until}.".format(id=userid, until=humanize_timedelta(timedelta=blocked[userid])))
255+
blocked[userid] = (datetime.now(timezone.utc) + duration).timestamp() # until
256+
await ctx.maybe_send_embed("Blocked <@{id}> from send messages to the bot until {until}.".format(id=userid, until=humanize_timedelta(timedelta=datetime.datetime.fromtimestamp(blocked[userid]))))
257257
else:
258-
await ctx.maybe_send_embed("This user is already blocked until {}.".format(humanize_timedelta(timedelta=blocked[userid])))
258+
await ctx.maybe_send_embed("This user is already blocked until {}.".format(humanize_timedelta(timedelta=timedelta=datetime.datetime.fromtimestamp(blocked[userid]))))
259259

260260
@commands.command()
261261
@commands.guild_only()
@@ -280,7 +280,7 @@ async def tcheckblock(self, ctx, user: discord.Member):
280280
async with self.config.blocked() as blocked:
281281
userid = str(user.id)
282282
if userid in blocked:
283-
await ctx.maybe_send_embed("User <@{id}> is blocked until.".format(id=userid, until=humanize_timedelta(timedelta=blocked[userid])))
283+
await ctx.maybe_send_embed("User <@{id}> is blocked until.".format(id=userid, until=humanize_timedelta(timedelta=datetime.datetime.fromtimestamp(blocked[userid]))))
284284
else:
285285
await ctx.maybe_send_embed("This user is not blocked.")
286286

0 commit comments

Comments
 (0)