WIP: Refactor Aurora (3.0.0) #29

Closed
cswimr wants to merge 382 commits from aurora-pydantic into main
Showing only changes of commit 374a083528 - Show all commits

View file

@ -585,10 +585,10 @@ class Aurora(commands.Cog):
try:
before = parse(before)
except (ParserError, OverflowError) as e:
if e == ParserError:
if isinstance(e, ParserError):
await interaction.response.send_message(content=error("Invalid date format for `before` parameter!"), ephemeral=True)
return
if e == OverflowError:
if isinstance(e, OverflowError):
await interaction.response.send_message(content=error("Date is too far in the future!"), ephemeral=True)
return
@ -596,10 +596,10 @@ class Aurora(commands.Cog):
try:
after = parse(after)
except (ParserError, OverflowError) as e:
if e == ParserError:
if isinstance(e, ParserError):
await interaction.response.send_message(content=error("Invalid date format for `after` parameter!"), ephemeral=True)
return
if e == OverflowError:
if isinstance(e, OverflowError):
await interaction.response.send_message(content=error("Date is too far in the future!"), ephemeral=True)
return
@ -607,10 +607,10 @@ class Aurora(commands.Cog):
try:
on = parse(on)
except (ParserError, OverflowError) as e:
if e == ParserError:
if isinstance(e, ParserError):
await interaction.response.send_message(content=error("Invalid date format for `on` parameter!"), ephemeral=True)
return
if e == OverflowError:
if isinstance(e, OverflowError):
await interaction.response.send_message(content=error("Date is too far in the future!"), ephemeral=True)
return
@ -777,9 +777,9 @@ class Aurora(commands.Cog):
try:
success, msg = await moderation.resolve(interaction.user.id, reason)
except (ValueError, TypeError) as e:
if e == ValueError:
if isinstance(e, ValueError):
await interaction.response.send_message(content=error("This case has already been resolved!"), ephemeral=True)
elif e == TypeError:
elif isinstance(e, TypeError):
await interaction.response.send_message(content=error("This case type cannot be resolved!"), ephemeral=True)
embed = await case_factory(
@ -1142,9 +1142,9 @@ class Aurora(commands.Cog):
parsed_date = parse(date)
await ctx.send(f"`{parsed_date}`")
except (ParserError, OverflowError) as e:
if e == ParserError:
if isinstance(e, ParserError):
await ctx.send(error("Invalid date format!"))
if e == OverflowError:
if isinstance(e, OverflowError):
await ctx.send(error("Date is too far in the future!"))
@aurora_convert.command(aliases=["td"])