Skip to content
Open
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
16 changes: 10 additions & 6 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@app.route('/')
def index():
a=os.environ['Authorization']
return "นายอาคม สุวรรณประเสริฐ เลขที่ 0 ชั้น ม.4/3"
return "นายสิทธิกร อุติ เลขที่ 6 ชั้น ม.4/3"

@app.route("/webhook", methods=['POST'])
def webhook():
Expand All @@ -20,11 +20,15 @@ def callback():
json_line = request.get_json()
json_line = json.dumps(json_line)
decoded = json.loads(json_line)
user = decoded["events"][0]['replyToken']
userText = decoded["events"][0]['message']['text']
sendText(user,userText)
return '',200

user = decoded['originalDectIntentRequest']['payload']['data']['replyToken']
userText = decoded["queryResult"]['intent']['displayName']
if (userText == 'สวัสดี') :
sendText(user,'ดีครับ')
elif (userText == 'ทำไรอยู่') :
sendText(user,'ทำงาน')
else :
sendText(user,'ทำงานต่อเเปป
return '',200
def sendText(user, text):
LINE_API = 'https://api.line.me/v2/bot/message/reply'
headers = {
Expand Down