Skip to content

Commit a6d8b70

Browse files
committed
Fix invalid argument handling
1 parent 2d8469f commit a6d8b70

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

forward/forward.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import discord
44
import uuid
55
from .converters import str_to_timedelta
6-
from datetime import datetime, timezone
6+
from datetime import datetime, timezone, timedelta
77
import asyncio
88
import logging
99

@@ -278,6 +278,7 @@ async def tblock(self, ctx, user: discord.Member, time: Optional[str] = "5d"):
278278
userid = str(user.id)
279279
if userid not in blocked:
280280
duration = str_to_timedelta(duration=time).get("duration")
281+
duration = duration if type(duration) is timedelta else str_to_timedelta(duration="5d").get("duration")
281282
blocked[userid] = (datetime.now(timezone.utc) + duration).timestamp() # until
282283
await ctx.maybe_send_embed("Blocked <@{id}> from sending messages to the bot until {until}.".format(id=userid, until=datetime.fromtimestamp(blocked[userid])))
283284
else:

0 commit comments

Comments
 (0)