Toggle navigation
Toggle navigation
This project
Loading...
Sign in
은승우
/
LINEBOT
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
권은령
2019-12-05 23:42:17 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
637df5433e678b570582e75f4868f6852ab9e183
637df543
1 parent
738b2434
fix error in displaying concert
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
app.js
app.js
View file @
637df54
...
...
@@ -47,6 +47,20 @@ const client = new line.Client(config);
var
songList
=
[];
// list to store music(singer, song, lyric url)
var
data
=
require
(
'./event.json'
);
//json 불러오기
var
data_list
=
data
[
"DATA"
]
var
concert_list
=
[];
for
(
var
i
=
0
;
i
<
data_list
.
length
;
i
++
){
if
(
data_list
[
i
].
codename
==
"콘서트"
){
concert_list
.
push
(
data_list
[
i
].
title
);
}
}
for
(
var
i
=
0
;
i
<
concert_list
.
length
;
i
++
){
console
.
log
(
i
+
1
,
'. '
,
concert_list
[
i
],
'\n'
);
}
//콘서트 목록 만들기
app
.
post
(
'/webhook'
,
line
.
middleware
(
config
),
(
req
,
res
)
=>
{
Promise
...
...
@@ -247,7 +261,6 @@ function handleEvent(event) {
});
}
else
if
(
event
.
message
.
text
.
substring
(
0
,
6
)
==
'콘서트 보기'
||
event
.
message
.
text
.
substring
(
0
,
5
)
==
'콘서트보기'
){
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
showlist
=
{
type
:
'text'
,
text
:
''
};
...
...
@@ -260,7 +273,6 @@ function handleEvent(event) {
client
.
replyMessage
(
event
.
replyToken
,
showlist
).
then
(
resolve
).
catch
(
reject
);
});
}
else
if
(
0
<
event
.
message
.
text
.
substr
(
0
,
2
)
*
1
&&
event
.
message
.
text
.
substr
(
0
,
2
)
*
1
<
27
){
var
selectnum
=
(
event
.
message
.
text
.
substr
(
0
,
2
)
*
1
);
...
...
@@ -270,7 +282,6 @@ function handleEvent(event) {
result
.
text
=
'목록에 존재하지 않는 콘서트입니다.'
;
return
;
}
return
new
Promise
(
function
(
resolve
,
reject
){
var
concert_name
=
concert_list
[
selectnum
-
1
];
var
$
=
cheerio
.
load
(
concert_name
);
...
...
@@ -287,7 +298,6 @@ function handleEvent(event) {
type
:
'video'
}
};
request
(
options
,
function
(
error
,
result
,
body
){
if
(
error
)
throw
new
Error
(
error
);
var
videourl
=
{
type
:
'text'
,
text
:
''
};
...
...
Please
register
or
login
to post a comment