Showing
1 changed file
with
5 additions
and
6 deletions
... | @@ -11,8 +11,8 @@ const bodyParser = require('body-parser'); | ... | @@ -11,8 +11,8 @@ 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 | -let pyshell = new PythonShell('weather_chat.py', {mode: 'text'}); | 15 | +var pyshell = new PythonShell('weather_chat.py'); |
16 | 16 | ||
17 | app.use(bodyParser.json()); | 17 | app.use(bodyParser.json()); |
18 | 18 | ||
... | @@ -87,11 +87,10 @@ function chatUse(replyToken){ | ... | @@ -87,11 +87,10 @@ function chatUse(replyToken){ |
87 | } | 87 | } |
88 | 88 | ||
89 | function chatWeather(replyToken){ | 89 | function chatWeather(replyToken){ |
90 | - var PM = " "; | ||
91 | 90 | ||
92 | - pyshell.send('request') | 91 | + pyshell.on('message', function (data) { |
93 | - pyshell.on('message', function(data){ | 92 | + console.log(data); |
94 | - PM = data; | 93 | + |
95 | }); | 94 | }); |
96 | 95 | ||
97 | request.post( | 96 | request.post( | ... | ... |
-
Please register or login to post a comment