Showing
2 changed files
with
34 additions
and
28 deletions
... | @@ -7,30 +7,36 @@ const TOKEN = 'XOyIf8jsoQKq3b1zqxE4wawAoFU2Hz433AO3w8/ye+i6+2KrXpyfFwY0Dk/xhHQLP | ... | @@ -7,30 +7,36 @@ const TOKEN = 'XOyIf8jsoQKq3b1zqxE4wawAoFU2Hz433AO3w8/ye+i6+2KrXpyfFwY0Dk/xhHQLP |
7 | const USER_ID = 'Uc4258407a7677769f74ba184ec036651' | 7 | const USER_ID = 'Uc4258407a7677769f74ba184ec036651' |
8 | 8 | ||
9 | //Single User | 9 | //Single User |
10 | -// request.post( | ||
11 | -// { | ||
12 | -// url: TARGET_URL, | ||
13 | -// headers: { | ||
14 | -// 'Authorization': `Bearer ${TOKEN}` | ||
15 | -// }, | ||
16 | -// json: { | ||
17 | -// "to": `${USER_ID}`, | ||
18 | -// "messages":[ | ||
19 | -// { | ||
20 | -// "type":"text", | ||
21 | -// "text":"Hello, user" | ||
22 | -// }, | ||
23 | -// { | ||
24 | -// "type":"text", | ||
25 | -// "text":"May I help you?" | ||
26 | -// } | ||
27 | -// ] | ||
28 | -// } | ||
29 | -// },(error, response, body) => { | ||
30 | -// console.log(body) | ||
31 | -// }); | ||
32 | 10 | ||
33 | 11 | ||
12 | +function SingleCast(sendMsg, destination){ | ||
13 | + | ||
14 | + USER_ID = destination; | ||
15 | + | ||
16 | + request.post( | ||
17 | + { | ||
18 | + url: TARGET_URL, | ||
19 | + headers: { | ||
20 | + 'Authorization': `Bearer ${TOKEN}` | ||
21 | + }, | ||
22 | + json: { | ||
23 | + "to": `${USER_ID}`, | ||
24 | + "messages":[ | ||
25 | + { | ||
26 | + "type":"text", | ||
27 | + "text":sendMsg | ||
28 | + }, | ||
29 | + { | ||
30 | + "type":"text", | ||
31 | + "text":"May I help you?" | ||
32 | + } | ||
33 | + ] | ||
34 | + } | ||
35 | + },(error, response, body) => { | ||
36 | + console.log(body) | ||
37 | + }); | ||
38 | +} | ||
39 | + | ||
34 | // Multicast User | 40 | // Multicast User |
35 | 41 | ||
36 | function Multicast(sendMsg){ | 42 | function Multicast(sendMsg){ |
... | @@ -78,6 +84,6 @@ function Broadcast(msg){ | ... | @@ -78,6 +84,6 @@ function Broadcast(msg){ |
78 | }); | 84 | }); |
79 | } | 85 | } |
80 | 86 | ||
81 | -exports.SendMessage = function(sendMessage){ | 87 | +exports.SendMessage = function(sendMessage, destination){ |
82 | - Broadcast(sendMessage); | 88 | + SingleCast(sendMessage, destination); |
83 | } | 89 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -24,7 +24,7 @@ var step = 0; | ... | @@ -24,7 +24,7 @@ var step = 0; |
24 | var currentLeagueID = 0; | 24 | var currentLeagueID = 0; |
25 | var currentTeamID = 0; | 25 | var currentTeamID = 0; |
26 | 26 | ||
27 | -push.SendMessage(DefaultSelectMessage()); | 27 | +//push.SendMessage(DefaultSelectMessage()); |
28 | 28 | ||
29 | data.SetData(); | 29 | data.SetData(); |
30 | 30 | ||
... | @@ -211,7 +211,7 @@ function SelectLeagueInfo(eventObj, inputNum){ | ... | @@ -211,7 +211,7 @@ function SelectLeagueInfo(eventObj, inputNum){ |
211 | }); | 211 | }); |
212 | break; | 212 | break; |
213 | case 4: // 처음으로 | 213 | case 4: // 처음으로 |
214 | - SetDefault(); | 214 | + SetDefault(eventObj.source.userId); |
215 | break; | 215 | break; |
216 | default: | 216 | default: |
217 | break; | 217 | break; |
... | @@ -219,9 +219,9 @@ function SelectLeagueInfo(eventObj, inputNum){ | ... | @@ -219,9 +219,9 @@ function SelectLeagueInfo(eventObj, inputNum){ |
219 | return returnMsg; | 219 | return returnMsg; |
220 | } | 220 | } |
221 | 221 | ||
222 | -function SetDefault(){ | 222 | +function SetDefault(userID){ |
223 | step = 0; | 223 | step = 0; |
224 | - push.SendMessage(DefaultSelectMessage()); | 224 | + push.SendMessage(DefaultSelectMessage(), userID); |
225 | } | 225 | } |
226 | 226 | ||
227 | function MakeReplyMessage(title, keys, values){ | 227 | function MakeReplyMessage(title, keys, values){ | ... | ... |
-
Please register or login to post a comment