diff --git a/crenata/discord/commands/school/meal.py b/crenata/discord/commands/school/meal.py index 29fc2a1..d0737e3 100644 --- a/crenata/discord/commands/school/meal.py +++ b/crenata/discord/commands/school/meal.py @@ -6,7 +6,8 @@ from crenata.discord.embed import meal_page from crenata.discord.interaction import school_info from crenata.utils.discord import ToDatetime, dynamic_send -from discord import app_commands +from discord import app_commands, ui +from discord.interactions import Interaction @school.command(name="급식", description="급식 식단표를 가져와요.") @@ -41,4 +42,23 @@ async def meal( ) return - await dyn(embed=meal_info, ephemeral=preferences.ephemeral, view=None, content=None) + user = interaction.user.id + selAllergy: ui.Select[ui.View] = ui.Select(placeholder="알러지 정보") + + async def callback_no_response(interaction: Interaction) -> None: + if interaction.user.id == user: + selAllergy.placeholder = selAllergy.values[0] + await interaction.response.edit_message(view=view) + + view = ui.View() + + selAllergy.add_option(label="1.난류, 2.우유, 3.메밀") + selAllergy.add_option(label="4.땅콩, 5.대두, 6.밀") + selAllergy.add_option(label="7.고등어, 8.게, 9.새우") + selAllergy.add_option(label="10.돼지고기, 11.복숭아, 12.토마토") + selAllergy.add_option(label="13.아황산염, 14.호두, 15.닭고기") + selAllergy.add_option(label="16.쇠고기, 17.오징어, 18.조개류") + setattr(selAllergy, "callback", callback_no_response) + view.add_item(selAllergy) + + await dyn(embed=meal_info, ephemeral=preferences.ephemeral, view=view, content=None)