alicezetion 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. package/.cache/replit/__replit_disk_meta.json +1 -1
  2. package/alice/addExternalModule.js +19 -0
  3. package/alice/{add.js → addUserToGroup.js} +16 -2
  4. package/alice/{admin.js → changeAdminStatus.js} +17 -3
  5. package/alice/{archive.js → changeArchivedStatus.js} +16 -2
  6. package/alice/changeBio.js +77 -0
  7. package/alice/changeBlockedStatus.js +47 -0
  8. package/alice/{gcimage.js → changeGroupImage.js} +16 -2
  9. package/alice/{nickname.js → changeNickname.js} +17 -2
  10. package/alice/changeThreadColor.js +71 -0
  11. package/alice/{emoji.js → changeThreadEmoji.js} +16 -2
  12. package/alice/createNewGroup.js +86 -0
  13. package/alice/{poll.js → createPoll.js} +18 -2
  14. package/alice/{deletemsg.js → deleteMessage.js} +15 -2
  15. package/alice/{deletegc.js → deleteThread.js} +15 -2
  16. package/alice/{forward.js → forwardAttachment.js} +16 -3
  17. package/alice/{id.js → getCurrentUserID.js} +1 -1
  18. package/alice/{friend.js → getFriendsList.js} +17 -3
  19. package/alice/{history.js → getThreadHistory.js} +19 -6
  20. package/alice/{gchistorydeprecated.js → getThreadHistoryDeprecated.js} +18 -1
  21. package/alice/{gcinfo.js → getThreadInfo.js} +49 -13
  22. package/alice/{gcinfodeprecated.js → getThreadInfoDeprecated.js} +17 -2
  23. package/alice/{gclist.js → getThreadList.js} +27 -9
  24. package/alice/{gclistdeprecated.js → getThreadListDeprecated.js} +1 -1
  25. package/alice/{gcimg.js → getThreadPictures.js} +15 -2
  26. package/alice/{userid.js → getUserID.js} +16 -2
  27. package/alice/{userinfo.js → getUserInfo.js} +17 -2
  28. package/alice/handleFriendRequest.js +61 -0
  29. package/alice/{msgrequest.js → handleMessageRequest.js} +16 -2
  30. package/alice/httpGet.js +52 -0
  31. package/alice/httpPost.js +52 -0
  32. package/alice/listenMqtt.js +363 -134
  33. package/alice/logout.js +18 -2
  34. package/alice/{delivered.js → markAsDelivered.js} +19 -2
  35. package/alice/markAsRead.js +80 -0
  36. package/alice/{seen.js → markAsReadAll.js} +16 -2
  37. package/alice/markAsSeen.js +59 -0
  38. package/alice/{mute.js → muteThread.js} +16 -2
  39. package/alice/{kick.js → removeUserFromGroup.js} +16 -2
  40. package/alice/{resolveimgurl.js → resolvePhotoUrl.js} +16 -2
  41. package/alice/{gcsearch.js → searchForThread.js} +16 -2
  42. package/alice/{chat.js → sendMessage.js} +78 -34
  43. package/alice/sendTypingIndicator.js +103 -0
  44. package/alice/{react.js → setMessageReaction.js} +39 -4
  45. package/alice/setPostReaction.js +76 -0
  46. package/alice/{title.js → setTitle.js} +16 -3
  47. package/alice/threadColors.js +57 -0
  48. package/alice/unfriend.js +52 -0
  49. package/alice/{unsend.js → unsendMessage.js} +16 -2
  50. package/index.js +324 -143
  51. package/package.json +19 -10
  52. package/utils.js +137 -61
  53. package/README.md +0 -40
  54. package/alice/block.js +0 -72
  55. package/alice/color.js +0 -53
  56. package/alice/gcolor.js +0 -22
  57. package/alice/listen.js +0 -553
  58. package/alice/read.js +0 -52
  59. package/alice/typeindicator.js +0 -77
  60. /package/alice/{emojiurl.js → getEmojiUrl.js} +0 -0
package/alice/logout.js CHANGED
@@ -3,9 +3,23 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function(defaultFuncs, bot, ctx) {
6
+ module.exports = function(defaultFuncs, api, ctx) {
7
7
  return function logout(callback) {
8
- callback = callback || function() {};
8
+ var resolveFunc = function(){};
9
+ var rejectFunc = function(){};
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
+
15
+ if (!callback) {
16
+ callback = function (err, friendList) {
17
+ if (err) {
18
+ return rejectFunc(err);
19
+ }
20
+ resolveFunc(friendList);
21
+ };
22
+ }
9
23
 
10
24
  var form = {
11
25
  pmid: "0"
@@ -55,5 +69,7 @@ module.exports = function(defaultFuncs, bot, ctx) {
55
69
  log.error("logout", err);
56
70
  return callback(err);
57
71
  });
72
+
73
+ return returnPromise;
58
74
  };
59
75
  };
@@ -3,10 +3,22 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function (defaultFuncs, bot, ctx) {
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function markAsDelivered(threadID, messageID, callback) {
8
+ var resolveFunc = function(){};
9
+ var rejectFunc = function(){};
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
+
8
15
  if (!callback) {
9
- callback = function () { };
16
+ callback = function (err, friendList) {
17
+ if (err) {
18
+ return rejectFunc(err);
19
+ }
20
+ resolveFunc(friendList);
21
+ };
10
22
  }
11
23
 
12
24
  if (!threadID || !messageID) {
@@ -35,7 +47,12 @@ module.exports = function (defaultFuncs, bot, ctx) {
35
47
  })
36
48
  .catch(function (err) {
37
49
  log.error("markAsDelivered", err);
50
+ if (utils.getType(err) == "Object" && err.error === "Not logged in.") {
51
+ ctx.loggedIn = false;
52
+ }
38
53
  return callback(err);
39
54
  });
55
+
56
+ return returnPromise;
40
57
  };
41
58
  };
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return async function markAsRead(threadID, read, callback) {
8
+ if (utils.getType(read) === 'Function' || utils.getType(read) === 'AsyncFunction') {
9
+ callback = read;
10
+ read = true;
11
+ }
12
+ if (read == undefined) {
13
+ read = true;
14
+ }
15
+
16
+ if (!callback) {
17
+ callback = () => { };
18
+ }
19
+
20
+ var form = {};
21
+
22
+ if (typeof ctx.globalOptions.pageID !== 'undefined') {
23
+ form["source"] = "PagesManagerMessagesInterface";
24
+ form["request_user_id"] = ctx.globalOptions.pageID;
25
+ form["ids[" + threadID + "]"] = read;
26
+ form["watermarkTimestamp"] = new Date().getTime();
27
+ form["shouldSendReadReceipt"] = true;
28
+ form["commerce_last_message_type"] = "";
29
+ //form["titanOriginatedThreadId"] = utils.generateThreadingID(ctx.clientID);
30
+
31
+ let resData;
32
+ try {
33
+ resData = await (
34
+ defaultFuncs
35
+ .post(
36
+ "https://www.facebook.com/ajax/mercury/change_read_status.php",
37
+ ctx.jar,
38
+ form
39
+ )
40
+ .then(utils.saveCookies(ctx.jar))
41
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
42
+ );
43
+ } catch (e) {
44
+ callback(e);
45
+ return e;
46
+ }
47
+
48
+ if (resData.error) {
49
+ let err = resData.error;
50
+ log.error("markAsRead", err);
51
+ if (utils.getType(err) == "Object" && err.error === "Not logged in.") {
52
+ ctx.loggedIn = false;
53
+ }
54
+ callback(err);
55
+ return err;
56
+ }
57
+
58
+ callback();
59
+ return null;
60
+ } else {
61
+ try {
62
+ if (ctx.mqttClient) {
63
+ let err = await new Promise(r => ctx.mqttClient.publish("/mark_thread", JSON.stringify({
64
+ threadID,
65
+ mark: "read",
66
+ state: read
67
+ }), { qos: 1, retain: false }, r));
68
+ if (err) throw err;
69
+ } else {
70
+ throw {
71
+ error: "You can only use this function after you start listening."
72
+ };
73
+ }
74
+ } catch (e) {
75
+ callback(e);
76
+ return e;
77
+ }
78
+ }
79
+ };
80
+ };
@@ -3,10 +3,22 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function(defaultFuncs, bot, ctx) {
6
+ module.exports = function(defaultFuncs, api, ctx) {
7
7
  return function markAsReadAll(callback) {
8
+ var resolveFunc = function(){};
9
+ var rejectFunc = function(){};
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
+
8
15
  if (!callback) {
9
- callback = function() {};
16
+ callback = function (err, friendList) {
17
+ if (err) {
18
+ return rejectFunc(err);
19
+ }
20
+ resolveFunc(friendList);
21
+ };
10
22
  }
11
23
 
12
24
  var form = {
@@ -32,5 +44,7 @@ module.exports = function(defaultFuncs, bot, ctx) {
32
44
  log.error("markAsReadAll", err);
33
45
  return callback(err);
34
46
  });
47
+
48
+ return returnPromise;
35
49
  };
36
50
  };
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function markAsRead(seen_timestamp, callback) {
8
+ if (utils.getType(seen_timestamp) == "Function" ||
9
+ utils.getType(seen_timestamp) == "AsyncFunction") {
10
+ callback = seen_timestamp;
11
+ seen_timestamp = Date.now();
12
+ }
13
+
14
+ var resolveFunc = function () { };
15
+ var rejectFunc = function () { };
16
+ var returnPromise = new Promise(function (resolve, reject) {
17
+ resolveFunc = resolve;
18
+ rejectFunc = reject;
19
+ });
20
+
21
+ if (!callback) {
22
+ callback = function (err, friendList) {
23
+ if (err) {
24
+ return rejectFunc(err);
25
+ }
26
+ resolveFunc(friendList);
27
+ };
28
+ }
29
+
30
+ var form = {
31
+ seen_timestamp: seen_timestamp
32
+ };
33
+
34
+ defaultFuncs
35
+ .post(
36
+ "https://www.facebook.com/ajax/mercury/mark_seen.php",
37
+ ctx.jar,
38
+ form
39
+ )
40
+ .then(utils.saveCookies(ctx.jar))
41
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
42
+ .then(function (resData) {
43
+ if (resData.error) {
44
+ throw resData;
45
+ }
46
+
47
+ return callback();
48
+ })
49
+ .catch(function (err) {
50
+ log.error("markAsSeen", err);
51
+ if (utils.getType(err) == "Object" && err.error === "Not logged in.") {
52
+ ctx.loggedIn = false;
53
+ }
54
+ return callback(err);
55
+ });
56
+
57
+ return returnPromise;
58
+ };
59
+ };
@@ -3,11 +3,23 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function(defaultFuncs, bot, ctx) {
6
+ module.exports = function(defaultFuncs, api, ctx) {
7
7
  // muteSecond: -1=permanent mute, 0=unmute, 60=one minute, 3600=one hour, etc.
8
8
  return function muteThread(threadID, muteSeconds, callback) {
9
+ var resolveFunc = function(){};
10
+ var rejectFunc = function(){};
11
+ var returnPromise = new Promise(function (resolve, reject) {
12
+ resolveFunc = resolve;
13
+ rejectFunc = reject;
14
+ });
15
+
9
16
  if (!callback) {
10
- callback = function() {};
17
+ callback = function (err, friendList) {
18
+ if (err) {
19
+ return rejectFunc(err);
20
+ }
21
+ resolveFunc(friendList);
22
+ };
11
23
  }
12
24
 
13
25
  var form = {
@@ -34,5 +46,7 @@ module.exports = function(defaultFuncs, bot, ctx) {
34
46
  log.error("muteThread", err);
35
47
  return callback(err);
36
48
  });
49
+
50
+ return returnPromise;
37
51
  };
38
52
  };
@@ -3,7 +3,7 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function(defaultFuncs, bot, ctx) {
6
+ module.exports = function(defaultFuncs, api, ctx) {
7
7
  return function removeUserFromGroup(userID, threadID, callback) {
8
8
  if (
9
9
  !callback &&
@@ -35,8 +35,20 @@ module.exports = function(defaultFuncs, bot, ctx) {
35
35
  };
36
36
  }
37
37
 
38
+ var resolveFunc = function(){};
39
+ var rejectFunc = function(){};
40
+ var returnPromise = new Promise(function (resolve, reject) {
41
+ resolveFunc = resolve;
42
+ rejectFunc = reject;
43
+ });
44
+
38
45
  if (!callback) {
39
- callback = function() {};
46
+ callback = function (err, friendList) {
47
+ if (err) {
48
+ return rejectFunc(err);
49
+ }
50
+ resolveFunc(friendList);
51
+ };
40
52
  }
41
53
 
42
54
  var form = {
@@ -61,5 +73,7 @@ module.exports = function(defaultFuncs, bot, ctx) {
61
73
  log.error("removeUserFromGroup", err);
62
74
  return callback(err);
63
75
  });
76
+
77
+ return returnPromise;
64
78
  };
65
79
  };
@@ -3,10 +3,22 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function(defaultFuncs, bot, ctx) {
6
+ module.exports = function(defaultFuncs, api, ctx) {
7
7
  return function resolvePhotoUrl(photoID, callback) {
8
+ var resolveFunc = function(){};
9
+ var rejectFunc = function(){};
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
+
8
15
  if (!callback) {
9
- throw { error: "resolvePhotoUrl: need callback" };
16
+ callback = function (err, friendList) {
17
+ if (err) {
18
+ return rejectFunc(err);
19
+ }
20
+ resolveFunc(friendList);
21
+ };
10
22
  }
11
23
 
12
24
  defaultFuncs
@@ -27,5 +39,7 @@ module.exports = function(defaultFuncs, bot, ctx) {
27
39
  log.error("resolvePhotoUrl", err);
28
40
  return callback(err);
29
41
  });
42
+
43
+ return returnPromise;
30
44
  };
31
45
  };
@@ -2,10 +2,22 @@
2
2
 
3
3
  var utils = require("../utils");
4
4
 
5
- module.exports = function(defaultFuncs, bot, ctx) {
5
+ module.exports = function(defaultFuncs, api, ctx) {
6
6
  return function searchForThread(name, callback) {
7
+ var resolveFunc = function(){};
8
+ var rejectFunc = function(){};
9
+ var returnPromise = new Promise(function (resolve, reject) {
10
+ resolveFunc = resolve;
11
+ rejectFunc = reject;
12
+ });
13
+
7
14
  if (!callback) {
8
- throw { error: "searchForThread: need callback" };
15
+ callback = function (err, friendList) {
16
+ if (err) {
17
+ return rejectFunc(err);
18
+ }
19
+ resolveFunc(friendList);
20
+ };
9
21
  }
10
22
 
11
23
  var tmpForm = {
@@ -35,5 +47,7 @@ module.exports = function(defaultFuncs, bot, ctx) {
35
47
  resData.payload.mercury_payload.threads.map(utils.formatThread)
36
48
  );
37
49
  });
50
+
51
+ return returnPromise;
38
52
  };
39
53
  };
@@ -11,10 +11,11 @@ var allowedProperties = {
11
11
  emoji: true,
12
12
  emojiSize: true,
13
13
  body: true,
14
- mentions: true
14
+ mentions: true,
15
+ location: true,
15
16
  };
16
17
 
17
- module.exports = function(defaultFuncs, bot, ctx) {
18
+ module.exports = function (defaultFuncs, api, ctx) {
18
19
  function uploadAttachment(attachments, callback) {
19
20
  var uploads = [];
20
21
 
@@ -43,7 +44,7 @@ module.exports = function(defaultFuncs, bot, ctx) {
43
44
  {}
44
45
  )
45
46
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
46
- .then(function(resData) {
47
+ .then(function (resData) {
47
48
  if (resData.error) {
48
49
  throw resData;
49
50
  }
@@ -58,10 +59,10 @@ module.exports = function(defaultFuncs, bot, ctx) {
58
59
  // resolve all promises
59
60
  bluebird
60
61
  .all(uploads)
61
- .then(function(resData) {
62
+ .then(function (resData) {
62
63
  callback(null, resData);
63
64
  })
64
- .catch(function(err) {
65
+ .catch(function (err) {
65
66
  log.error("uploadAttachment", err);
66
67
  return callback(err);
67
68
  });
@@ -81,7 +82,7 @@ module.exports = function(defaultFuncs, bot, ctx) {
81
82
  form
82
83
  )
83
84
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
84
- .then(function(resData) {
85
+ .then(function (resData) {
85
86
  if (resData.error) {
86
87
  return callback(resData);
87
88
  }
@@ -92,7 +93,7 @@ module.exports = function(defaultFuncs, bot, ctx) {
92
93
 
93
94
  callback(null, resData.payload.share_data.share_params);
94
95
  })
95
- .catch(function(err) {
96
+ .catch(function (err) {
96
97
  log.error("getUrl", err);
97
98
  return callback(err);
98
99
  });
@@ -138,7 +139,7 @@ module.exports = function(defaultFuncs, bot, ctx) {
138
139
  defaultFuncs
139
140
  .post("https://www.facebook.com/messaging/send/", ctx.jar, form)
140
141
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
141
- .then(function(resData) {
142
+ .then(function (resData) {
142
143
  if (!resData) {
143
144
  return callback({ error: "Send message failed." });
144
145
  }
@@ -148,13 +149,13 @@ module.exports = function(defaultFuncs, bot, ctx) {
148
149
  log.warn(
149
150
  "sendMessage",
150
151
  "Got error 1545012. This might mean that you're not part of the conversation " +
151
- threadID
152
+ threadID
152
153
  );
153
154
  }
154
155
  return callback(resData);
155
156
  }
156
157
 
157
- var messageInfo = resData.payload.actions.reduce(function(p, v) {
158
+ var messageInfo = resData.payload.actions.reduce(function (p, v) {
158
159
  return (
159
160
  {
160
161
  threadID: v.thread_fbid,
@@ -166,33 +167,45 @@ module.exports = function(defaultFuncs, bot, ctx) {
166
167
 
167
168
  return callback(null, messageInfo);
168
169
  })
169
- .catch(function(err) {
170
+ .catch(function (err) {
170
171
  log.error("sendMessage", err);
172
+ if (utils.getType(err) == "Object" && err.error === "Not logged in.") {
173
+ ctx.loggedIn = false;
174
+ }
171
175
  return callback(err);
172
176
  });
173
177
  }
174
178
 
175
- function send(form, threadID, messageAndOTID, callback) {
179
+ function send(form, threadID, messageAndOTID, callback, isGroup) {
176
180
  // We're doing a query to this to check if the given id is the id of
177
181
  // a user or of a group chat. The form will be different depending
178
182
  // on that.
179
183
  if (utils.getType(threadID) === "Array") {
180
184
  sendContent(form, threadID, false, messageAndOTID, callback);
181
185
  } else {
182
- sendContent(
183
- form,
184
- threadID,
185
- threadID.length === 15,
186
- messageAndOTID,
187
- callback
188
- );
186
+ if (utils.getType(isGroup) != "Boolean") {
187
+ api.getUserInfo(threadID, function (err, res) {
188
+ if (err) {
189
+ return callback(err);
190
+ }
191
+ sendContent(
192
+ form,
193
+ threadID,
194
+ Object.keys(res).length > 0,
195
+ messageAndOTID,
196
+ callback
197
+ );
198
+ });
199
+ } else {
200
+ sendContent(form, threadID, !isGroup, messageAndOTID, callback);
201
+ }
189
202
  }
190
203
  }
191
204
 
192
205
  function handleUrl(msg, form, callback, cb) {
193
206
  if (msg.url) {
194
207
  form["shareable_attachment[share_type]"] = "100";
195
- getUrl(msg.url, function(err, params) {
208
+ getUrl(msg.url, function (err, params) {
196
209
  if (err) {
197
210
  return callback(err);
198
211
  }
@@ -205,6 +218,20 @@ module.exports = function(defaultFuncs, bot, ctx) {
205
218
  }
206
219
  }
207
220
 
221
+ function handleLocation(msg, form, callback, cb) {
222
+ if (msg.location) {
223
+ if (msg.location.latitude == null || msg.location.longitude == null) {
224
+ return callback({ error: "location property needs both latitude and longitude" });
225
+ }
226
+
227
+ form["location_attachment[coordinates][latitude]"] = msg.location.latitude;
228
+ form["location_attachment[coordinates][longitude]"] = msg.location.longitude;
229
+ form["location_attachment[is_current_location]"] = !!msg.location.current;
230
+ }
231
+
232
+ cb();
233
+ }
234
+
208
235
  function handleSticker(msg, form, callback, cb) {
209
236
  if (msg.sticker) {
210
237
  form["sticker_id"] = msg.sticker;
@@ -248,12 +275,12 @@ module.exports = function(defaultFuncs, bot, ctx) {
248
275
  msg.attachment = [msg.attachment];
249
276
  }
250
277
 
251
- uploadAttachment(msg.attachment, function(err, files) {
278
+ uploadAttachment(msg.attachment, function (err, files) {
252
279
  if (err) {
253
280
  return callback(err);
254
281
  }
255
282
 
256
- files.forEach(function(file) {
283
+ files.forEach(function (file) {
257
284
  var key = Object.keys(file);
258
285
  var type = key[0]; // image_id, file_id, etc
259
286
  form["" + type + "s"].push(file[type]); // push the id
@@ -298,24 +325,37 @@ module.exports = function(defaultFuncs, bot, ctx) {
298
325
  cb();
299
326
  }
300
327
 
301
- return function sendMessage(msg, threadID, callback, replyToMessage) {
328
+ return function sendMessage(msg, threadID, callback, replyToMessage, isGroup) {
329
+ typeof isGroup == "undefined" ? isGroup = null : "";
302
330
  if (
303
331
  !callback &&
304
332
  (utils.getType(threadID) === "Function" ||
305
333
  utils.getType(threadID) === "AsyncFunction")
306
334
  ) {
307
- return callback({ error: "Pass a threadID as a second argument." });
335
+ return threadID({ error: "Pass a threadID as a second argument." });
308
336
  }
309
337
  if (
310
338
  !replyToMessage &&
311
339
  utils.getType(callback) === "String"
312
340
  ) {
313
341
  replyToMessage = callback;
314
- callback = function() {};
342
+ callback = function () { };
315
343
  }
316
-
344
+
345
+ var resolveFunc = function(){};
346
+ var rejectFunc = function(){};
347
+ var returnPromise = new Promise(function (resolve, reject) {
348
+ resolveFunc = resolve;
349
+ rejectFunc = reject;
350
+ });
351
+
317
352
  if (!callback) {
318
- callback = function() {};
353
+ callback = function (err, friendList) {
354
+ if (err) {
355
+ return rejectFunc(err);
356
+ }
357
+ resolveFunc(friendList);
358
+ };
319
359
  }
320
360
 
321
361
  var msgType = utils.getType(msg);
@@ -342,7 +382,7 @@ module.exports = function(defaultFuncs, bot, ctx) {
342
382
  "."
343
383
  });
344
384
  }
345
-
385
+
346
386
  if (replyToMessage && messageIDType !== 'String') {
347
387
  return callback({
348
388
  error:
@@ -400,16 +440,20 @@ module.exports = function(defaultFuncs, bot, ctx) {
400
440
  replied_to_message_id: replyToMessage
401
441
  };
402
442
 
403
- handleSticker(msg, form, callback, () =>
404
- handleAttachment(msg, form, callback, () =>
405
- handleUrl(msg, form, callback, () =>
406
- handleEmoji(msg, form, callback, () =>
407
- handleMention(msg, form, callback, () =>
408
- send(form, threadID, messageAndOTID, callback)
443
+ handleLocation(msg, form, callback, () =>
444
+ handleSticker(msg, form, callback, () =>
445
+ handleAttachment(msg, form, callback, () =>
446
+ handleUrl(msg, form, callback, () =>
447
+ handleEmoji(msg, form, callback, () =>
448
+ handleMention(msg, form, callback, () =>
449
+ send(form, threadID, messageAndOTID, callback, isGroup)
450
+ )
409
451
  )
410
452
  )
411
453
  )
412
454
  )
413
455
  );
456
+
457
+ return returnPromise;
414
458
  };
415
459
  };