Last active
November 21, 2019 08:46
-
-
Save jirawatee/ccfe2a9a40c8f12184e487379f3e6bd2 to your computer and use it in GitHub Desktop.
UCL - Postback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
case 'postback': { | |
// [8.4] | |
let msg = 'ทีมที่คุณเลือกมันเข้ารอบมาชิง UCL ซะทีไหนเล่า ปั๊ดโถ่!'; | |
let team = event.postback.data.split('=')[1].toLowerCase() | |
if (team.indexOf('liverpool') >= 0 || team.indexOf('tottenham') >= 0) { | |
// Firebase Realtime Database | |
await admin.database().ref('ucl/uid').child(event.source.userId).set(true) | |
// Cloud Firestore | |
// await admin.firestore().doc('ucl/final').collection('uid').doc(event.source.userId).set({}) | |
msg = 'ยินดีด้วยคุณผ่านการยืนยันตัวตน ระบบจะรายงานผลบอลคู่ชิงให้คุณทุกลมหายใจ'; | |
} | |
reply(event.replyToken, { type: 'text', text: msg }); | |
break; | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment