diff --git a/didier/cogs/school.py b/didier/cogs/school.py index f8a0d1b..5aca554 100644 --- a/didier/cogs/school.py +++ b/didier/cogs/school.py @@ -44,6 +44,9 @@ class School(commands.Cog): Menus are Dutch, as a lot of dishes have very weird translations """ + if day_dt is None: + day_dt = date.today() + async with ctx.typing(): try: menu = await fetch_menu(self.client.http_session, day_dt) diff --git a/didier/utils/discord/converters/time.py b/didier/utils/discord/converters/time.py index 6fbad9a..159e8d3 100644 --- a/didier/utils/discord/converters/time.py +++ b/didier/utils/discord/converters/time.py @@ -5,7 +5,7 @@ from typing import Optional, Union import discord from discord import app_commands -from discord.ext.commands import ArgumentParsingError +from discord.ext import commands from overrides import overrides from didier.utils.discord.autocompletion.time import autocomplete_day @@ -50,7 +50,7 @@ def date_converter(argument: Optional[str]) -> date: return parse_dm_string(argument) # Unparseable - raise ArgumentParsingError(f"Unable to interpret `{original_argument}` as a date.") + raise commands.ArgumentParsingError(f"Unable to interpret `{original_argument}` as a date.") class DateTransformer(app_commands.Transformer): diff --git a/didier/utils/types/datetime.py b/didier/utils/types/datetime.py index 07ad29a..ce2b144 100644 --- a/didier/utils/types/datetime.py +++ b/didier/utils/types/datetime.py @@ -69,16 +69,16 @@ def parse_dm_string(argument: str) -> datetime.date: raise ValueError # Day Month - match = re.search(r"\d+", spl[0]).group() + match = re.search(r"\d+", spl[0]) if match is not None: - day = int(match) + day = int(match.group()) month = str_to_month(spl[1]) return datetime.date(day=day, month=month, year=today.year) # Month Day - match = re.search(r"\d+", spl[0]).group() + match = re.search(r"\d+", spl[0]) if match is not None: - day = int(match) + day = int(match.group()) month = str_to_month(spl[0]) return datetime.date(day=day, month=month, year=today.year) diff --git a/tests/test_didier/test_utils/test_discord/test_converters/test_time.py b/tests/test_didier/test_utils/test_discord/test_converters/test_time.py new file mode 100644 index 0000000..e69de29