node-ainzfb-new 1.6.30-test → 1.6.2210-test

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/index.js +1 -1
  2. package/package.json +3 -3
  3. package/src/addExternalModule.js +6 -13
  4. package/src/addUserToGroup.js +12 -35
  5. package/src/changeAdminStatus.js +16 -32
  6. package/src/changeArchivedStatus.js +9 -15
  7. package/src/changeBio.js +8 -12
  8. package/src/changeBlockedStatus.js +8 -14
  9. package/src/changeGroupImage.js +13 -27
  10. package/src/changeNickname.js +10 -19
  11. package/src/changeThreadColor.js +10 -15
  12. package/src/changeThreadEmoji.js +9 -17
  13. package/src/createNewGroup.js +10 -18
  14. package/src/createPoll.js +11 -16
  15. package/src/deleteMessage.js +10 -16
  16. package/src/deleteThread.js +10 -16
  17. package/src/forwardAttachment.js +9 -14
  18. package/src/getCurrentUserID.js +1 -1
  19. package/src/getEmojiUrl.js +2 -3
  20. package/src/getFriendsList.js +10 -18
  21. package/src/getMessage.js +48 -52
  22. package/src/getThreadHistory.js +59 -156
  23. package/src/getThreadHistoryDeprecated.js +15 -26
  24. package/src/getThreadInfoDeprecated.js +13 -25
  25. package/src/getThreadList.js +53 -112
  26. package/src/getThreadListDeprecated.js +12 -30
  27. package/src/getThreadPictures.js +13 -25
  28. package/src/getUserID.js +7 -8
  29. package/src/getUserInfo.js +9 -12
  30. package/src/handleFriendRequest.js +9 -10
  31. package/src/handleMessageRequest.js +10 -16
  32. package/src/httpGet.js +13 -18
  33. package/src/httpPost.js +13 -18
  34. package/src/httpPostFormData.js +9 -14
  35. package/src/listenMqtt.js +571 -1218
  36. package/src/logout.js +13 -18
  37. package/src/markAsDelivered.js +10 -16
  38. package/src/markAsRead.js +24 -36
  39. package/src/markAsReadAll.js +10 -14
  40. package/src/markAsSeen.js +11 -18
  41. package/src/muteThread.js +8 -12
  42. package/src/removeUserFromGroup.js +10 -33
  43. package/src/resolvePhotoUrl.js +6 -8
  44. package/src/searchForThread.js +8 -13
  45. package/src/sendMessage.js +78 -172
  46. package/src/sendTypingIndicator.js +14 -29
  47. package/src/setMessageReaction.js +8 -13
  48. package/src/setPostReaction.js +95 -97
  49. package/src/setTitle.js +12 -18
  50. package/src/threadColors.js +17 -17
  51. package/src/unfriend.js +9 -14
  52. package/src/unsendMessage.js +7 -7
  53. package/utils.js +10 -9
  54. package/src/changeAvt.js +0 -91
package/src/changeAvt.js DELETED
@@ -1,91 +0,0 @@
1
- "use strict";
2
-
3
- var utils = require("../utils");
4
- var log = require("npmlog");
5
- /**
6
- * It posts an image to a Facebook profile
7
- * @param Api - The API object
8
- * @param BotID - The ID of the bot you want to post the image to.
9
- * @param form - The form data that you want to send.
10
- * @returns The JSON.parse(Data.split("for (;;);")[1]); is returning the following:
11
- * {"__ar":1,"payload":null,"jsmods":{"require":[["ImageUploader","uploadPhoto",[{"__m":"__elem_0"},{"__m":"__elem_1"},{"__m":"__elem_2"},{"__m":"__
12
- */
13
- async function postImage(Api, BotID, form) {
14
- var Data = await Api.httpPostFormData(
15
- `https://www.facebook.com/profile/picture/upload/?profile_id=${BotID}&photo_source=57&av=${BotID}`,
16
- form
17
- );
18
- return JSON.parse(Data.split("for (;;);")[1]);
19
- }
20
-
21
- module.exports = function (defaultFuncs, api, ctx) {
22
- /* Changing the profile picture of the bot. */
23
- return function changeAvt(link, caption, callback) {
24
- var resolveFunc = function () { };
25
- var rejectFunc = function () { };
26
- var returnPromise = new Promise(function (resolve, reject) {
27
- resolveFunc = resolve;
28
- rejectFunc = reject;
29
- });
30
-
31
- if (!callback) {
32
- callback = function (err, data) {
33
- if (err) return rejectFunc(err);
34
- resolveFunc(data);
35
- };
36
- }
37
- try {
38
- var Fetch = require("axios");
39
- Fetch.get(link, { responseType: "stream" }).then(data => {
40
- postImage(api, ctx.userID, { file: data.data }).then(data => {
41
- if (data.error)
42
- throw new Error({
43
- error: data.error,
44
- des: data.error.errorDescription
45
- });
46
- var form = {
47
- av: ctx.userID,
48
- fb_api_req_friendly_name: "ProfileCometProfilePictureSetMutation",
49
- fb_api_caller_class: "RelayModern",
50
- doc_id: "5066134240065849",
51
- variables: JSON.stringify({
52
- input: {
53
- caption: caption || "",
54
- existing_photo_id: data.payload.fbid,
55
- expiration_time: null,
56
- profile_id: ctx.userID,
57
- profile_pic_method: "EXISTING",
58
- profile_pic_source: "TIMELINE",
59
- scaled_crop_rect: {
60
- height: 1,
61
- width: 1,
62
- x: 0,
63
- y: 0
64
- },
65
- skip_cropping: true,
66
- actor_id: ctx.userID,
67
- client_mutation_id: Math.round(Math.random() * 19).toString()
68
- },
69
- isPage: false,
70
- isProfile: true,
71
- scale: 3
72
- })
73
- };
74
- defaultFuncs
75
- .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
76
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
77
- .then(function (resData) {
78
- if (resData.error) throw resData;
79
- else return callback(null, true);
80
- })
81
- .catch(function (err) {
82
- return callback(err);
83
- });
84
- });
85
- });
86
- } catch (e) {
87
- throw e;
88
- }
89
- return returnPromise;
90
- };
91
- };