Fix error in food

pull/87/head
Stijn De Clercq 2021-08-19 19:45:00 +02:00
parent cdb8a04cde
commit cbe1cf747f
2 changed files with 7 additions and 2 deletions

View File

@ -29,6 +29,7 @@ class School(commands.Cog):
menu = eten.etenScript(day)
embed = discord.Embed(colour=discord.Colour.blue())
embed.set_author(name="Menu voor {}".format(day))
if "gesloten" in menu[0].lower():
embed.description = "Restaurant gesloten"
else:

View File

@ -26,7 +26,11 @@ def etenScript(weekDag):
# Fetch from API
try:
menu = requests.get("https://zeus.ugent.be/hydra/api/2.0/resto/menu/nl-sterre/{}/{}/{}.json".format(d.year, d.month, d.day)).json()
menu = requests.get(f"https://zeus.ugent.be/hydra/api/2.0/resto/menu/nl-sterre/{d.year}/{d.month}/{d.day}.json").json()
if not menu["meals"]:
raise Exception()
# Print menu
for s in menu["meals"]:
@ -49,4 +53,4 @@ def etenScript(weekDag):
menuSoep += "Restaurant gesloten"
menuGroenten += "Restaurant gesloten"
menuHoofdgerechten += "Restaurant gesloten"
return (menuSoep, menuHoofdgerechten, menuGroenten)
return menuSoep, menuHoofdgerechten, menuGroenten