mirror of https://github.com/stijndcl/didier
Fix typing
parent
c31767c25f
commit
9225f61e47
|
@ -44,6 +44,9 @@ class School(commands.Cog):
|
||||||
|
|
||||||
Menus are Dutch, as a lot of dishes have very weird translations
|
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():
|
async with ctx.typing():
|
||||||
try:
|
try:
|
||||||
menu = await fetch_menu(self.client.http_session, day_dt)
|
menu = await fetch_menu(self.client.http_session, day_dt)
|
||||||
|
|
|
@ -5,7 +5,7 @@ from typing import Optional, Union
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from discord import app_commands
|
from discord import app_commands
|
||||||
from discord.ext.commands import ArgumentParsingError
|
from discord.ext import commands
|
||||||
from overrides import overrides
|
from overrides import overrides
|
||||||
|
|
||||||
from didier.utils.discord.autocompletion.time import autocomplete_day
|
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)
|
return parse_dm_string(argument)
|
||||||
|
|
||||||
# Unparseable
|
# 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):
|
class DateTransformer(app_commands.Transformer):
|
||||||
|
|
|
@ -69,16 +69,16 @@ def parse_dm_string(argument: str) -> datetime.date:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
# Day Month
|
# Day Month
|
||||||
match = re.search(r"\d+", spl[0]).group()
|
match = re.search(r"\d+", spl[0])
|
||||||
if match is not None:
|
if match is not None:
|
||||||
day = int(match)
|
day = int(match.group())
|
||||||
month = str_to_month(spl[1])
|
month = str_to_month(spl[1])
|
||||||
return datetime.date(day=day, month=month, year=today.year)
|
return datetime.date(day=day, month=month, year=today.year)
|
||||||
|
|
||||||
# Month Day
|
# Month Day
|
||||||
match = re.search(r"\d+", spl[0]).group()
|
match = re.search(r"\d+", spl[0])
|
||||||
if match is not None:
|
if match is not None:
|
||||||
day = int(match)
|
day = int(match.group())
|
||||||
month = str_to_month(spl[0])
|
month = str_to_month(spl[0])
|
||||||
return datetime.date(day=day, month=month, year=today.year)
|
return datetime.date(day=day, month=month, year=today.year)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue