Fix typing

pull/128/head
stijndcl 2022-08-29 01:22:05 +02:00
parent c31767c25f
commit 9225f61e47
4 changed files with 9 additions and 6 deletions

View File

@ -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)

View File

@ -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):

View File

@ -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)