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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0,viewport-fit=cover"> | |
<title>LIFF Plugin</title> | |
<link rel="stylesheet" href="css/plugin.css"> | |
</head> | |
<body> | |
<div id="container"> |
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
class BMIPlugin { | |
constructor() { | |
this.name = "bmi"; | |
} | |
install(context, option) { | |
return { | |
today: this.localDate(context.liff.getLanguage(), option.date), | |
greet: this.greeting, | |
cal: this.calculate |
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
const main = async() => { | |
let result = {} | |
let next = '' | |
const valueArray = [] | |
let round = 0 | |
do { | |
result = await getFollowerIds(next) | |
for (const userId of result.userIds) { | |
valueArray.push(userId) |
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
const main = async() => { | |
const valueArray = [] | |
let result = {} | |
let next = '' | |
let round = 0 | |
while(next != undefined) { | |
result = await getFollowerIds(next) | |
for (const userId of result.userIds) { | |
valueArray.push(userId) |
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
const main = async() => { | |
const valueArray = [] | |
let result = {} | |
let next = '' | |
// 23794 คือค่า targetedReaches ที่ได้มาจาก Get Number of Followers API | |
const rounds = Math.ceil(23794/1000); | |
for (i = 0; i < rounds; i++) { | |
result = await getFollowerIds(next) |
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
const axios = require('axios') | |
const LINE_MESSAGING_API = "https://api.line.me/v2/bot" | |
const LINE_HEADER = { | |
"Content-Type": "application/json", | |
Authorization: `Bearer ${config.CHANNEL_ACCESS_TOKEN}` | |
} | |
const getFollowerIds = async(next) => { | |
try { | |
const json = await axios({ |
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
{ | |
"type": "bubble", | |
"body": { | |
"type": "box", | |
"layout": "vertical", | |
"contents": [ | |
{ | |
"type": "text", | |
"text": "เชื่อว่านักพัฒนาที่เป็นแฟนพันธุ์แท้ของ LINE ต่างรอคอยการมาของฟีเจอร์ใหม่ๆใน Flex Message เพื่อมาเติมเต็มจินตนาการในการแสดงผลข้อความใน LINE แบบ \"Think out of the box\" ทั้งการส่งผ่าน LINE Chatbot ก็ดี หรือส่งผ่าน LIFF app ก็เกร๋\n\nสำหรับใครที่เปิดมาเจอบทความนี้ แล้วได้ยินคำว่า Flex Message เป็นครั้งแรก ก็อยากแนะนำให้ไปทำความรู้จักกับความสามารถของมันที่บทความนี้ก่อนนะครับ", | |
"wrap": true, |
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
{ | |
"type": "bubble", | |
"body": { | |
"type": "box", | |
"layout": "vertical", | |
"contents": [ | |
{ | |
"type": "box", | |
"layout": "horizontal", | |
"contents": [ |
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
{ | |
"type": "bubble", | |
"hero": { | |
"type": "video", | |
"url": "https://mokmoon.com/videos/Brown.mp4", | |
"previewUrl": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/01_1_cafe.png", | |
"altContent": { | |
"type": "image", | |
"size": "full", | |
"aspectRatio": "20:13", |
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
const functions = require("firebase-functions"); | |
exports.myCallable = functions.https.onCall(async (data, context) => { | |
// รับค่า base64 ที่ได้จาก LIFF app โดย split เพื่อตัด type ที่นำหน้าออก | |
const base64 = data.base64.split(",") | |
// import และ initial ตัว lib ของ Cloud Vision API | |
const vision = require('@google-cloud/vision') | |
const client = new vision.ImageAnnotatorClient() | |
NewerOlder