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 GOL | |
| attr_accessor :size | |
| attr_accessor :board | |
| def initialize(size) | |
| @size = size | |
| reset_board | |
| end | |
| def reset_board |
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 bodyParser = require('body-parser'); | |
| const express = require('express'); | |
| const { bottender } = require('bottender'); | |
| const path = require('path'); | |
| const app = bottender({ | |
| dev: process.env.NODE_ENV !== 'production', | |
| }); | |
| const port = Number(process.env.PORT) || 5000; |
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
| { | |
| ... | |
| "scripts": { | |
| "dev": "nodemon server.js", | |
| "start": "node server.js", | |
| ... | |
| }, | |
| ... | |
| } |
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
| server.get('/send-id', (req, res) => { | |
| res.json({ id: process.env.LINE_LIFF_ID }); | |
| }); | |
| server.get('/liff', (req, res) => { | |
| const filename = path.join(`${__dirname}/liff.html`); | |
| res.sendFile(filename); | |
| }); |
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
| <body> | |
| <button id="button">send test message</button> | |
| <script src="https://static.line-scdn.net/liff/edge/2.1/sdk.js"></script> | |
| <script> | |
| function initializeLiff(myLiffId) { | |
| liff | |
| .init({ | |
| liffId: myLiffId, | |
| }) | |
| .then(() => { |
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
| module.exports = async function App(context) { | |
| const liffUrl = `https://liff.line.me/${process.env.LINE_LIFF_ID}`; | |
| await context.sendText(liffUrl); | |
| }; |
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
| LINE_ACCESS_TOKEN={你的 LINE access token} | |
| LINE_CHANNEL_SECRET={你的 LINE channel secret} | |
| LINE_LIFF_ID={你的 LIFF ID} |
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 querystring = require('querystring'); | |
| const axios = require('axios'); | |
| function getAuthLink(clientId, redirectUrl, state) { | |
| const data = { | |
| response_type: 'code', | |
| client_id: clientId, | |
| redirect_uri: redirectUrl, | |
| scope: 'notify', | |
| state, |
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 bodyParser = require('body-parser'); | |
| const express = require('express'); | |
| const { bottender } = require('bottender'); | |
| const lineNotify = require('./src/lineNotify'); | |
| const app = bottender({ | |
| dev: process.env.NODE_ENV !== 'production', | |
| }); | |
| const port = Number(process.env.PORT) || 5000; |
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 { router, route, text } = require('bottender/router'); | |
| const lineNotify = require('./lineNotify') | |
| const clientId = process.env.LINE_NOTIFY_CLIENT_ID; | |
| const redirectUri = `${process.env.ROOT_PATH}/callback`; | |
| async function SendSubscriptionGuides(context) { | |
| const uri = lineNotify.getAuthLink(clientId, redirectUri, 'demo'); | |
| await context.sendFlex('請點選按鈕訂閱通知:', { |
OlderNewer