Toggle navigation
Toggle navigation
This project
Loading...
Sign in
신승미
/
weatherClothing
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Seungmi
2020-12-12 00:18:09 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e462d99d94b5607aa52babaadda006577ae83a42
e462d99d
1 parent
6b9bbd6e
토큰 삭제 및 일부 수정
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
20 deletions
app.js
app.js
View file @
e462d99
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
){
...
...
Please
register
or
login
to post a comment