Toggle navigation
Toggle navigation
This project
Loading...
Sign in
최재웅
/
menu_recommand_webpage
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
EC2 Default User
2022-06-07 21:14:40 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e01fe4376dcf7cecb07c2e813a5e2a70261fc918
e01fe437
1 parent
f2fede50
fix app.js to use fileread.py file
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
11 deletions
CHATBOT/app.js
CHATBOT/app.js
View file @
e01fe43
...
...
@@ -3,15 +3,15 @@ var count = 0;
var
choosen
=
new
Array
();
var
express
=
require
(
'express'
);
const
request
=
require
(
'request'
);
const
TARGET_URL
=
'
타겟 URL
'
const
TOKEN
=
'
토큰
'
const
PAPAGO_URL
=
'
파파고 URL
'
const
PAPAGO_ID
=
'
파파고 ID
'
const
PAPAGO_SECRET
=
'
파파고 시크릿
'
const
fs
=
require
(
'fs'
);
const
TARGET_URL
=
'
https://api.line.me/v2/bot/message/reply
'
const
TOKEN
=
'
Ur8nbk2bQAc9KavLSSJv0uzlKWCxCBnOJOKyqbRS1mMHWgJlEOPfb7v+X1DDEHocUmhU7KnPFN+KHt5S3SYd5QmF42aTeQpW2gDVTjyqty1Tn+p6QqEhI/uSz659PBHwczEYn0Plx+akfCNHDPJRpAdB04t89/1O/w1cDnyilFU=
'
const
PAPAGO_URL
=
'
https://openapi.naver.com/v1/papago/n2mt
'
const
PAPAGO_ID
=
'
1Z83W3lUGLqnNbrDAk8A
'
const
PAPAGO_SECRET
=
'
ST7ElRPFPP
'
var
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
HTTPS
=
require
(
'https'
);
const
domain
=
"
도메인
"
const
domain
=
"
2021105602.osschatbot2022.tk
"
const
sslport
=
23023
;
const
bodyParser
=
require
(
'body-parser'
);
const
res
=
require
(
'express/lib/response'
);
...
...
@@ -35,7 +35,7 @@ app.post('/hook', function (req, res) {
count
++
;
start_msg
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
);
}
else
if
(
eventObj
.
message
.
text
==
'y'
&&
count
==
1
)
}
else
if
(
eventObj
.
message
.
text
==
=
'y'
&&
count
==
1
)
{
opt_1
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
);
}
else
if
((
eventObj
.
message
.
text
===
'1'
||
eventObj
.
message
.
text
===
'2'
||
eventObj
.
message
.
text
===
'3'
||
eventObj
.
message
.
text
==
'4'
||
eventObj
.
message
.
texts
==
'5'
)
&&
count
==
1
)
...
...
@@ -74,9 +74,16 @@ app.post('/hook', function (req, res) {
}
else
{
err
(
eventObj
.
replyToken
);
}
const
spawn
=
require
(
'child_process'
).
spawn
;
const
result
=
spawn
(
'python'
,
[
'/home/ec2-user/menu_recommand_webpage-1/CHATBOT/fileread_practice.py'
,
'/home/ec2-user/menu_recommand_webpage-1/CHATBOT/1_person.txt'
,
'/home/ec2-user/menu_recommand_webpage-1/CHATBOT/water.txt'
]);
result
.
stdout
.
on
(
'data'
,
function
(
data
)
{
console
.
log
(
data
.
toString
());
});
result
.
stderr
.
on
(
'data'
,
function
(
data
)
{
console
.
log
(
data
.
toString
());
});
res
.
sendStatus
(
200
);
});
async
function
start_msg
(
replyToken
,
message
)
{
...
...
@@ -358,8 +365,8 @@ async function load_map(replyToken)
"replyToken"
:
replyToken
,
"messages"
:
[
{
"type"
:
"
herf
"
,
"
href"
:
"file:///C:/Users/pnr02/Desktop/opensource_project/selectWestern.html
"
"type"
:
"
text
"
,
"
text"
:
"https://www.daleseo.com/js-sleep/
"
}
]
}
...
...
@@ -390,6 +397,21 @@ async function err(replyToken)
});
}
async
function
read_file
(
dir
,
arr
)
{
await
fs
.
readFile
(
dir
,
function
(
err
,
data
)
{
if
(
err
)
throw
err
;
arr
=
data
.
toString
().
split
(
"\n"
);
n1
=
arr
;
});
}
function
sleep
(
ms
)
{
const
wakeUpTime
=
Date
.
now
()
+
ms
;
while
(
Date
.
now
()
<
wakeUpTime
)
{}
}
try
{
const
option
=
{
ca
:
fs
.
readFileSync
(
'/etc/letsencrypt/live/'
+
domain
+
'/fullchain.pem'
),
...
...
Please
register
or
login
to post a comment