Showing
1 changed file
with
8 additions
and
7 deletions
... | @@ -41,7 +41,6 @@ app.post('/hook', function (req, res) { | ... | @@ -41,7 +41,6 @@ app.post('/hook', function (req, res) { |
41 | console.log('[request]', req.body); | 41 | console.log('[request]', req.body); |
42 | console.log('[request source] ', source); | 42 | console.log('[request source] ', source); |
43 | console.log('[request message]', message); | 43 | console.log('[request message]', message); |
44 | - | ||
45 | if(message.text === '김프'){ | 44 | if(message.text === '김프'){ |
46 | command = '김프'; | 45 | command = '김프'; |
47 | USER_ID = source.userId; | 46 | USER_ID = source.userId; |
... | @@ -51,12 +50,14 @@ app.post('/hook', function (req, res) { | ... | @@ -51,12 +50,14 @@ app.post('/hook', function (req, res) { |
51 | USER_ID = source.userId; | 50 | USER_ID = source.userId; |
52 | } | 51 | } |
53 | else if(message.text == '고래알람'){ | 52 | else if(message.text == '고래알람'){ |
54 | - PushTimeId = SetWhaleAlert() | 53 | + PushTimeId = SetWhaleAlert(source.userId) |
55 | USER_ID = source.userId; | 54 | USER_ID = source.userId; |
56 | } | 55 | } |
57 | else if(message.text == '도움말'){ | 56 | else if(message.text == '도움말'){ |
58 | - explain_message(); | 57 | + |
58 | + explain_message(source.userId); | ||
59 | USER_ID = source.userId; | 59 | USER_ID = source.userId; |
60 | + | ||
60 | } | 61 | } |
61 | else if(message.text == '고래알람해제'){ | 62 | else if(message.text == '고래알람해제'){ |
62 | clearTimeout(PushTimeId) | 63 | clearTimeout(PushTimeId) |
... | @@ -69,7 +70,7 @@ app.post('/hook', function (req, res) { | ... | @@ -69,7 +70,7 @@ app.post('/hook', function (req, res) { |
69 | 70 | ||
70 | res.sendStatus(200); | 71 | res.sendStatus(200); |
71 | }); | 72 | }); |
72 | -function explain_message(){ | 73 | +function explain_message(userId){ |
73 | request.post( | 74 | request.post( |
74 | { | 75 | { |
75 | url: TARGET_URL_PUSH, | 76 | url: TARGET_URL_PUSH, |
... | @@ -77,7 +78,7 @@ function explain_message(){ | ... | @@ -77,7 +78,7 @@ function explain_message(){ |
77 | 'Authorization': `Bearer ${TOKEN}` | 78 | 'Authorization': `Bearer ${TOKEN}` |
78 | }, | 79 | }, |
79 | json: { | 80 | json: { |
80 | - "to": `${USER_ID}`, | 81 | + "to": `${userId}`, |
81 | "messages":[ | 82 | "messages":[ |
82 | { | 83 | { |
83 | "type":"text", | 84 | "type":"text", |
... | @@ -368,7 +369,7 @@ function data_collector(data, limit){ | ... | @@ -368,7 +369,7 @@ function data_collector(data, limit){ |
368 | } | 369 | } |
369 | return ret; | 370 | return ret; |
370 | } | 371 | } |
371 | -function SetWhaleAlert(){ | 372 | +function SetWhaleAlert(userId){ |
372 | url2 = 'https://api.whale-alert.io/v1/transactions?api_key=' + api_key + '&cursor=' + cursor; | 373 | url2 = 'https://api.whale-alert.io/v1/transactions?api_key=' + api_key + '&cursor=' + cursor; |
373 | const options = {method: 'GET', headers: {Accept: 'application/json'}}; | 374 | const options = {method: 'GET', headers: {Accept: 'application/json'}}; |
374 | 375 | ||
... | @@ -421,7 +422,7 @@ function SetWhaleAlert(){ | ... | @@ -421,7 +422,7 @@ function SetWhaleAlert(){ |
421 | 'Authorization': `Bearer ${TOKEN}` | 422 | 'Authorization': `Bearer ${TOKEN}` |
422 | }, | 423 | }, |
423 | json: { | 424 | json: { |
424 | - "to": `${USER_ID}`, | 425 | + "to": `${userId}`, |
425 | "messages":[msg2user[i]] | 426 | "messages":[msg2user[i]] |
426 | } | 427 | } |
427 | },(error, response, body) => { | 428 | },(error, response, body) => { | ... | ... |
-
Please register or login to post a comment