2019102152 김다빈

Modify trading_notice target

Showing 1 changed file with 3 additions and 4 deletions
...@@ -12,6 +12,7 @@ const HTTPS = require('https'); ...@@ -12,6 +12,7 @@ const HTTPS = require('https');
12 const domain = "2019102152.osschatbot.ga" 12 const domain = "2019102152.osschatbot.ga"
13 const sslport = 23023; 13 const sslport = 23023;
14 const TARGET_URL = 'https://api.line.me/v2/bot/message/reply' 14 const TARGET_URL = 'https://api.line.me/v2/bot/message/reply'
15 +const BROAD_TARGET_URL = 'https://api.line.me/v2/bot/message/broadcast'
15 const bodyParser = require('body-parser'); 16 const bodyParser = require('body-parser');
16 const crypto = require('crypto'); 17 const crypto = require('crypto');
17 const queryEncode = require('querystring').encode; 18 const queryEncode = require('querystring').encode;
...@@ -430,16 +431,14 @@ function trading_notice(side, price, funds, volume,yield_data=0,market="") { ...@@ -430,16 +431,14 @@ function trading_notice(side, price, funds, volume,yield_data=0,market="") {
430 messages.push({ "type": "text", "text": "매도 주문이 체결되었습니다." }); 431 messages.push({ "type": "text", "text": "매도 주문이 체결되었습니다." });
431 messages.push({ "type": "text", "text": `${market}\n체결 금액 : ${funds}원\n체결 수량 : ${volume}개\n체결 평균가 : ${price}원\n수익률 : ${yield_data}%` }); 432 messages.push({ "type": "text", "text": `${market}\n체결 금액 : ${funds}원\n체결 수량 : ${volume}개\n체결 평균가 : ${price}원\n수익률 : ${yield_data}%` });
432 } 433 }
433 -
434 - var TARGET_URL = 'https://api.line.me/v2/bot/message/push';
435 request.post( 434 request.post(
436 { 435 {
437 - url: TARGET_URL, 436 + url: BROAD_TARGET_URL,
438 headers: { 437 headers: {
439 'Authorization': `Bearer ${TOKEN}` 438 'Authorization': `Bearer ${TOKEN}`
440 }, 439 },
441 json: { 440 json: {
442 - "to": `${userid}`, 441 +
443 "messages": messages 442 "messages": messages
444 } 443 }
445 }, (error, response, body) => { 444 }, (error, response, body) => {
......