Seungmi

토큰 삭제 및 일부 수정

Showing 1 changed file with 16 additions and 5 deletions
1 var express = require('express'); 1 var express = require('express');
2 const request = require('request'); 2 const request = require('request');
3 const TARGET_URL = 'https://api.line.me/v2/bot/message/reply' 3 const TARGET_URL = 'https://api.line.me/v2/bot/message/reply'
4 -const TOKEN = 'BDWbq6IfUnMHJrG2k80BvhNly63c/K0TURS26/Kx1EWW82d3o767nHhGfu1G9PbJDye2vg6blpqTUdEU3ATMwN1NEZd0GggujmBbHuUk3iBrzBCTm5LUqHlf4+5lFS8eQb7i9WCcYjdakEt2EAYiZQdB04t89/1O/w1cDnyilFU=' 4 +const TOKEN = '' // 라인 토큰
5 const fs = require('fs'); 5 const fs = require('fs');
6 const path = require('path'); 6 const path = require('path');
7 const HTTPS = require('https'); 7 const HTTPS = require('https');
8 -const domain = "www.weatherchatbot.ml" 8 +const domain = "www.weatherchatbot.ml" // 도메인
9 const sslport = 23023; 9 const sslport = 23023;
10 const bodyParser = require('body-parser'); 10 const bodyParser = require('body-parser');
11 var app = express(); 11 var app = express();
12 const { info } = require('console'); 12 const { info } = require('console');
13 13
14 var {PythonShell} = require('python-shell'); 14 var {PythonShell} = require('python-shell');
15 +
16 +var options = {
17 +
18 + mode: 'text',
19 + pythonPath: '',
20 + pythonOptions: ['-u'],
21 + scriptPath:'',
22 + args: ['value1, value2, value3']
23 +
24 +};
15 var pyshell = new PythonShell('weather_chat.py'); 25 var pyshell = new PythonShell('weather_chat.py');
16 26
17 app.use(bodyParser.json()); 27 app.use(bodyParser.json());
...@@ -91,8 +101,6 @@ function chatWeather(replyToken){ ...@@ -91,8 +101,6 @@ function chatWeather(replyToken){
91 pyshell.on('message', function (data) { 101 pyshell.on('message', function (data) {
92 console.log(data); 102 console.log(data);
93 103
94 - });
95 -
96 request.post( 104 request.post(
97 { 105 {
98 url: TARGET_URL, 106 url: TARGET_URL,
...@@ -104,13 +112,16 @@ function chatWeather(replyToken){ ...@@ -104,13 +112,16 @@ function chatWeather(replyToken){
104 "messages":[ 112 "messages":[
105 { 113 {
106 "type":"text", 114 "type":"text",
107 - "text": PM 115 + "text": data
108 } 116 }
109 ] 117 ]
110 } 118 }
111 },(error, response, body) => { 119 },(error, response, body) => {
112 console.log(body) 120 console.log(body)
113 }); 121 });
122 +
123 + });
124 +
114 } 125 }
115 126
116 function chatWrong(replyToken){ 127 function chatWrong(replyToken){
......