fix(aurora): fixed an out of range value error if you ban someone for 30000000 years
This commit is contained in:
parent
ddb9f30d6f
commit
ba7a5f9208
1 changed files with 11 additions and 14 deletions
|
@ -19,8 +19,7 @@ from redbot.core import app_commands, commands, data_manager
|
||||||
from redbot.core.app_commands import Choice
|
from redbot.core.app_commands import Choice
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core.commands.converter import parse_relativedelta, parse_timedelta
|
from redbot.core.commands.converter import parse_relativedelta, parse_timedelta
|
||||||
from redbot.core.utils.chat_formatting import (box, error, humanize_list,
|
from redbot.core.utils.chat_formatting import box, error, humanize_list, warning
|
||||||
warning)
|
|
||||||
|
|
||||||
from aurora.importers.aurora import ImportAuroraView
|
from aurora.importers.aurora import ImportAuroraView
|
||||||
from aurora.importers.galacticbot import ImportGalacticBotView
|
from aurora.importers.galacticbot import ImportGalacticBotView
|
||||||
|
@ -29,18 +28,10 @@ from aurora.menus.guild import Guild
|
||||||
from aurora.menus.immune import Immune
|
from aurora.menus.immune import Immune
|
||||||
from aurora.menus.overrides import Overrides
|
from aurora.menus.overrides import Overrides
|
||||||
from aurora.utilities.config import config, register_config
|
from aurora.utilities.config import config, register_config
|
||||||
from aurora.utilities.database import (connect, create_guild_table, fetch_case,
|
from aurora.utilities.database import connect, create_guild_table, fetch_case, mysql_log
|
||||||
mysql_log)
|
from aurora.utilities.factory import addrole_embed, case_factory, changes_factory, evidenceformat_factory, guild_embed, immune_embed, message_factory, overrides_embed
|
||||||
from aurora.utilities.factory import (addrole_embed, case_factory,
|
|
||||||
changes_factory, evidenceformat_factory,
|
|
||||||
guild_embed, immune_embed,
|
|
||||||
message_factory, overrides_embed)
|
|
||||||
from aurora.utilities.logger import logger
|
from aurora.utilities.logger import logger
|
||||||
from aurora.utilities.utils import (check_moddable, check_permissions,
|
from aurora.utilities.utils import check_moddable, check_permissions, convert_timedelta_to_str, fetch_channel_dict, fetch_user_dict, generate_dict, log, send_evidenceformat, timedelta_from_relativedelta
|
||||||
convert_timedelta_to_str,
|
|
||||||
fetch_channel_dict, fetch_user_dict,
|
|
||||||
generate_dict, log, send_evidenceformat,
|
|
||||||
timedelta_from_relativedelta)
|
|
||||||
|
|
||||||
|
|
||||||
class Aurora(commands.Cog):
|
class Aurora(commands.Cog):
|
||||||
|
@ -686,7 +677,13 @@ class Aurora(commands.Cog):
|
||||||
content=error("Please provide a valid duration!"), ephemeral=True
|
content=error("Please provide a valid duration!"), ephemeral=True
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
parsed_time = timedelta_from_relativedelta(parsed_time)
|
try:
|
||||||
|
parsed_time = timedelta_from_relativedelta(parsed_time)
|
||||||
|
except ValueError:
|
||||||
|
await interaction.response.send_message(
|
||||||
|
content=error("Please provide a valid duration!"), ephemeral=True
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=f"{target.mention} has been banned for {humanize.precisedelta(parsed_time)}!\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been banned for {humanize.precisedelta(parsed_time)}!\n**Reason** - `{reason}`"
|
||||||
|
|
Loading…
Reference in a new issue