@tiledesk/tiledesk-tybot-connector 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -114,10 +114,10 @@ class DirReply {
|
|
|
114
114
|
message,
|
|
115
115
|
(err) => {
|
|
116
116
|
if (err) {
|
|
117
|
-
console.error("Error sending reply:", err
|
|
117
|
+
console.error("Error sending reply:", err);
|
|
118
118
|
}
|
|
119
119
|
// if (this.log) {console.log("Reply message sent.");}
|
|
120
|
-
console.log("Reply message sent.");
|
|
120
|
+
console.log("Reply message sent.", JSON.stringify(message));
|
|
121
121
|
callback();
|
|
122
122
|
});
|
|
123
123
|
}
|
|
@@ -137,14 +137,16 @@ class DirReply {
|
|
|
137
137
|
};
|
|
138
138
|
this.myrequest(
|
|
139
139
|
HTTPREQUEST,
|
|
140
|
-
function(err,
|
|
141
|
-
if (
|
|
140
|
+
function(err, resbody) {
|
|
141
|
+
if (err) {
|
|
142
142
|
if (callback) {
|
|
143
|
-
callback(
|
|
143
|
+
callback(err);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
else
|
|
147
|
-
callback
|
|
146
|
+
else {
|
|
147
|
+
if (callback) {
|
|
148
|
+
callback(null, resbody);
|
|
149
|
+
}
|
|
148
150
|
}
|
|
149
151
|
}, this.log
|
|
150
152
|
);
|
|
@@ -154,6 +156,7 @@ class DirReply {
|
|
|
154
156
|
// if (log) {
|
|
155
157
|
console.log("API URL:", options.url);
|
|
156
158
|
console.log("** Options:", JSON.stringify(options));
|
|
159
|
+
console.log("** Sending reply json:", JSON.stringify(options.json));
|
|
157
160
|
// }
|
|
158
161
|
axios(
|
|
159
162
|
{
|
|
@@ -168,27 +171,27 @@ class DirReply {
|
|
|
168
171
|
console.log("Reply: Response for url:", options.url);
|
|
169
172
|
console.log("Reply: Response headers:\n", JSON.stringify(res.headers));
|
|
170
173
|
console.log("Reply: Status:", res.status);
|
|
171
|
-
console.log("Reply: Data:", res.data);
|
|
174
|
+
console.log("Reply: Data:", JSON.stringify(res.data));
|
|
172
175
|
|
|
173
176
|
//console.log("******** Response for url:", res);
|
|
174
177
|
// }
|
|
175
178
|
if (res && res.status == 200 && res.data) {
|
|
176
|
-
console.
|
|
179
|
+
console.log("Status 200 OK");
|
|
177
180
|
if (callback) {
|
|
178
181
|
callback(null, res.data);
|
|
179
182
|
}
|
|
180
183
|
}
|
|
181
184
|
else {
|
|
185
|
+
console.error("Status ! 200");
|
|
182
186
|
if (callback) {
|
|
183
|
-
|
|
184
|
-
callback({ message: "Response status not 200" });
|
|
187
|
+
callback({ message: "Response status not 200" }, null);
|
|
185
188
|
}
|
|
186
189
|
}
|
|
187
190
|
})
|
|
188
191
|
.catch((error) => {
|
|
189
|
-
console.error("
|
|
192
|
+
console.error("Reply error:", error);
|
|
190
193
|
if (callback) {
|
|
191
|
-
callback(error, null
|
|
194
|
+
callback(error, null);
|
|
192
195
|
}
|
|
193
196
|
});
|
|
194
197
|
}
|