ShinSeungMin

Edit ChatbotTest_Megabox SSM

1 +const chatbot = require("./app.js");
2 +const request = require('request');
3 +const cheerio = require('cheerio');
4 +const puppeteer = require('puppeteer');
5 +require('chromedriver');
6 +const {Builder,until} = require('selenium-webdriver'); //모듈 불러오기
7 +var webdriver = require('selenium-webdriver');
8 +var By = webdriver.By;
9 +const chrome = require('selenium-webdriver/chrome');//크롬 사용시
10 +const async = require('async')
11 +let express = require('express');
12 +let app = express();
13 +let bodyParser = require('body-parser');
14 +const { timeout } = require('async');
15 +app.use(bodyParser.urlencoded({ extended: false }));
16 +app.use(bodyParser.json());
17 +const booking_url = "https://megabox.co.kr/booking?";
18 +exports.booking_url = booking_url;
19 +const rate_url = "https://www.megabox.co.kr/movie";
20 +let r =0;
21 +let movie_data = [];
22 +exports.movie_data = movie_data;
23 +let location_data = [];
24 +exports.location_data = location_data;
25 +let index = 0;
26 +exports.init = ()=>{async.waterfall([//for 동기적 처리
27 + async () => {
28 + const driver = new webdriver.Builder().forBrowser('chrome').setChromeOptions(new chrome.Options().headless()).build();//
29 + driver.get(booking_url);
30 + driver.switchTo().frame(0)//frameBokdMBooking 프레임 가져옴
31 + let seoul = await driver.wait(until.elementsLocated(By.css('#mCSB_4_container>ul>li>#btn')));
32 + let Gyeonggi = await driver.wait(until.elementsLocated(By.css('#mCSB_5_container>ul>li>#btn')));
33 + const Incheon = await driver.wait(until.elementsLocated(By.css('#mCSB_6_container>ul>li>#btn')));
34 + const DCS = await driver.wait(until.elementsLocated(By.css('#mCSB_7_container>ul>li>#btn')));//Daejeon Chungcheong Sejong
35 + const BDG = await driver.wait(until.elementsLocated(By.css('#mCSB_8_container>ul>li>#btn')));//Busan Daegu Gyeongsang
36 + const GJ= await driver.wait(until.elementsLocated(By.css('#mCSB_9_container>ul>li>#btn')));//gwangju_jeonla
37 + const Gangwon = await driver.wait(until.elementsLocated(By.css('#mCSB_10_container>ul>li>#btn')));
38 + const location_list = [seoul, Gyeonggi, Incheon, DCS, BDG, GJ, Gangwon]//
39 + for(let i = 0; i < location_list.length; i++){
40 + for (item of location_list[i]) {
41 + location_data[index++] = {
42 + 'LocationName':await item.getAttribute("brch-nm"),
43 + 'LocationNum' : await item.getAttribute("brch-no")
44 + }
45 + // let location_name = await item.getAttribute("brch-nm");
46 + // let location_num = await item.getAttribute("brch-no");
47 + // let obj = {};
48 + // obj[location_name]= location_num
49 + // location_data[index++] = obj;
50 + }
51 + }
52 + let movie_list = await driver.wait(until.elementsLocated(By.css('#mCSB_1_container>ul>li>.btn')));
53 + r = 0;
54 + for (item of movie_list) {
55 + //Using getAttribute to get the data
56 + movie_data[r++] = {
57 + 'rank' : r,
58 + 'title' : await item.getAttribute("movie-nm"),
59 + 'movie_num':await item.getAttribute("movie-no"),
60 + }
61 + }
62 +
63 + driver.close();
64 +
65 + },
66 + async () => {
67 + r = 0;
68 + const browser = await puppeteer.launch({
69 + headless: true
70 + });
71 + const page = await browser.newPage();
72 + await page.goto(rate_url);
73 + const content = await page.content();
74 +
75 + const $ = cheerio.load(content);
76 + const $rate_lists = $("ol.list>li");
77 + $rate_lists.each((index, list) => {
78 + const name = $(list).find('div.tit-area > p.tit').attr('title');
79 + const rate = $(list).find('div.rate-date > span.rate').text();
80 +
81 + if(movie_data[r].title === name){
82 + movie_data[r++]['rate'] = rate;
83 + }
84 + });
85 + for(i of movie_data){
86 + if(Object.keys(i).length==3){
87 + movie_data[r++]['rate'] = '예매율 0%';
88 + }
89 + }
90 +
91 + browser.close();
92 + console.log("Comepleted!");
93 + },
94 +
95 +])}
96 +const appdriver = new webdriver.Builder().forBrowser('chrome').setChromeOptions(new chrome.Options().headless()).build();
97 +exports.using_PlayingMovieURL = async(PlayingMovieURL) => {
98 + appdriver.get(PlayingMovieURL);
99 + //appdriver.switchTo().frame(0)
100 + //frameBokdMBooking 프레임 가져옴
101 +}
102 +exports.geting_PlayingMovie= async() => {
103 + let movie_list = await appdriver.wait(until.elementsLocated(By.css('#mCSB_1_container>ul>li>.btn')));
104 + let n = 0;
105 + for (item of movie_list) {
106 + movie_data[n++]['running'] = await item.getAttribute('form-at');
107 + }
108 + console.log("Completed get Running");
109 +}
110 +// let userData = {
111 +// 'Date': '',
112 +// 'location':''
113 +// };
114 +// // const _sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay));
115 +// app.get('/Megabox', (req, res) => {
116 +// res.send(movie_data);
117 +// })
118 +// app.post('/Megabox', (req, res) => {//사용자에게 Date와 location(영화관 장소) 받아옴
119 +// let PlayingMovieURL;
120 +// userData['Date'] = req.body.Date;
121 +// for(i of location_data){
122 +// if(i['LocationName'] == req.body.location){
123 +// userData['location']=i['LocationNum'];
124 +// break;
125 +// }
126 +// }
127 +// PlayingMovieURL = booking_url + '?brchNo1='+userData['location']+'&playDe='+userData['Date'];//사용자 정보 바탕으로 해당 일자 영화관 영화 상영 여부 확인
128 +
129 +// appdriver.get(PlayingMovieURL);
130 +// appdriver.switchTo().frame(0)//frameBokdMBooking 프레임 가져옴
131 +// res.send(movie_data);
132 +// })
133 +// app.post('/Megabox', (req, res) => {//사용자에게 Date와 location(영화관 장소) 받아옴
134 +// userData['Date'] = req.body.Date;
135 +// for(i of location_data){
136 +// if(i['LocationName'] == req.body.location){
137 +// userData['location']=i['LocationNum'];
138 +// break;
139 +// }
140 +// }
141 +// let PlayingMovieURL = booking_url + '?brchNo1='+userData['location']+'&playDe='+userData['Date'];//사용자 정보 바탕으로 해당 일자 영화관 영화 상영 여부 확인
142 +
143 +// appdriver.get(PlayingMovieURL);
144 +// appdriver.switchTo().frame(0)//frameBokdMBooking 프레임 가져옴
145 +// res.send(movie_data);
146 +// })
147 +app.get('/Megabox/GetPlayingMovie', async(req, res, next) => {//영화 상영 여부 객체에 넣음
148 +
149 + // let movie_list = await appdriver.wait(until.elementsLocated(By.css('#mCSB_1_container>ul>li>.btn')));
150 + // let n = 0;
151 + // for (item of movie_list) {
152 + // movie_data[n++]['running'] = await item.getAttribute('form-at')
153 + // }
154 + using_PlayingMovieURL('https://megabox.co.kr/booking?brchNo1=4451&playDe=20220606');
155 + geting_PlayingMovie();
156 + res.send(PlayingMovieList);
157 +})
158 +app.listen(5000);
...\ No newline at end of file ...\ No newline at end of file
1 +const megabox = require('./Megabox.js');
2 +//const SearchingTheaterAPI = require('./SearchingTheaterAPI');
3 +const async = require('async');
4 +megabox.init(); //메가박스 코드 시작(영화관 리스트 가져오기)
5 +
6 +const PUSH_TARGET_URL = 'https://api.line.me/v2/bot/message/push'
7 +const REPLY_TARGET_URL = 'https://api.line.me/v2/bot/message/reply'
8 +const asyncHandler = require('express-async-handler')
9 +const bodyParser = require('body-parser');
10 +const request = require('request');
11 +const moment = require("moment");
12 +const HTTPS = require('https');
13 +
14 +const path = require('path');
15 +const fs = require('fs');
16 +const sslport = 23023;
17 +
18 +var express = require('express');
19 +var app = express();
20 +app.use(bodyParser.json());
21 +
22 +/////////////////////////////////////////////////
23 +// commit 할때 지워야 할것들
24 +const USER_ID = 'U9d630077f22259431099ace7e9a0eb4c'
25 +const TOKEN = 'Yq9KhnuTveSUn7SihUGL51E1YlFvpMkl/w0LwXhGyZq8lzZFWQ5naQgQ504rqwT0sVBScuXZOFHTxFvFb3F/3KXCcOVaj6NlSgwHCanXrsugF9E5KqhROLyRv4EGxvt9MleTefgt1qx5piktuYGkFwdB04t89/1O/w1cDnyilFU='
26 +const domain = "2021105612.osschatbot2022.ml"
27 +
28 +// const USER_ID = ''
29 +// const TOKEN = ''
30 +// const domain = ""
31 +/////////////////////////////////////////////////
32 +
33 +let MEGA_date;
34 +let MEGA_TheaterLocation;
35 +let MEGA_TheaterLocationCode;
36 +let MEGA_PlayingMovieList = [];
37 +let MEGA_title;
38 +let MEGA_PlayingMovieURL;
39 +
40 +let initFlag = false; //브랜드 선택 flag
41 +let MEGA_flag = -1; //메가박스 인지 확인하는 flag
42 +
43 +let MEGA_count; //메가박스에서 영화관 판단하는 count
44 +let MEGA_AbleLocationList = []; //메가박스에서 영화관 이름 매치하는 것 저장하는 list
45 +
46 +exports.MEGA_PlayingMovieURL = MEGA_PlayingMovieURL;
47 +////////////////////////////////////////////////
48 +
49 +
50 +//처음 영화관을 가져오는 것까지 대략 30초가 걸림 => 30초 기다리고 메세지 전송
51 +setTimeout(function () {
52 + PushSingleMessage("원하시는 브랜드의 번호를 입력해주세요.\n1: CGV\n2: LotteCinema\n3: Megabox\n언제든 브랜드를 바꾸고 싶으시다면 '브랜드'를 입력해주세요.");
53 +}, 30000);
54 +
55 +//app.post('/hook', function (req, res) {
56 +app.post('/hook', asyncHandler(async (req, res, next) => {
57 + var eventObj = req.body.events[0];
58 + var source = eventObj.source;
59 + var message = eventObj.message;
60 + // request log
61 + console.log('======================', new Date(), '======================');
62 + console.log('[request]', req.body);
63 + console.log('[request source] ', eventObj.source);
64 + console.log('[request message]', eventObj.message);
65 +
66 + //어느 순간에서든 "브랜드"를 입력해 원하는 브랜드 선택
67 + //initFlag : false ==> 브랜드 선택 전
68 + //initFlag : true ==> 브랜드 선택 됨
69 + if (eventObj.message.text == "브랜드") {
70 + initFlag = false;
71 + MEGA_flag = -1;
72 + PushSingleMessage("원하시는 브랜드의 번호를 입력해주세요.\n1: CGV\n2: LotteCinema\n3: Megabox\n언제든 브랜드를 바꾸고 싶으시다면 '브랜드'를 입력해주세요.");
73 + }
74 +
75 + //브랜드 선택- 메가박스 인 경우 MEGA_flag를 0으로 두어 메가박스 임을 확인
76 + if (initFlag == false && eventObj.message.text == 3) {
77 + initFlag = true;
78 + MEGA_flag = 0;
79 + }
80 +
81 + //메가박스로 브랜드 선택된 경우
82 + if (initFlag == true && MEGA_flag != -1) {
83 + if (MEGA_flag == 0) {
84 + const text1 = "영화관 위치를 입력해주세요";
85 + const text2 = "ex1)강남";
86 + SendMessage(eventObj, text1, text2);
87 + MEGA_flag++;
88 + //PusbuttonhMessage("https://developers.line.biz/en/reference/messaging-api/#message-common-properties");
89 + //console.log(MEGA_flag)
90 + }else if (MEGA_flag === 1) {
91 + MEGA_count = 0; //MEGA_count 초기화
92 + MEGA_AbleLocationList.length = 0; //MEGA_AbleLocationList 초기화
93 + for (i of megabox.location_data) {
94 + if (i['LocationName'].includes(message.text)) {
95 + MEGA_AbleLocationList[MEGA_count++] = i;
96 + }
97 + }
98 +
99 + if (MEGA_count == 1) { //결과 1개 => 바로 다음 단계 넘어가기
100 + MEGA_TheaterLocation = MEGA_AbleLocationList[0].LocationName;
101 + MEGA_TheaterLocationCode = MEGA_AbleLocationList[0].LocationNum;
102 + console.log(MEGA_TheaterLocation, MEGA_TheaterLocationCode);
103 + MEGA_flag++;
104 + } else if (MEGA_count > 1) { //결과 2개 이상 => 리스트 출력해주고 번호로 입력받아 넘어가기
105 + console.log(MEGA_AbleLocationList[0], MEGA_AbleLocationList[1]);
106 + let MEGA_OutputString = "원하시는 상영관의 번호를 정확히 입력해주세요\n"; //메가박스 영화관 가능 정보 string
107 + //PushSingleMessage("원하시는 상영관의 번호를 정확히 입력해주세요");
108 +
109 + for (let x = 0; x < MEGA_count; x++) {
110 + //PushSingleMessage(String(x + 1) + ": " + MEGA_AbleLocationList[x].LocationName);
111 + MEGA_OutputString += String(x + 1) + ": " + MEGA_AbleLocationList[x].LocationName + "\n";
112 + console.log(String(x + 1), MEGA_AbleLocationList[x].LocationName);
113 + }
114 + MEGA_OutputString += String(MEGA_count + 1) + ": 다시 검색하기";
115 + PushSingleMessage(MEGA_OutputString);
116 + MEGA_flag = 101;
117 + } else {
118 + PushSingleMessage("다시 입력해주세요.");
119 + }
120 +
121 +
122 + //원본 코드
123 + //console.log(MEGA_flag);
124 + // for (i of megabox.location_data) {
125 + // if (i['LocationName'] === message.text) {
126 + // MEGA_TheaterLocationCode = i['LocationNUm'];
127 + // console.log(MEGA_TheaterLocationCode);
128 + // MEGA_flag++;
129 + // console.log(MEGA_flag)
130 + // break;
131 + // }
132 + // }
133 + } else if (MEGA_flag == 101) {
134 +
135 + // 0< input || input > MEGA_count+1 : 다시 검색
136 + let tempNum = parseInt(message.text);
137 +
138 + if (tempNum > 0 && tempNum < MEGA_count + 1) {
139 + //번호에 맞는 LocationCode 전달
140 + MEGA_TheaterLocation = MEGA_AbleLocationList[tempNum - 1].LocationName;
141 + MEGA_TheaterLocationCode = MEGA_AbleLocationList[tempNum - 1].LocationNum;
142 + console.log(MEGA_TheaterLocation, MEGA_TheaterLocationCode);
143 + MEGA_flag = 2;
144 + } else {
145 + //다시 장소 입력받기
146 + const text1 = "영화관 위치를 입력해주세요";
147 + const text2 = "ex1)강남";
148 + SendMessage(eventObj, text1, text2);
149 + MEGA_flag = 1;
150 + }
151 + }
152 + //날짜 입력 받기
153 + if (MEGA_flag == 2) {
154 + const text1 = "현재 영화관은 " + MEGA_TheaterLocation + " 입니다.\n영화를 보실 날짜를 입력해주세요.";
155 + const text2 = "ex)20020409";
156 + SendMessage(eventObj, text1, text2);
157 + MEGA_flag = 3;
158 + }
159 +
160 + //날짜 확인 및 날짜, 장소에 대해 상영중인 영화 리스트 가져오기
161 + if (moment(message.text, "YYYYMMDD", true).isValid() && MEGA_flag == 3) {
162 + MEGA_date = parseInt(message.text);
163 + //console.log(MEGA_date, MEGA_TheaterLocation);
164 + if (MEGA_date && MEGA_TheaterLocationCode) {
165 + const text1 = "현재상영작을 가져오는 중입니다.";
166 + const text2 = "잠시만 기다려주세요.";
167 + PushMessage(text1, text2);
168 + MEGA_PlayingMovieURL = "https://megabox.co.kr/on/oh/ohb/SimpleBooking/simpleBookingPage.do" + '?brchNo1=' + MEGA_TheaterLocationCode + '&playDe=' + MEGA_date;
169 + megabox.using_PlayingMovieURL(MEGA_PlayingMovieURL);
170 + await megabox.geting_PlayingMovie();
171 + console.log(MEGA_PlayingMovieURL, megabox.movie_data);
172 + MEGA_flag = 4;
173 + }
174 +
175 + //원본 코드
176 + // MEGA_date = parseInt(eventObj.message.text);
177 +
178 + // if (MEGA_date && MEGA_TheaterLocationCode) {
179 + // MEGA_PlayingMovieURL = "https://megabox.co.kr/on/oh/ohb/SimpleBooking/simpleBookingPage.do" + '?brchNo1=' + MEGA_TheaterLocationCode + '&playDe=' + MEGA_date;
180 + // console.log(MEGA_PlayingMovieURL)
181 + // async.waterfall[
182 + // megabox.using_PlayingMovieURL(MEGA_PlayingMovieURL),
183 + // megabox.geting_PlayingMovie()
184 + // ]
185 + // MEGA_flag++
186 + // console.log(MEGA_flag);
187 + // }
188 + }
189 +
190 + if (MEGA_flag == 4) {
191 + let obj = {};
192 + let n;
193 + let PlayingMovie = "-현재 상영작-\n\n";
194 + let movietitle;
195 + console.log(megabox.movie_data);
196 + for (n = 0; n < Object.keys(megabox.movie_data).length; n++) {
197 + if (megabox.movie_data[n].running == 'Y') {
198 + console.log(megabox.movie_data[n]);
199 + movietitle = megabox.movie_data[n].title;
200 + MEGA_PlayingMovieList[movietitle] = megabox.movie_data[n].movie_num;
201 + }
202 + }
203 + console.log(Object.keys(megabox.movie_data).length);
204 + if (Object.keys(megabox.movie_data).length == 0) {
205 + PushMessage("현재상영작이 없습니다.","영화관 선택 단계로 이동합니다.");
206 + setTimeout(function () {
207 + PushMessage("영화관 위치를 입력해주세요", "ex1)강남");
208 + }, 1000);
209 + MEGA_flag = 1;
210 + }else if (Object.keys(MEGA_PlayingMovieList).length == 1) {
211 + PlayingMovie += '1. ' + Object.keys(MEGA_PlayingMovieList)[0];
212 + PushMessage(PlayingMovie, "바로 링크가 보내집니다.");
213 + MEGA_title = MEGA_PlayingMovieList[Object.keys(MEGA_PlayingMovieList)[0]];
214 + setTimeout(function () {
215 + const final_URL = "https://www.megabox.co.kr/booking?rpstMovieNo=" + MEGA_title + "&brchNo1=" + MEGA_TheaterLocationCode + '&playDe=' + MEGA_date;
216 + console.log(final_URL)
217 + PushMessage(final_URL, "링크를 누르면 예매창으로 바로 이동합니다.");
218 + }, 1000);
219 +
220 + setTimeout(function () {
221 + initFlag = false;
222 + MEGA_flag = -1;
223 + PushSingleMessage("원하시는 브랜드의 번호를 입력해주세요.\n1: CGV\n2: LotteCinema\n3: Megabox\n언제든 브랜드를 바꾸고 싶으시다면 '브랜드'를 입력해주세요.");
224 + }, 1000);
225 + } else {
226 + let index = 0;
227 + for (let playingmovie = 0; playingmovie < Object.keys(MEGA_PlayingMovieList).length; playingmovie++) {
228 + PlayingMovie += (playingmovie + 1).toString() + '. ' + Object.keys(MEGA_PlayingMovieList)[index++];
229 + PlayingMovie += "\n";
230 + }
231 + console.log(PlayingMovie);
232 + await PushMessage(PlayingMovie, "예매할 영화 번호를 입력해주세요.\n ex)1 (영화 앞 숫자만 입력)");
233 + MEGA_flag = 5;
234 + }
235 + }else if (MEGA_flag == 5) {
236 + const index = parseInt(message.text) - 1;
237 + MEGA_title = MEGA_PlayingMovieList[Object.keys(MEGA_PlayingMovieList)[index]];
238 + const final_URL = "https://www.megabox.co.kr/booking?rpstMovieNo=" + MEGA_title + "&brchNo1=" + MEGA_TheaterLocationCode + '&playDe=' + MEGA_date;
239 + console.log(final_URL);
240 + PushMessage(final_URL, "예매창으로 바로 이동합니다.");
241 + setTimeout(function () {
242 + initFlag = false;
243 + MEGA_flag = -1;
244 + PushSingleMessage("원하시는 브랜드의 번호를 입력해주세요.\n1: CGV\n2: LotteCinema\n3: Megabox\n언제든 브랜드를 바꾸고 싶으시다면 '브랜드'를 입력해주세요.");
245 + }, 1000);
246 + }
247 + }
248 +
249 + res.sendStatus(200);
250 +}))
251 +//});
252 +
253 +try {
254 + const option = {
255 + ca: fs.readFileSync('/etc/letsencrypt/live/' + domain + '/fullchain.pem'),
256 + key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain + '/privkey.pem'), 'utf8').toString(),
257 + cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain + '/cert.pem'), 'utf8').toString(),
258 + };
259 +
260 + HTTPS.createServer(option, app).listen(sslport, () => {
261 + console.log(`[HTTPS] Server is started on port ${sslport}`);
262 + });
263 +} catch (error) {
264 + console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.');
265 + console.log(error);
266 +}
267 +
268 +
269 +//메세지 전송하는 function 모음
270 +function SendMessage(eventObj, text1, text2 = "") { //reply message
271 + request.post(
272 + {
273 + url: REPLY_TARGET_URL,
274 + headers: {
275 + 'Authorization': `Bearer ${TOKEN}`
276 + },
277 + json: {
278 + "replyToken": eventObj.replyToken,
279 + "messages": [
280 + {
281 + "type": "text",
282 + "text": text1
283 + },
284 + {
285 + "type": "text",
286 + "text": text2
287 + }
288 + ]
289 + }
290 +
291 + }, (error, response, body) => {
292 + console.log(body);
293 + });
294 +}
295 +
296 +function PushMessage(text1, text2 = "") { //push two message
297 + request.post(
298 + {
299 + url: PUSH_TARGET_URL,
300 + headers: {
301 + 'Authorization': `Bearer ${TOKEN}`
302 + },
303 + json: {
304 + "to": `${USER_ID}`,
305 + "messages": [
306 + {
307 + "type": "text",
308 + "text": text1
309 + },
310 + {
311 + "type": "text",
312 + "text": text2
313 + }
314 + ]
315 + }
316 + }, (error, response, body) => {
317 + console.log(body)
318 + });
319 +}
320 +
321 +function PushSingleMessage(text1) {//push single message
322 + request.post(
323 + {
324 + url: PUSH_TARGET_URL,
325 + headers: {
326 + 'Authorization': `Bearer ${TOKEN}`
327 + },
328 + json: {
329 + "to": `${USER_ID}`,
330 + "messages": [
331 + {
332 + "type": "text",
333 + "text": text1
334 + }
335 + ]
336 + }
337 + }, (error, response, body) => {
338 + console.log(body)
339 + });
340 +}
341 +
342 +function PusbuttonhMessage(final_URL) {
343 + request.post(
344 + {
345 + url: PUSH_TARGET_URL,
346 + headers: {
347 + 'Authorization': `Bearer ${TOKEN}`
348 + },
349 + json:
350 +
351 + {
352 + "to": `${USER_ID}`,
353 + "type": "template",
354 + "altText": "this is a carousel template",
355 + "template": {
356 + "type": "carousel",
357 + "columns": [
358 + {
359 + "thumbnailImageUrl": "https://megabox.co.kr/SharedImg/2022/05/16/WApIttC9CrStYU7j7jzFRlc2HsIXBQtY_150.jpg",
360 + "imageBackgroundColor": "#FFFFFF",
361 + "title": "this is menu",
362 + "text": "description",
363 + "defaultAction": {
364 + "type": "uri",
365 + "label": "View detail",
366 + "uri": "https://megabox.co.kr/"
367 + },
368 + "actions": [
369 + {
370 + "type": "message",
371 + "label": "Yes",
372 + "text": "Yes"
373 + },
374 + {
375 + "type": "message",
376 + "label": "Yes",
377 + "text": "Yes"
378 + },
379 + {
380 + "type": "uri",
381 + "label": "View detail",
382 + "uri": "https://megabox.co.kr/"
383 + }
384 + ]
385 + },
386 +
387 + {
388 + "thumbnailImageUrl": "https://example.com/bot/images/item2.jpg",
389 + "imageBackgroundColor": "#000000",
390 + "title": "this is menu",
391 + "text": "description",
392 + "defaultAction": {
393 + "type": "uri",
394 + "label": "View detail",
395 + "uri": "http://example.com/page/222"
396 + },
397 + "actions": [
398 + {
399 + "type": "message",
400 + "label": "Yes",
401 + "text": "Yes"
402 +
403 + },
404 + {
405 + "type": "message",
406 + "label": "Yes",
407 + "text": "Yes"
408 +
409 + },
410 + {
411 + "type": "uri",
412 + "label": "View detail",
413 + "uri": "https://megabox.co.kr/"
414 + }
415 + ]
416 + }
417 + ],
418 + "imageAspectRatio": "rectangle",
419 + "imageSize": "cover"
420 + }
421 + }
422 + // {
423 + // "type": "template",
424 + // //"altText": "This is a buttons template",
425 + // "template": {
426 + // "type": "buttons",
427 + // "thumbnailImageUrl": "https://megabox.co.kr/SharedImg/2022/05/16/WApIttC9CrStYU7j7jzFRlc2HsIXBQtY_150.jpg",
428 + // "imageAspectRatio": "rectangle",
429 + // "imageSize": "cover",
430 + // "imageBackgroundColor": "#FFFFFF",
431 + // "title": "Menu",
432 + // "text": "Please select",
433 + // "actions": [
434 + // {
435 + // "type": "message",
436 + // "label": "Yes",
437 + // "text": "yes"
438 + // },
439 + // {
440 + // "type": "uri",
441 + // "label": "View detail",
442 + // "uri": final_URL
443 + // }
444 + // ]
445 + // }
446 + //}
447 + }
448 + )
449 +}
1 +{
2 + "name": "megabox",
3 + "version": "1.0.0",
4 + "description": "",
5 + "main": "app.js",
6 + "scripts": {
7 + "test": "echo \"Error: no test specified\" && exit 1"
8 + },
9 + "keywords": [],
10 + "author": "",
11 + "license": "ISC",
12 + "dependencies": {
13 + "async": "^3.2.3",
14 + "body-parser": "^1.20.0",
15 + "cheerio": "^1.0.0-rc.11",
16 + "chromedriver": "^101.0.0",
17 + "express": "^4.18.1",
18 + "puppeteer": "^14.1.1",
19 + "express-async-handler": "^1.2.0",
20 + "selenium-webdriver": "^4.1.2"
21 + }
22 +}
...\ No newline at end of file ...\ No newline at end of file