엄성진

Integrate the account & Using webhook with AWS

'use strict';
const line = require('@line/bot-sdk');
const express = require('express');
var express = require('express');
const request = require('request');
const TARGET_URL = 'https://api.line.me/v2/bot/message/reply'
const TOKEN = 'Kb1/rQYz4MUhF8XyKQv7z9x0MxVQ5bX/XO8S/yt/1qQEJVAbsEFAaMvXKEOx9Umr7KhivfyDPfZHRRLFPngR0O4ZGWV2VFses8ufPE7uAdvYr4G6keBNAU69nBz5IC71HfbIrUHxXYqD7GfhVwXzpwdB04t89/1O/w1cDnyilFU='
const PAPAGO_URL = 'https://openapi.naver.com/v1/papago/n2mt'
const PAPAGO_ID = 'kwoxKGTi6azBaW9aSVxe'
const PAPAGO_SECRET = 'svB_MM61oD'
const fs = require('fs');
const path = require('path');
const cp = require('child_process');
const ngrok = require('ngrok');
// create LINE SDK config from env variables
const config = {
channelAccessToken: '6Aw67RtwWFJb+GCbr5DGhlFY5w6i0HpuKRNA1BNyGIDfXYrA2V/+S0yCgYy+jh4R2wHvg1XEZh0hhsFof81squrHYTR+5yvrPyuaNcDOZnkQLl4X+EWi6vDB5Rf6VeRUclczO0VyXd4hp9Oo4QUmZwdB04t89/1O/w1cDnyilFU=',
channelSecret: '2caa1add6c76bd51a84bd861e27c800c',
};
// base URL for webhook server
let baseURL = process.env.BASE_URL;
// create LINE SDK client
const client = new line.Client(config);
// create Express app
// about Express itself: https://expressjs.com/
const app = express();
// serve static and downloaded files
app.use('/static', express.static('static'));
app.use('/downloaded', express.static('downloaded'));
app.get('/callback', (req, res) => res.end(`I'm listening. Please access with POST.`));
// webhook callback
app.post('/callback', line.middleware(config), (req, res) => {
if (req.body.destination) {
console.log("Destination User ID: " + req.body.destination);
}
// req.body.events should be an array of events
if (!Array.isArray(req.body.events)) {
return res.status(500).end();
}
// handle events separately
Promise.all(req.body.events.map(handleEvent))
.then(() => res.end())
.catch((err) => {
console.error(err);
res.status(500).end();
});
const HTTPS = require('https');
const domain = "2020105631.oss2021.tk"
const sslport = 23023;
const bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.json());
app.post('/hook', function (req, res) {
var eventObj = req.body.events[0];
var source = eventObj.source;
var message = eventObj.message;
// request log
console.log('======================', new Date() ,'======================');
console.log('[request]', req.body);
console.log('[request source] ', eventObj.source);
console.log('[request message]', eventObj.message);
trans(eventObj.replyToken, eventObj.message.text);
res.sendStatus(200);
});
// simple reply function
const replyText = (token, texts) => {
texts = Array.isArray(texts) ? texts : [texts];
return client.replyMessage(
token,
texts.map((text) => ({ type: 'text', text }))
);
};
function trans(replyToken, message) {
// callback function to handle a single event
function handleEvent(event) {
if (event.replyToken && event.replyToken.match(/^(.)\1*$/)) {
return console.log("Test hook recieved: " + JSON.stringify(event.message));
}
request.post(
switch (event.type) {
case 'message':
const message = event.message;
switch (message.type) {
case 'text':
return handleText(message, event.replyToken, event.source);
case 'image':
return handleImage(message, event.replyToken);
case 'video':
return handleVideo(message, event.replyToken);
case 'audio':
return handleAudio(message, event.replyToken);
case 'location':
return handleLocation(message, event.replyToken);
case 'sticker':
return handleSticker(message, event.replyToken);
default:
throw new Error(`Unknown message: ${JSON.stringify(message)}`);
}
case 'follow':
return replyText(event.replyToken, 'Got followed event');
case 'unfollow':
return console.log(`Unfollowed this bot: ${JSON.stringify(event)}`);
case 'join':
return replyText(event.replyToken, `Joined ${event.source.type}`);
case 'leave':
return console.log(`Left: ${JSON.stringify(event)}`);
case 'postback':
let data = event.postback.data;
if (data === 'DATE' || data === 'TIME' || data === 'DATETIME') {
data += `(${JSON.stringify(event.postback.params)})`;
}
return replyText(event.replyToken, `Got postback: ${data}`);
case 'beacon':
return replyText(event.replyToken, `Got beacon: ${event.beacon.hwid}`);
default:
throw new Error(`Unknown event: ${JSON.stringify(event)}`);
}
}
function handleText(message, replyToken, source) {
const buttonsImageURL = `${baseURL}/static/buttons/1040.jpg`;
//★text에 따른 응답 변화!!★
switch (message.text) {
case '음악 추천해줘':
message.text = '아이유의 음악을 추천드립니다.';
return replyText(replyToken, message.text);
case 'profile':
if (source.userId) {
return client.getProfile(source.userId)
.then((profile) => replyText(
replyToken,
[
`Display name: ${profile.displayName}`,
`Status message: ${profile.statusMessage}`,
]
));
} else {
return replyText(replyToken, 'Bot can\'t use profile API without user ID');
}
case 'buttons':
return client.replyMessage(
replyToken,
{
type: 'template',
altText: 'Buttons alt text',
template: {
type: 'buttons',
thumbnailImageUrl: buttonsImageURL,
title: 'My button sample',
text: 'Hello, my button',
actions: [
{ label: 'Go to line.me', type: 'uri', uri: 'https://line.me' },
{ label: 'Say hello1', type: 'postback', data: 'hello こんにちは' },
{ label: '言 hello2', type: 'postback', data: 'hello こんにちは', text: 'hello こんにちは' },
{ label: 'Say message', type: 'message', text: 'Rice=米' },
],
},
}
);
case 'confirm':
return client.replyMessage(
replyToken,
{
type: 'template',
altText: 'Confirm alt text',
template: {
type: 'confirm',
text: 'Do it?',
actions: [
{ label: 'Yes', type: 'message', text: 'Yes!' },
{ label: 'No', type: 'message', text: 'No!' },
],
},
}
)
case 'carousel':
return client.replyMessage(
replyToken,
{
type: 'template',
altText: 'Carousel alt text',
template: {
type: 'carousel',
columns: [
{
thumbnailImageUrl: buttonsImageURL,
title: 'hoge',
text: 'fuga',
actions: [
{ label: 'Go to line.me', type: 'uri', uri: 'https://line.me' },
{ label: 'Say hello1', type: 'postback', data: 'hello こんにちは' },
],
},
{
thumbnailImageUrl: buttonsImageURL,
title: 'hoge',
text: 'fuga',
actions: [
{ label: '言 hello2', type: 'postback', data: 'hello こんにちは', text: 'hello こんにちは' },
{ label: 'Say message', type: 'message', text: 'Rice=米' },
],
},
],
},
}
);
case 'image carousel':
return client.replyMessage(
replyToken,
{
type: 'template',
altText: 'Image carousel alt text',
template: {
type: 'image_carousel',
columns: [
{
imageUrl: buttonsImageURL,
action: { label: 'Go to LINE', type: 'uri', uri: 'https://line.me' },
},
{
imageUrl: buttonsImageURL,
action: { label: 'Say hello1', type: 'postback', data: 'hello こんにちは' },
},
{
imageUrl: buttonsImageURL,
action: { label: 'Say message', type: 'message', text: 'Rice=米' },
},
{
imageUrl: buttonsImageURL,
action: {
label: 'datetime',
type: 'datetimepicker',
data: 'DATETIME',
mode: 'datetime',
},
},
]
},
}
);
case 'datetime':
return client.replyMessage(
replyToken,
{
type: 'template',
altText: 'Datetime pickers alt text',
template: {
type: 'buttons',
text: 'Select date / time !',
actions: [
{ type: 'datetimepicker', label: 'date', data: 'DATE', mode: 'date' },
{ type: 'datetimepicker', label: 'time', data: 'TIME', mode: 'time' },
{ type: 'datetimepicker', label: 'datetime', data: 'DATETIME', mode: 'datetime' },
],
},
}
);
case 'imagemap':
return client.replyMessage(
replyToken,
{
type: 'imagemap',
baseUrl: `${baseURL}/static/rich`,
altText: 'Imagemap alt text',
baseSize: { width: 1040, height: 1040 },
actions: [
{ area: { x: 0, y: 0, width: 520, height: 520 }, type: 'uri', linkUri: 'https://store.line.me/family/manga/en' },
{ area: { x: 520, y: 0, width: 520, height: 520 }, type: 'uri', linkUri: 'https://store.line.me/family/music/en' },
{ area: { x: 0, y: 520, width: 520, height: 520 }, type: 'uri', linkUri: 'https://store.line.me/family/play/en' },
{ area: { x: 520, y: 520, width: 520, height: 520 }, type: 'message', text: 'URANAI!' },
],
video: {
originalContentUrl: `${baseURL}/static/imagemap/video.mp4`,
previewImageUrl: `${baseURL}/static/imagemap/preview.jpg`,
area: {
x: 280,
y: 385,
width: 480,
height: 270,
url: PAPAGO_URL,
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'X-Naver-Client-Id': `${PAPAGO_ID}`,
'X-Naver-Client-Secret': `${PAPAGO_SECRET}`
},
externalLink: {
linkUri: 'https://line.me',
label: 'LINE'
}
},
}
);
case 'bye':
switch (source.type) {
case 'user':
return replyText(replyToken, 'Bot can\'t leave from 1:1 chat');
case 'group':
return replyText(replyToken, 'Leaving group')
.then(() => client.leaveGroup(source.groupId));
case 'room':
return replyText(replyToken, 'Leaving room')
.then(() => client.leaveRoom(source.roomId));
}
default:
console.log(`Echo message to ${replyToken}: ${message.text}`);
return replyText(replyToken, message.text);
}
}
function handleImage(message, replyToken) {
let getContent;
if (message.contentProvider.type === "line") {
const downloadPath = path.join(__dirname, 'downloaded', `${message.id}.jpg`);
const previewPath = path.join(__dirname, 'downloaded', `${message.id}-preview.jpg`);
getContent = downloadContent(message.id, downloadPath)
.then((downloadPath) => {
// ImageMagick is needed here to run 'convert'
// Please consider about security and performance by yourself
cp.execSync(`convert -resize 240x jpeg:${downloadPath} jpeg:${previewPath}`);
return {
originalContentUrl: baseURL + '/downloaded/' + path.basename(downloadPath),
previewImageUrl: baseURL + '/downloaded/' + path.basename(previewPath),
};
});
} else if (message.contentProvider.type === "external") {
getContent = Promise.resolve(message.contentProvider);
}
return getContent
.then(({ originalContentUrl, previewImageUrl }) => {
return client.replyMessage(
replyToken,
body: 'source=ko&target=en&text=' + message,
json:true
},
(error, response, body) => {
if(!error && response.statusCode == 200)
{
type: 'image',
originalContentUrl,
previewImageUrl,
}
);
});
}
function handleVideo(message, replyToken) {
let getContent;
if (message.contentProvider.type === "line") {
const downloadPath = path.join(__dirname, 'downloaded', `${message.id}.mp4`);
const previewPath = path.join(__dirname, 'downloaded', `${message.id}-preview.jpg`);
getContent = downloadContent(message.id, downloadPath)
.then((downloadPath) => {
// FFmpeg and ImageMagick is needed here to run 'convert'
// Please consider about security and performance by yourself
cp.execSync(`convert mp4:${downloadPath}[0] jpeg:${previewPath}`);
return {
originalContentUrl: baseURL + '/downloaded/' + path.basename(downloadPath),
previewImageUrl: baseURL + '/downloaded/' + path.basename(previewPath),
}
});
} else if (message.contentProvider.type === "external") {
getContent = Promise.resolve(message.contentProvider);
}
// message 가 사용자에게서 입력받은 메시지 내용입니다. sendMessage 는 보낼 메시지 내용입니다.
// 위에 PAPAGO API부분은 추후 API를 연동시킬 때 맞춰서 작성하기 쉽도록 템플릿을 남겨놓았습니다. 자세한 정보는 교수님 학습 자료의 experiment의 trans 폴더를 참고하세요.
// (현재 코드에선 PAPAGO API의 작동 결과는 반영되지 않습니다.)
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
if (message=="노래 추천해줘")
{
var sendMessage = "아이유의 노래를 추천드립니다.";
}
else
{
var sendMessage = "무슨 말인지 못알아먹겠습니다";
}
//↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
console.log(body.message);
request.post(
{
url: TARGET_URL,
headers: {
'Authorization': `Bearer ${TOKEN}`
},
json: {
"replyToken":replyToken,
"messages":[
{
"type":"text",
"text":sendMessage
}
]
}
},(error, response, body) => {
console.log(body)
});
}
});
return getContent
.then(({ originalContentUrl, previewImageUrl }) => {
return client.replyMessage(
replyToken,
{
type: 'video',
originalContentUrl,
previewImageUrl,
}
);
});
}
function handleAudio(message, replyToken) {
let getContent;
if (message.contentProvider.type === "line") {
const downloadPath = path.join(__dirname, 'downloaded', `${message.id}.m4a`);
getContent = downloadContent(message.id, downloadPath)
.then((downloadPath) => {
return {
originalContentUrl: baseURL + '/downloaded/' + path.basename(downloadPath),
};
});
} else {
getContent = Promise.resolve(message.contentProvider);
}
return getContent
.then(({ originalContentUrl }) => {
return client.replyMessage(
replyToken,
{
type: 'audio',
originalContentUrl,
duration: message.duration,
}
);
try {
const option = {
ca: fs.readFileSync('/etc/letsencrypt/live/' + domain +'/fullchain.pem'),
key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/privkey.pem'), 'utf8').toString(),
cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/cert.pem'), 'utf8').toString(),
};
HTTPS.createServer(option, app).listen(sslport, () => {
console.log(`[HTTPS] Server is started on port ${sslport}`);
});
}
function downloadContent(messageId, downloadPath) {
return client.getMessageContent(messageId)
.then((stream) => new Promise((resolve, reject) => {
const writable = fs.createWriteStream(downloadPath);
stream.pipe(writable);
stream.on('end', () => resolve(downloadPath));
stream.on('error', reject);
}));
}
function handleLocation(message, replyToken) {
return client.replyMessage(
replyToken,
{
type: 'location',
title: message.title,
address: message.address,
latitude: message.latitude,
longitude: message.longitude,
}
);
}
function handleSticker(message, replyToken) {
return client.replyMessage(
replyToken,
{
type: 'sticker',
packageId: message.packageId,
stickerId: message.stickerId,
}
);
}
// listen on port
const port = process.env.PORT || 3000;
app.listen(port, () => {
if (baseURL) {
console.log(`listening on ${baseURL}:${port}/callback`);
} else {
console.log("It seems that BASE_URL is not set. Connecting to ngrok...")
ngrok.connect(port).then(url => {
baseURL = url;
console.log(`listening on ${baseURL}/callback`);
}).catch(console.error);
} catch (error) {
console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.');
console.log(error);
}
});
\ No newline at end of file
......
{
"name": "kitchensink",
"version": "0.0.0",
"name": "trans",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@line/bot-sdk": {
"version": "7.3.0",
"resolved": "https://registry.npmjs.org/@line/bot-sdk/-/bot-sdk-7.3.0.tgz",
"integrity": "sha512-MItRU6Yl7ES8ai/fJ7Y0neKMQXI1QloRFq8i4YtV3t1+1kaxUY9j3dcPDXDRLKgYRNCIXamQwaTfI1QA3bxZHQ==",
"requires": {
"@types/body-parser": "^1.19.0",
"@types/node": "^14.10.0",
"axios": "^0.21.1",
"body-parser": "^1.19.0",
"file-type": "^15.0.0",
"form-data": "^3.0.0"
},
"dependencies": {
"@types/node": {
"version": "14.17.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.0.tgz",
"integrity": "sha512-w8VZUN/f7SSbvVReb9SWp6cJFevxb4/nkG65yLAya//98WgocKm5PLDAtSs5CtJJJM+kHmJjO/6mmYW4MHShZA=="
},
"form-data": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
}
}
},
"@tokenizer/token": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.1.1.tgz",
"integrity": "sha512-XO6INPbZCxdprl+9qa/AAbFFOMzzwqYxpjPgLICrMD6C2FCw6qfJOPcBk6JqqPLSaZ/Qx87qn4rpPmPMwaAK6w=="
},
"@types/body-parser": {
"version": "1.19.0",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.0.tgz",
"integrity": "sha512-W98JrE0j2K78swW4ukqMleo8R7h/pFETjM2DQ90MF6XK2i4LO4W3gQ71Lt4w3bfm2EvVSyWHplECvB5sK22yFQ==",
"requires": {
"@types/connect": "*",
"@types/node": "*"
}
},
"@types/caseless": {
"version": "0.12.2",
"resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.2.tgz",
"integrity": "sha512-6ckxMjBBD8URvjB6J3NcnuAn5Pkl7t3TizAg+xdlzzQGSPSmBcXf8KoIH0ua/i+tio+ZRUHEXp0HEmvaR4kt0w=="
},
"@types/connect": {
"version": "3.4.34",
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.34.tgz",
"integrity": "sha512-ePPA/JuI+X0vb+gSWlPKOY0NdNAie/rPUqX2GUPpbZwiKTkSPhjXWuee47E4MtE54QVzGCQMQkAL6JhV2E1+cQ==",
"requires": {
"@types/node": "*"
}
},
"@types/debug": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.5.tgz",
"integrity": "sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ=="
},
"@types/node": {
"version": "8.10.61",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.61.tgz",
"integrity": "sha512-l+zSbvT8TPRaCxL1l9cwHCb0tSqGAGcjPJFItGGYat5oCTiq1uQQKYg5m7AF1mgnEBzFXGLJ2LRmNjtreRX76Q=="
},
"@types/request": {
"version": "2.48.5",
"resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.5.tgz",
"integrity": "sha512-/LO7xRVnL3DxJ1WkPGDQrp4VTV1reX9RkC85mJ+Qzykj2Bdw+mG15aAfDahc76HtknjzE16SX/Yddn6MxVbmGQ==",
"requires": {
"@types/caseless": "*",
"@types/node": "*",
"@types/tough-cookie": "*",
"form-data": "^2.5.0"
}
},
"@types/tough-cookie": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.0.tgz",
"integrity": "sha512-I99sngh224D0M7XgW1s120zxCt3VYQ3IQsuw3P3jbq5GG4yc79+ZjyKznyOGIQrflfylLgcfekeZW/vk0yng6A=="
},
"abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
},
"accepts": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
......@@ -99,21 +11,6 @@
"requires": {
"mime-types": "~2.1.24",
"negotiator": "0.6.2"
},
"dependencies": {
"mime-db": {
"version": "1.44.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
"integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg=="
},
"mime-types": {
"version": "2.1.27",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
"integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
"requires": {
"mime-db": "1.44.0"
}
}
}
},
"ajv": {
......@@ -160,14 +57,6 @@
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz",
"integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug=="
},
"axios": {
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"requires": {
"follow-redirects": "^1.10.0"
}
},
"bcrypt-pbkdf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
......@@ -176,15 +65,6 @@
"tweetnacl": "^0.14.3"
}
},
"binary": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz",
"integrity": "sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk=",
"requires": {
"buffers": "~0.1.1",
"chainsaw": "~0.1.0"
}
},
"body-parser": {
"version": "1.19.0",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
......@@ -200,20 +80,8 @@
"qs": "6.7.0",
"raw-body": "2.4.0",
"type-is": "~1.6.17"
},
"dependencies": {
"qs": {
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
}
}
},
"buffers": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz",
"integrity": "sha1-skV5w77U1tOWru5tmorn9Ugqt7s="
},
"bytes": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
......@@ -224,14 +92,6 @@
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
},
"chainsaw": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz",
"integrity": "sha1-XqtQsor+WAdNDVgpE4iCi15fvJg=",
"requires": {
"traverse": ">=0.3.0 <0.4"
}
},
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
......@@ -284,20 +144,6 @@
"ms": "2.0.0"
}
},
"decompress-zip": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/decompress-zip/-/decompress-zip-0.3.2.tgz",
"integrity": "sha512-Ab1QY4LrWMrUuo53lLnmGOby7v8ryqxJ+bKibKSiPisx+25mhut1dScVBXAYx14i/PqSrFZvR2FRRazhLbvL+g==",
"requires": {
"binary": "^0.3.0",
"graceful-fs": "^4.1.3",
"mkpath": "^0.1.0",
"nopt": "^3.0.1",
"q": "^1.1.2",
"readable-stream": "^1.1.8",
"touch": "0.0.3"
}
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
......@@ -377,13 +223,6 @@
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
},
"dependencies": {
"qs": {
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
}
}
},
"extend": {
......@@ -406,17 +245,6 @@
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
},
"file-type": {
"version": "15.0.1",
"resolved": "https://registry.npmjs.org/file-type/-/file-type-15.0.1.tgz",
"integrity": "sha512-0LieQlSA3bWUdErNrxzxfI4rhsvNAVPBO06R8pTc1hp9SE6nhqlVyvhcaXoMmtXkBTPnQenbMPLW9X76hH76oQ==",
"requires": {
"readable-web-to-node-stream": "^2.0.0",
"strtok3": "^6.0.3",
"token-types": "^2.0.0",
"typedarray-to-buffer": "^3.1.5"
}
},
"finalhandler": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
......@@ -431,20 +259,15 @@
"unpipe": "~1.0.0"
}
},
"follow-redirects": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz",
"integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg=="
},
"forever-agent": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE="
},
"form-data": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.6",
......@@ -469,11 +292,6 @@
"assert-plus": "^1.0.0"
}
},
"graceful-fs": {
"version": "4.2.4",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
"integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw=="
},
"har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
......@@ -518,11 +336,6 @@
"safer-buffer": ">= 2.1.2 < 3"
}
},
"ieee754": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
},
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
......@@ -538,11 +351,6 @@
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
},
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
},
"isstream": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
......@@ -579,11 +387,6 @@
"verror": "1.10.0"
}
},
"lodash": {
"version": "4.17.19",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ=="
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
......@@ -605,23 +408,18 @@
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
},
"mime-db": {
"version": "1.37.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz",
"integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg=="
"version": "1.44.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
"integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg=="
},
"mime-types": {
"version": "2.1.21",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz",
"integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==",
"version": "2.1.27",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
"integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
"requires": {
"mime-db": "~1.37.0"
"mime-db": "1.44.0"
}
},
"mkpath": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/mkpath/-/mkpath-0.1.0.tgz",
"integrity": "sha1-dVSm+Nhxg0zJe1RisSLEwSTW3pE="
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
......@@ -632,27 +430,6 @@
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
},
"ngrok": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/ngrok/-/ngrok-3.2.7.tgz",
"integrity": "sha512-B7K15HM0qRZplL2aO/yfxixYubH0M50Pfu0fa4PDcmXP7RC+wyYzu6YtX77BBHHCfbwCzkObX6YdO8ThpCR6Lg==",
"requires": {
"@types/node": "^8.10.50",
"@types/request": "^2.48.2",
"decompress-zip": "^0.3.2",
"request": "^2.88.0",
"request-promise-native": "^1.0.7",
"uuid": "^3.3.2"
}
},
"nopt": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
"integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=",
"requires": {
"abbrev": "1"
}
},
"oauth-sign": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
......@@ -676,11 +453,6 @@
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
},
"peek-readable": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-3.1.3.tgz",
"integrity": "sha512-mpAcysyRJxmICBcBa5IXH7SZPvWkcghm6Fk8RekoS3v+BpbSzlZzuWbMx+GXrlUwESi9qHar4nVEZNMKylIHvg=="
},
"performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
......@@ -705,15 +477,10 @@
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
},
"q": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
"integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc="
},
"qs": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
},
"range-parser": {
"version": "1.2.1",
......@@ -731,22 +498,6 @@
"unpipe": "1.0.0"
}
},
"readable-stream": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"string_decoder": "~0.10.x"
}
},
"readable-web-to-node-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-2.0.0.tgz",
"integrity": "sha512-+oZJurc4hXpaaqsN68GoZGQAQIA3qr09Or4fqEsargABnbe5Aau8hFn6ISVleT3cpY/0n/8drn7huyyEvTbghA=="
},
"request": {
"version": "2.88.2",
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
......@@ -774,36 +525,13 @@
"uuid": "^3.3.2"
},
"dependencies": {
"form-data": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.6",
"mime-types": "^2.1.12"
}
"qs": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
}
}
},
"request-promise-core": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz",
"integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==",
"requires": {
"lodash": "^4.17.15"
}
},
"request-promise-native": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.8.tgz",
"integrity": "sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ==",
"requires": {
"request-promise-core": "1.1.3",
"stealthy-require": "^1.1.1",
"tough-cookie": "^2.3.3"
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
......@@ -878,58 +606,11 @@
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
},
"stealthy-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
"integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks="
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
},
"strtok3": {
"version": "6.0.8",
"resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.0.8.tgz",
"integrity": "sha512-QLgv+oiXwXgCgp2PdPPa+Jpp4D9imK9e/0BsyfeFMr6QL6wMVqoVn9+OXQ9I7MZbmUzN6lmitTJ09uwS2OmGcw==",
"requires": {
"@tokenizer/token": "^0.1.1",
"@types/debug": "^4.1.5",
"peek-readable": "^3.1.3"
}
},
"toidentifier": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
},
"token-types": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/token-types/-/token-types-2.1.1.tgz",
"integrity": "sha512-wnQcqlreS6VjthyHO3Y/kpK/emflxDBNhlNUPfh7wE39KnuDdOituXomIbyI79vBtF0Ninpkh72mcuRHo+RG3Q==",
"requires": {
"@tokenizer/token": "^0.1.1",
"ieee754": "^1.2.1"
}
},
"touch": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/touch/-/touch-0.0.3.tgz",
"integrity": "sha1-Ua7z1ElXHU8oel2Hyci0kYGg2x0=",
"requires": {
"nopt": "~1.0.10"
},
"dependencies": {
"nopt": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
"integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=",
"requires": {
"abbrev": "1"
}
}
}
},
"tough-cookie": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
......@@ -939,11 +620,6 @@
"punycode": "^2.1.1"
}
},
"traverse": {
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz",
"integrity": "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk="
},
"tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
......@@ -964,29 +640,6 @@
"requires": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
},
"dependencies": {
"mime-db": {
"version": "1.44.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
"integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg=="
},
"mime-types": {
"version": "2.1.27",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
"integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
"requires": {
"mime-db": "1.44.0"
}
}
}
},
"typedarray-to-buffer": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
"integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==",
"requires": {
"is-typedarray": "^1.0.0"
}
},
"unpipe": {
......
{
"name": "kitchensink",
"version": "0.0.0",
"description": "A kitchen-sink LINE bot example",
"main": "index.js",
"name": "trans",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"build-sdk": "cd ../../; npm i; npm run build",
"start": "node ."
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"@line/bot-sdk": "^7.3.0",
"express": "^4.17.1",
"ngrok": "^3.2.7"
"request": "^2.88.2"
}
}
......