Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#16待ち合わせ機能途中まで #22

Merged
merged 1 commit into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/chatcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from linebot.exceptions import (InvalidSignatureError)
from linebot.models import (
MessageEvent, TextMessage, TextSendMessage,TemplateSendMessage,CarouselTemplate,CarouselColumn,
PostbackEvent,
PostbackEvent,DatetimePickerAction,
QuickReply, QuickReplyButton
)
from linebot.models.actions import PostbackAction
Expand Down Expand Up @@ -73,7 +73,7 @@ def make_start_carousel(self):
title="飲食店",
text="指定された条件の飲食店を検索します",
actions=[
PostbackAction(label="検索", data="restaurant"),
PostbackAction(label="使用", data="restaurant"),
PostbackAction(label="ヘルプ", data="help")
]
)
Expand All @@ -84,7 +84,7 @@ def make_start_carousel(self):
title="待ち合わせ場所",
text="指定された条件の待ち合わせ場所を検索します",
actions=[
PostbackAction(label="検索", data="apparel"),
PostbackAction(label="使用", data="meeting"),
PostbackAction(label="ヘルプ", data="help")
]
)
Expand Down
95 changes: 94 additions & 1 deletion src/meeting.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,95 @@
from linebot import (LineBotApi, WebhookHandler)
from linebot.exceptions import (InvalidSignatureError)
from linebot.models import (
MessageEvent, TextMessage, TextSendMessage,TemplateSendMessage,CarouselTemplate,CarouselColumn,
PostbackEvent,DatetimePickerAction,
QuickReply, QuickReplyButton
)
from linebot.models.actions import PostbackAction
def meeting_recomend(chatcat,event):
chatcat.talk('待ち合わせのおすすめを検索します')

start_message = "待ち合わせにゃね!どこで待ち合わせするにゃ?"
user_want_time_question = "いつ待ち合わせするにゃ?"

try:
flag_meeting_start,flag_flow_select_place,flag_flow_decide_place,flag_flow_decide_time = chatcat.data["meeting_flag"]
recommend_place_no1,recommend_place_no2,recommend_place_no3,decide_place,decide_time = chatcat.data["meeting_data"]
except:
flag_meeting_start,flag_flow_select_place,flag_flow_decide_place,flag_flow_decide_time = True, False, False, False
recommend_place_no1,recommend_place_no2,recommend_place_no3,decide_place,decide_time = "Init","Init","Init","Init","Init"

if flag_flow_decide_place == True:
if event.postback.params["data"] == "place_no1":
decide_place = recommend_place_no1
elif event.postback.params["data"] == "place_no2":
decide_place = recommend_place_no2
elif event.postback.params["data"] == "place_no3":
decide_place = recommend_place_no3
flag_flow_decide_place = False
flag_flow_decide_time = True
columns_list = []
columns_list.append(
CarouselColumn(
thumbnail_image_url="https://cdn.projectdesign.jp/uploads/201601/images/gazou/24_1.jpg",
title=recommend_place_no1,
text="USJがあるところです",
actions=[
DatetimePickerAction(data="user_want_time")
]
)
)
place_dicide_message = f"{decide_place}で待ち合わせにゃね。"
chatcat.talk(place_dicide_message + user_want_time_question)

if flag_flow_select_place == True:
recommend_place_no1 = "osaka"
recommend_place_no2 = "kyoto"
recommend_place_no3 = "kobe"
flag_flow_select_place = False
if recommend_place_no1 == "Init" and recommend_place_no1 == "Init" and recommend_place_no1 == "Init":
flag_meeting_start = True
else:
flag_flow_decide_place = True
#カルーセル内容
columns_list = []
columns_list.append(
CarouselColumn(
thumbnail_image_url="https://cdn.projectdesign.jp/uploads/201601/images/gazou/24_1.jpg",
title=recommend_place_no1,
text="USJがあるところです",
actions=[
PostbackAction(label="決定", data="place_no1")
]
)
)
columns_list.append(
CarouselColumn(
thumbnail_image_url="https://cdn.projectdesign.jp/uploads/201601/images/gazou/24_1.jpg",
title=recommend_place_no2,
text="お寺があるとこです",
actions=[
PostbackAction(label="検索", data="place_no2")
]
)
)
columns_list.append(
CarouselColumn(
thumbnail_image_url="https://cdn.projectdesign.jp/uploads/201601/images/gazou/24_1.jpg",
title=recommend_place_no3,
text="お城があるとこです",
actions=[
PostbackAction(label="検索", data="place_no3")
]
)
)
select_message = f"{event.message.text}で待ち合わせするにゃら、ここがおすすめにゃ!"
chatcat.talk(select_message)
chatcat.add_carousel("おすすめ一覧",columns_list)

if flag_meeting_start == True:
flag_meeting_start = False
flag_flow_select_place = True
chatcat.talk(start_message)

chatcat.data["meeting_flag"] = [flag_meeting_start,flag_flow_select_place,flag_flow_decide_place,flag_flow_decide_time]
chatcat.data["meeting_data"] = [recommend_place_no1,recommend_place_no2,recommend_place_no3,decide_place,decide_time]