Skip to content

Commit

Permalink
feat: 급식 알러지 정보 추가 (#25)
Browse files Browse the repository at this point in the history
* 시간표 수정

* 시간표 수정

디버그용 print 제거

* 시간표 버그 수정 v.2

school_set 에서도 디버그 print를 제거했습니다.

* 급식 알러지 정보 추가

급식 알러지 정보 추가

* feat: 급식 알러지 정보 추가

---------

Signed-off-by: Starcea / 스타샤 <[email protected]>
Co-authored-by: 최민건 <[email protected]>
Co-authored-by: Starcea / 스타샤 <[email protected]>
  • Loading branch information
3 people committed May 19, 2023
1 parent f28b007 commit b55d15f
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions crenata/discord/commands/school/meal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="급식 식단표를 가져와요.")
Expand Down Expand Up @@ -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)

0 comments on commit b55d15f

Please sign in to comment.