Toggle navigation
Toggle navigation
This project
Loading...
Sign in
장재훈
/
TFT_Chat_Bot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
2
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
장재훈
2020-06-25 06:06:02 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d33ad5b3e561ee1ac104386352e74f5ee2ca7f13
d33ad5b3
1 parent
a5b02c83
Add composition.js
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
4 deletions
data/champion.js
data/composition.js
data/item.js
data/main.js
data/champion.js
View file @
d33ad5b
...
...
@@ -57,6 +57,13 @@ exports.championFunction = function(req, res) {
"label"
:
"상세한 정보 확인"
,
"webLinkUrl"
:
"https://lolchess.gg/champions/set3.5/"
+
championEnglishName
}
],
"buttons"
:[
{
"action"
:
"block"
,
"label"
:
"메뉴로 돌아가기"
,
"blockId"
:
"5ee0eef3e0d4e2000176b3f7"
}
]
}
}
...
...
data/composition.js
0 → 100644
View file @
d33ad5b
const
express
=
require
(
'express'
);
const
app
=
express
();
const
logger
=
require
(
'morgan'
);
const
bodyParser
=
require
(
'body-parser'
);
const
apiRouter
=
express
.
Router
();
const
axios
=
require
(
"axios"
);
const
cheerio
=
require
(
'cheerio'
);
const
log
=
console
.
log
;
const
getHtml
=
async
()
=>
{
try
{
return
await
axios
.
get
(
"https://blitz.gg/tft/comps/stats"
);
}
catch
(
error
){
console
.
error
(
error
);
}
};
var
rank
=
""
;
getHtml
()
.
then
(
html
=>
{
let
ulList
=
[];
const
$
=
cheerio
.
load
(
html
.
data
);
const
$bodyList
=
$
(
"div.Comps__CompsContainer-kqepsu-0 ol"
).
children
(
"li.notExpanded"
);
//const $bodyList = $("div.ah_list.PM_CL_realtimeKeyword_list_base ul.ah_l").children("li.ah_item");
//log($bodyList);
$bodyList
.
each
(
function
(
i
,
elem
)
{
//console.log($(this));
rank
+=
$
(
this
).
find
(
"div.CompCard__CardLeft-sc-1hw5aoj-3 div.TierIconTooltip__TierIconBox-sc-1vdglos-2 svg.createSvgIcon__Svg-sc-1l8xi8d-0 title"
).
text
()
+
"\n"
;
rank
+=
$
(
this
).
find
(
"h1.typography__Body2-sc-1mpsx83-7"
).
text
()
+
'\n'
;
// ulList[i] = {
// //title: $(this).find('span.ah_k').text(),
// //url: $(this).find('a.ah_a').attr('href')
// title: $(this).find('td.info a.title').text().trim()
// };
// console.log(ulList[i].title);
});
})
exports
.
compositionFunction
=
function
(
req
,
res
){
const
responseBody
=
{
"version"
:
"2.0"
,
"template"
:
{
"outputs"
:
[
{
"simpleText"
:
{
"text"
:
rank
}
}
]
}
}
res
.
status
(
200
).
send
(
responseBody
);
}
\ No newline at end of file
data/item.js
View file @
d33ad5b
...
...
@@ -25,7 +25,7 @@ exports.basicItemFunction = function(req,res){
"outputs"
:
[
{
"simpleText"
:
{
"text"
:
"원하시는 아이템 이름
(줄임말 포함)
을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n\n현재 존재하는 완성 아이템 목록 :\n"
+
itemList
"text"
:
"원하시는 아이템 이름을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n\n현재 존재하는 완성 아이템 목록 :\n"
+
itemList
}
}
...
...
@@ -114,7 +114,7 @@ exports.completedItemFunction = function(req,res){
"outputs"
:
[
{
"simpleText"
:
{
"text"
:
"원하시는 아이템 이름
(줄임말 포함)
을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n\n현재 존재하는 완성 아이템 목록 :\n"
+
itemList
"text"
:
"원하시는 아이템 이름을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n\n현재 존재하는 완성 아이템 목록 :\n"
+
itemList
}
}
...
...
@@ -182,7 +182,7 @@ exports.consumableItemFunction = function(req,res){
"outputs"
:
[
{
"simpleText"
:
{
"text"
:
"원하시는 아이템 이름
(줄임말 포함)
을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n\n현재 존재하는 완성 아이템 목록 :\n니코의 도움"
"text"
:
"원하시는 아이템 이름을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n\n현재 존재하는 완성 아이템 목록 :\n니코의 도움"
}
}
...
...
data/main.js
View file @
d33ad5b
...
...
@@ -5,7 +5,9 @@ const bodyParser = require('body-parser');
const
apiRouter
=
express
.
Router
();
const
champion
=
require
(
'./champion.js'
)
const
item
=
require
(
'./item.js'
)
const
trait
=
require
(
'./trait.js'
)
const
galaxy
=
require
(
'./galaxy.js'
)
const
composition
=
require
(
'./composition.js'
)
app
.
use
(
'/static'
,
express
.
static
(
'data/Image data'
));
app
.
use
(
logger
(
'dev'
,
{}));
app
.
use
(
bodyParser
.
json
());
...
...
@@ -17,6 +19,9 @@ apiRouter.post('/champion', champion.championFunction);
apiRouter
.
post
(
'/basicItem'
,
item
.
basicItemFunction
);
apiRouter
.
post
(
'/completedItem'
,
item
.
completedItemFunction
);
apiRouter
.
post
(
'/consumableItem'
,
item
.
consumableItemFunction
);
apiRouter
.
post
(
'/trait'
,
trait
.
traitFunction
);
apiRouter
.
post
(
'/galaxy'
,
galaxy
.
galaxyFunction
);
apiRouter
.
post
(
'/composition'
,
composition
.
compositionFunction
);
app
.
listen
(
23023
,
function
()
{
console
.
log
(
'Skill server listening on port 23023!'
);
...
...
Please
register
or
login
to post a comment