Seungmi

토큰 삭제 및 일부 수정

Showing 1 changed file with 31 additions and 20 deletions
var express = require('express');
const request = require('request');
const TARGET_URL = 'https://api.line.me/v2/bot/message/reply'
const TOKEN = 'BDWbq6IfUnMHJrG2k80BvhNly63c/K0TURS26/Kx1EWW82d3o767nHhGfu1G9PbJDye2vg6blpqTUdEU3ATMwN1NEZd0GggujmBbHuUk3iBrzBCTm5LUqHlf4+5lFS8eQb7i9WCcYjdakEt2EAYiZQdB04t89/1O/w1cDnyilFU='
const TOKEN = '' // 라인 토큰
const fs = require('fs');
const path = require('path');
const HTTPS = require('https');
const domain = "www.weatherchatbot.ml"
const domain = "www.weatherchatbot.ml" // 도메인
const sslport = 23023;
const bodyParser = require('body-parser');
var app = express();
const { info } = require('console');
var {PythonShell} = require('python-shell');
var options = {
mode: 'text',
pythonPath: '',
pythonOptions: ['-u'],
scriptPath:'',
args: ['value1, value2, value3']
};
var pyshell = new PythonShell('weather_chat.py');
app.use(bodyParser.json());
......@@ -90,27 +100,28 @@ function chatWeather(replyToken){
pyshell.on('message', function (data) {
console.log(data);
request.post(
{
url: TARGET_URL,
headers: {
'Authorization': `Bearer ${TOKEN}`
},
json: {
"replyToken":replyToken,
"messages":[
{
"type":"text",
"text": data
}
]
}
},(error, response, body) => {
console.log(body)
});
});
request.post(
{
url: TARGET_URL,
headers: {
'Authorization': `Bearer ${TOKEN}`
},
json: {
"replyToken":replyToken,
"messages":[
{
"type":"text",
"text": PM
}
]
}
},(error, response, body) => {
console.log(body)
});
}
function chatWrong(replyToken){
......