Showing
1 changed file
with
3 additions
and
28 deletions
... | @@ -75,7 +75,7 @@ try { | ... | @@ -75,7 +75,7 @@ try { |
75 | console.log(error); | 75 | console.log(error); |
76 | } | 76 | } |
77 | 77 | ||
78 | -function Reply(eventObj){ | 78 | +function Reply(eventObj,replyMsg){ |
79 | request.post( | 79 | request.post( |
80 | { | 80 | { |
81 | url: TARGET_URL, | 81 | url: TARGET_URL, |
... | @@ -91,7 +91,7 @@ function Reply(eventObj){ | ... | @@ -91,7 +91,7 @@ function Reply(eventObj){ |
91 | }, | 91 | }, |
92 | { | 92 | { |
93 | "type":"text", | 93 | "type":"text", |
94 | - "text":"May I help you?" | 94 | + "text":replyMsg |
95 | } | 95 | } |
96 | ] | 96 | ] |
97 | } | 97 | } |
... | @@ -115,31 +115,6 @@ function GetPlayerInfo(playerID, season, eventObj){ | ... | @@ -115,31 +115,6 @@ function GetPlayerInfo(playerID, season, eventObj){ |
115 | request(options, function (error, response) { | 115 | request(options, function (error, response) { |
116 | if (error) throw new Error(error); | 116 | if (error) throw new Error(error); |
117 | console.log(response.body); | 117 | console.log(response.body); |
118 | - Reply(eventObj); | 118 | + Reply(eventObj,response.body); |
119 | }); | 119 | }); |
120 | } | 120 | } |
... | \ No newline at end of file | ... | \ No newline at end of file |
121 | - | ||
122 | -function Emitter(){ | ||
123 | - this.events = {}; | ||
124 | -} | ||
125 | - | ||
126 | -Emitter.prototype.on = function(type, listener){ | ||
127 | - this.events[type] = this.events[type] || []; | ||
128 | - this.events[type].push(listener); | ||
129 | -} | ||
130 | - | ||
131 | -const emitter = new Emitter(); | ||
132 | - | ||
133 | -emitter.on('soccer', function(){ | ||
134 | - console.log('soccer logged.'); | ||
135 | -}) | ||
136 | - | ||
137 | -Emitter.prototype.emit = function(type){ | ||
138 | - if(this.events[type]){ | ||
139 | - this.events[type].forEach(function(listener){ | ||
140 | - listener(); | ||
141 | - }); | ||
142 | - } | ||
143 | -} | ||
144 | - | ||
145 | -emitter.emit('soccer'); | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment