Skip to content

Commit 08a551f

Browse files
committed
Mutes Prevent Overflow Error from very large timedeltas
Prevent Mute's converter from allowing timedeltas that would result in a timedelta leading to an OverFlow error.
1 parent 00e41d3 commit 08a551f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

redbot/cogs/mutes/converters.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import logging
44
import re
55
from typing import Optional, TypedDict
6-
from datetime import timedelta
6+
from datetime import timedelta, datetime, timezone
77
from typing_extensions import Annotated
88

99
from discord.ext.commands.converter import Converter
@@ -57,6 +57,8 @@ async def convert(self, ctx: commands.Context, argument: str) -> _MuteTime:
5757
)
5858
try:
5959
result["duration"] = duration = timedelta(**time_data)
60+
datetime.now(timezone.utc) + duration
61+
# Catch if using the timedelta with the current date will also result in an Overflow error
6062
except OverflowError:
6163
raise commands.BadArgument(
6264
_("The time provided is too long; use a more reasonable time.")

0 commit comments

Comments
 (0)