Skip to content

Instantly share code, notes, and snippets.

@jirawatee
Last active May 27, 2019 20:05
Show Gist options
  • Save jirawatee/5628def997af5a7748d6ce571d61ff14 to your computer and use it in GitHub Desktop.
Save jirawatee/5628def997af5a7748d6ce571d61ff14 to your computer and use it in GitHub Desktop.
Broadcast final score in UCL by Firebase Realtime Database
exports.finalScore = functions.region(region).pubsub
.schedule('02 of jun 04:00')
.timeZone('Asia/Bangkok')
.onRun(async context => {
// ดึงผลการแข่งขันล่าสุด
let result = await admin.database().ref('ucl/score').once('value');
broadcast(`จบการแข่งขัน\n${result.val()}`); // ส่งข้อความหาทุกคนที่เป็น friend
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment