Skip to content

Commit

Permalink
Merge pull request #72 from jphacks/feature/analyze_in_shoe_list
Browse files Browse the repository at this point in the history
use URI Action
  • Loading branch information
motty-mio2 authored Nov 18, 2023
2 parents 78a18f1 + ee0100d commit aaca17b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/kb_2315/notify/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
PostbackAction,
TemplateSendMessage,
TextSendMessage,
URIAction,
)

from kb_2315.backend.crud import crud_shoe, crud_user
Expand All @@ -17,8 +18,11 @@

def send_message(
message: str,
send_to_id: str = crud_user.search_user_by()[0].line_channel_id,
send_to_id: str | None = None,
) -> None:
if send_to_id is None:
send_to_id = crud_user.search_user_by()[0].line_channel_id

line_bot_api = LineBotApi(conf.line_channel_access_token)

try:
Expand All @@ -30,7 +34,10 @@ def send_message(
print(f"Send Message Error:\n{e}")


def shoe_list_carousel(send_to_id: str = crud_user.search_user_by()[0].line_channel_id) -> None:
def shoe_list_carousel(send_to_id: str | None = None) -> None:
if send_to_id is None:
send_to_id = crud_user.search_user_by()[0].line_channel_id

columns_list: list[CarouselColumn] = []
shoes: list[Shoe] = crud_shoe.search_shoe_by()

Expand All @@ -39,9 +46,7 @@ def shoe_list_carousel(send_to_id: str = crud_user.search_user_by()[0].line_chan
CarouselColumn(
text=f"靴 {shoe.name}",
thumbnail_image_url=shoe.image_url,
actions=[
PostbackAction(label=f"{shoe.name} を選ぶ", data=" :"),
],
actions=[URIAction(uri=f"{conf.host_url}/analyze/?shoe_id={shoe.id}", label="データの表示")],
)
)

Expand Down

0 comments on commit aaca17b

Please sign in to comment.