mirror of https://github.com/stijndcl/didier
Fix food api url, remove resto option
parent
3c52d681b3
commit
f052885ae0
|
@ -1,7 +1,7 @@
|
|||
from discord.ext import commands
|
||||
from dislash import SlashInteraction, slash_command, Option, OptionType, OptionChoice
|
||||
from dislash import SlashInteraction, slash_command, Option, OptionType
|
||||
|
||||
from data.embeds.food import Menu, restos
|
||||
from data.embeds.food import Menu
|
||||
from startup.didier import Didier
|
||||
|
||||
|
||||
|
@ -11,25 +11,17 @@ class SchoolSlash(commands.Cog):
|
|||
|
||||
@slash_command(
|
||||
name="eten",
|
||||
description="Menu voor een bepaalde resto op een bepaalde dag",
|
||||
description="Menu in de UGENT resto's op een bepaalde dag",
|
||||
options=[
|
||||
Option(
|
||||
"dag",
|
||||
description="Dag",
|
||||
type=OptionType.STRING
|
||||
),
|
||||
Option(
|
||||
"resto",
|
||||
description="Resto",
|
||||
type=OptionType.STRING,
|
||||
choices=list(
|
||||
OptionChoice(v, k) for k, v in restos.items()
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
async def _food_slash(self, interaction: SlashInteraction, dag: str = None, resto: str = "sterre"):
|
||||
embed = Menu(dag, resto).to_embed()
|
||||
async def _food_slash(self, interaction: SlashInteraction, dag: str = None):
|
||||
embed = Menu(dag).to_embed()
|
||||
await interaction.reply(embed=embed)
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class Menu:
|
|||
embed = discord.Embed(colour=discord.Colour.blue())
|
||||
date_formatted = f"{lz(self._day.day)}/{lz(self._day.month)}/{self._day.year}"
|
||||
embed.set_author(name=f"Menu voor {self.day.lower()} {date_formatted}")
|
||||
embed.title = f"Resto {restos[self.resto]}"
|
||||
# embed.title = f"Resto {restos[self.resto]}"
|
||||
|
||||
if "gesloten" in self._menu[0].lower():
|
||||
embed.description = "Restaurant gesloten"
|
||||
|
|
|
@ -24,7 +24,7 @@ def get_type(menu: Dict, type_: str) -> str:
|
|||
return acc
|
||||
|
||||
|
||||
def etenScript(dag: datetime, resto: str = "sterre"):
|
||||
def etenScript(dag: datetime):
|
||||
# What day
|
||||
menuSoep = ""
|
||||
menuHoofdgerechten = ""
|
||||
|
@ -33,7 +33,7 @@ def etenScript(dag: datetime, resto: str = "sterre"):
|
|||
|
||||
# Fetch from API
|
||||
try:
|
||||
menu = requests.get(f"https://zeus.ugent.be/hydra/api/2.0/resto/menu/nl-{resto}/{dag.year}/{dag.month}/{dag.day}.json").json()
|
||||
menu = requests.get(f"https://zeus.ugent.be/hydra/api/2.0/resto/menu/nl/{dag.year}/{dag.month}/{dag.day}.json").json()
|
||||
|
||||
if not menu["meals"]:
|
||||
raise Exception()
|
||||
|
|
Loading…
Reference in New Issue