Skip to content

Commit

Permalink
Add an allergen command.
Browse files Browse the repository at this point in the history
  • Loading branch information
AiroPi committed Oct 12, 2023
1 parent 1c51d91 commit a71f2c6
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/cogs/restauration.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
from os import path
from typing import TYPE_CHECKING

import discord
import httpx
from bs4 import BeautifulSoup
from discord import HTTPException, TextChannel
from discord import HTTPException, TextChannel, app_commands
from discord.ext import tasks
from discord.ext.commands import Cog # pyright: ignore[reportMissingTypeStubs]

Expand Down Expand Up @@ -103,6 +104,20 @@ async def check_menu(self) -> None:
except HTTPException:
pass

@app_commands.command(name="allergenes", description="Affiche les allergènes du menu du jour.")
async def allergen(self, inter: discord.Interaction):
_, allergens = await self.get_imgs()
bn = "\n"
await inter.response.send_message(
(
"Voici les allergènes du menu du jour :\n"
f"{bn.join(allergens)}"
"\n\nS'ils ne sont pas à jour, c'est que le lycée ne les a pas publié.\n"
"Attention : les allergènes sont susceptibles d'être modifiés, merci de se référer au panneau"
" d'affichage à la restauration scolaire."
)
)


async def setup(bot: MP2IBot):
await bot.add_cog(Restauration(bot))

0 comments on commit a71f2c6

Please sign in to comment.