Showing
4 changed files
with
71 additions
and
4 deletions
| ... | @@ -57,6 +57,13 @@ exports.championFunction = function(req, res) { | ... | @@ -57,6 +57,13 @@ exports.championFunction = function(req, res) { |
| 57 | "label": "상세한 정보 확인", | 57 | "label": "상세한 정보 확인", |
| 58 | "webLinkUrl": "https://lolchess.gg/champions/set3.5/" + championEnglishName | 58 | "webLinkUrl": "https://lolchess.gg/champions/set3.5/" + championEnglishName |
| 59 | } | 59 | } |
| 60 | + ], | ||
| 61 | + "buttons":[ | ||
| 62 | + { | ||
| 63 | + "action": "block", | ||
| 64 | + "label": "메뉴로 돌아가기", | ||
| 65 | + "blockId": "5ee0eef3e0d4e2000176b3f7" | ||
| 66 | + } | ||
| 60 | ] | 67 | ] |
| 61 | } | 68 | } |
| 62 | } | 69 | } | ... | ... |
data/composition.js
0 → 100644
| 1 | +const express = require('express'); | ||
| 2 | +const app = express(); | ||
| 3 | +const logger = require('morgan'); | ||
| 4 | +const bodyParser = require('body-parser'); | ||
| 5 | +const apiRouter = express.Router(); | ||
| 6 | +const axios = require("axios"); | ||
| 7 | +const cheerio = require('cheerio'); | ||
| 8 | +const log = console.log; | ||
| 9 | +const getHtml = async() => { | ||
| 10 | + try{ | ||
| 11 | + return await axios.get("https://blitz.gg/tft/comps/stats"); | ||
| 12 | + }catch(error){ | ||
| 13 | + console.error(error); | ||
| 14 | + } | ||
| 15 | +}; | ||
| 16 | + | ||
| 17 | +var rank = ""; | ||
| 18 | +getHtml() | ||
| 19 | + .then(html => { | ||
| 20 | + let ulList = []; | ||
| 21 | + const $ = cheerio.load(html.data); | ||
| 22 | + const $bodyList = $("div.Comps__CompsContainer-kqepsu-0 ol").children("li.notExpanded"); | ||
| 23 | + //const $bodyList = $("div.ah_list.PM_CL_realtimeKeyword_list_base ul.ah_l").children("li.ah_item"); | ||
| 24 | + //log($bodyList); | ||
| 25 | + | ||
| 26 | + $bodyList.each(function(i,elem) { | ||
| 27 | + //console.log($(this)); | ||
| 28 | + rank += $(this).find("div.CompCard__CardLeft-sc-1hw5aoj-3 div.TierIconTooltip__TierIconBox-sc-1vdglos-2 svg.createSvgIcon__Svg-sc-1l8xi8d-0 title").text() + "\n"; | ||
| 29 | + rank += $(this).find("h1.typography__Body2-sc-1mpsx83-7").text() + '\n'; | ||
| 30 | + // ulList[i] = { | ||
| 31 | + // //title: $(this).find('span.ah_k').text(), | ||
| 32 | + // //url: $(this).find('a.ah_a').attr('href') | ||
| 33 | + // title: $(this).find('td.info a.title').text().trim() | ||
| 34 | + // }; | ||
| 35 | + // console.log(ulList[i].title); | ||
| 36 | + }); | ||
| 37 | + | ||
| 38 | + }) | ||
| 39 | + | ||
| 40 | +exports.compositionFunction = function(req,res){ | ||
| 41 | + const responseBody = { | ||
| 42 | + "version": "2.0", | ||
| 43 | + "template": { | ||
| 44 | + "outputs": [ | ||
| 45 | + { | ||
| 46 | + "simpleText": { | ||
| 47 | + "text": rank | ||
| 48 | + | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + ] | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + res.status(200).send(responseBody); | ||
| 55 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -25,7 +25,7 @@ exports.basicItemFunction = function(req,res){ | ... | @@ -25,7 +25,7 @@ exports.basicItemFunction = function(req,res){ |
| 25 | "outputs": [ | 25 | "outputs": [ |
| 26 | { | 26 | { |
| 27 | "simpleText": { | 27 | "simpleText": { |
| 28 | - "text": "원하시는 아이템 이름(줄임말 포함)을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n\n현재 존재하는 완성 아이템 목록 :\n" + itemList | 28 | + "text": "원하시는 아이템 이름을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n\n현재 존재하는 완성 아이템 목록 :\n" + itemList |
| 29 | 29 | ||
| 30 | } | 30 | } |
| 31 | } | 31 | } |
| ... | @@ -114,7 +114,7 @@ exports.completedItemFunction = function(req,res){ | ... | @@ -114,7 +114,7 @@ exports.completedItemFunction = function(req,res){ |
| 114 | "outputs": [ | 114 | "outputs": [ |
| 115 | { | 115 | { |
| 116 | "simpleText": { | 116 | "simpleText": { |
| 117 | - "text": "원하시는 아이템 이름(줄임말 포함)을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n\n현재 존재하는 완성 아이템 목록 :\n" + itemList | 117 | + "text": "원하시는 아이템 이름을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n\n현재 존재하는 완성 아이템 목록 :\n" + itemList |
| 118 | 118 | ||
| 119 | } | 119 | } |
| 120 | } | 120 | } |
| ... | @@ -182,7 +182,7 @@ exports.consumableItemFunction = function(req,res){ | ... | @@ -182,7 +182,7 @@ exports.consumableItemFunction = function(req,res){ |
| 182 | "outputs": [ | 182 | "outputs": [ |
| 183 | { | 183 | { |
| 184 | "simpleText": { | 184 | "simpleText": { |
| 185 | - "text": "원하시는 아이템 이름(줄임말 포함)을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n\n현재 존재하는 완성 아이템 목록 :\n니코의 도움" | 185 | + "text": "원하시는 아이템 이름을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n\n현재 존재하는 완성 아이템 목록 :\n니코의 도움" |
| 186 | 186 | ||
| 187 | } | 187 | } |
| 188 | } | 188 | } | ... | ... |
| ... | @@ -5,7 +5,9 @@ const bodyParser = require('body-parser'); | ... | @@ -5,7 +5,9 @@ const bodyParser = require('body-parser'); |
| 5 | const apiRouter = express.Router(); | 5 | const apiRouter = express.Router(); |
| 6 | const champion = require('./champion.js') | 6 | const champion = require('./champion.js') |
| 7 | const item = require('./item.js') | 7 | const item = require('./item.js') |
| 8 | - | 8 | +const trait = require('./trait.js') |
| 9 | +const galaxy = require('./galaxy.js') | ||
| 10 | +const composition = require('./composition.js') | ||
| 9 | app.use('/static', express.static('data/Image data')); | 11 | app.use('/static', express.static('data/Image data')); |
| 10 | app.use(logger('dev', {})); | 12 | app.use(logger('dev', {})); |
| 11 | app.use(bodyParser.json()); | 13 | app.use(bodyParser.json()); |
| ... | @@ -17,6 +19,9 @@ apiRouter.post('/champion', champion.championFunction); | ... | @@ -17,6 +19,9 @@ apiRouter.post('/champion', champion.championFunction); |
| 17 | apiRouter.post('/basicItem',item.basicItemFunction); | 19 | apiRouter.post('/basicItem',item.basicItemFunction); |
| 18 | apiRouter.post('/completedItem',item.completedItemFunction); | 20 | apiRouter.post('/completedItem',item.completedItemFunction); |
| 19 | apiRouter.post('/consumableItem',item.consumableItemFunction); | 21 | apiRouter.post('/consumableItem',item.consumableItemFunction); |
| 22 | +apiRouter.post('/trait',trait.traitFunction); | ||
| 23 | +apiRouter.post('/galaxy',galaxy.galaxyFunction); | ||
| 24 | +apiRouter.post('/composition',composition.compositionFunction); | ||
| 20 | 25 | ||
| 21 | app.listen(23023, function() { | 26 | app.listen(23023, function() { |
| 22 | console.log('Skill server listening on port 23023!'); | 27 | console.log('Skill server listening on port 23023!'); | ... | ... |
-
Please register or login to post a comment