Toggle navigation
Toggle navigation
This project
Loading...
Sign in
신정아
/
weather_chatbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Issues
1
Network
Create a new issue
Commits
Issue Boards
Authored by
Ubuntu
2020-06-25 09:33:42 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5612cd060a860478a58a9619c8e2d88074ace4ab
5612cd06
1 parent
b2dae168
final fianl
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
15 deletions
Experiments/messenger/weather_chatbot/app.js
Experiments/messenger/weather_chatbot/nohup.out
Experiments/messenger/weather_chatbot/app.js
View file @
5612cd0
var
express
=
require
(
'express'
);
//express 모듈을 사용
var
qs
=
require
(
'querystring'
)
const
request
=
require
(
'request'
);
//request 모듈을 사용
const
TARGET_URL
=
'https://api.line.me/v2/bot/message/reply'
//라인 api
const
TARGET_URL
=
'https://api.line.me/v2/bot/message/reply'
const
fs
=
require
(
'fs'
)
var
NOW
=
new
Date
()
var
YEAR
=
NOW
.
getFullYear
()
...
...
@@ -21,7 +21,7 @@ const sslport = 23023;
const
bodyParser
=
require
(
'body-parser'
);
var
app
=
express
();
var
premessage
=
'premessage'
var
check
=
false
//
var check = false
app
.
use
(
bodyParser
.
json
());
...
...
@@ -44,10 +44,10 @@ app.post('/hook', function (req, res) {
console
.
log
(
'[request source] '
,
eventObj
.
source
);
console
.
log
(
'[request message]'
,
eventObj
.
message
);
if
(
check
==
false
){
start
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
)}
else
{
info
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
)}
//
if (check == false){
start
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
)
//
}
//
else{
info
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
)
//
}
...
...
@@ -58,14 +58,15 @@ app.post('/hook', function (req, res) {
function
info
(
replyToken
,
message
){
if
(
check
==
false
)
/*
if(check==false)
{
return
}
*/
if
(
check
==
true
)
{
//
if(check == true)
//
{
var
s
=
message
.
split
(
' '
);
var
m
=
false
...
...
@@ -79,10 +80,10 @@ function info (replyToken, message){
}
}
if
(
m
==
false
){
return
}
}
//
if(m == false){
//
return
//
}
//
}
request
.
get
(
{
url
:
WEATHER_URL
,
...
...
@@ -166,13 +167,15 @@ function info (replyToken, message){
function
start
(
replyToken
,
message
){
if
(
message
!=
'시작'
)
{
check
=
false
//
check = false
return
}
/*
if(message == '시작'){
check
=
true
//
check= true
}
*/
var
startMessage
=
'[[특별 혹은 광역시/도]] [[시/구/군/(특별시와 광역시를 제외하고는 시와 구를 붙여주세요)]] [[읍/면/동]]으로 입력해주세요. 예)서울특별시 종로구 사직동, 경기도 용인시기흥구 기흥동, 경기도 안성시 공도읍 '
request
.
post
(
...
...
Experiments/messenger/weather_chatbot/nohup.out
View file @
5612cd0
...
...
@@ -74070,3 +74070,53 @@ undefined
[request message] { type: 'text', id: '12206130725410', text: '서울특별시 종로구 사직동' }
undefined
{}
====================== 2020-06-25T08:52:11.178Z ======================
[request] {
events: [
{
type: 'message',
replyToken: 'abe3448d11764adeb9b1317b4bcdcf5b',
source: [Object],
timestamp: 1593075131007,
mode: 'active',
message: [Object]
}
],
destination: 'Ufc379ceefa900fc314514d0d0c0f13cc'
}
[request source] { userId: 'U484f0bb741ba39b93dcba8dbb731860d', type: 'user' }
[request message] { type: 'text', id: '12206825811801', text: '시작' }
====================== 2020-06-25T08:52:19.066Z ======================
[request] {
events: [
{
type: 'message',
replyToken: '0d5f20facc5f4b4aa4b685515b7f52f3',
source: [Object],
timestamp: 1593075138919,
mode: 'active',
message: [Object]
}
],
destination: 'Ufc379ceefa900fc314514d0d0c0f13cc'
}
[request source] { userId: 'U484f0bb741ba39b93dcba8dbb731860d', type: 'user' }
[request message] { type: 'text', id: '12206826437003', text: '서울특별시 종로구 사직동' }
undefined
{}
====================== 2020-06-25T08:52:27.366Z ======================
[request] {
events: [
{
type: 'message',
replyToken: 'a342aefef6bf46c28cef943b52d48ce4',
source: [Object],
timestamp: 1593075147227,
mode: 'active',
message: [Object]
}
],
destination: 'Ufc379ceefa900fc314514d0d0c0f13cc'
}
[request source] { userId: 'U484f0bb741ba39b93dcba8dbb731860d', type: 'user' }
[request message] { type: 'text', id: '12206827103789', text: '시작' }
...
...
Please
register
or
login
to post a comment