alicezetion 1.9.4 → 1.9.6
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/.cache/typescript/5.3/node_modules/.package-lock.json +3 -3
- package/.cache/typescript/5.3/node_modules/@types/react/README.md +1 -1
- package/.cache/typescript/5.3/node_modules/@types/react/global.d.ts +1 -0
- package/.cache/typescript/5.3/node_modules/@types/react/index.d.ts +64 -1
- package/.cache/typescript/5.3/node_modules/@types/react/package.json +2 -2
- package/.cache/typescript/5.3/node_modules/@types/react/ts5.0/global.d.ts +1 -0
- package/.cache/typescript/5.3/node_modules/@types/react/ts5.0/index.d.ts +64 -1
- package/.cache/typescript/5.3/package-lock.json +4 -4
- package/.cache/typescript/5.3/package.json +1 -1
- package/package.json +1 -1
- package/src/listenMqtt.js +826 -825
- package/src/react.js +87 -75
package/src/react.js
CHANGED
@@ -1,25 +1,10 @@
|
|
1
|
-
/**
|
2
|
-
* @fix by NTKhang
|
3
|
-
* update as Thursday, 10 February 2022
|
4
|
-
* do not remove the author name to get more updates
|
5
|
-
*/
|
6
|
-
|
7
1
|
"use strict";
|
8
2
|
|
9
3
|
const utils = require("../utils");
|
10
4
|
const log = require("npmlog");
|
11
5
|
|
12
|
-
function formatData(resData) {
|
13
|
-
return {
|
14
|
-
viewer_feedback_reaction_info: resData.feedback_react.feedback.viewer_feedback_reaction_info,
|
15
|
-
supported_reactions: resData.feedback_react.feedback.supported_reactions,
|
16
|
-
top_reactions: resData.feedback_react.feedback.top_reactions.edges,
|
17
|
-
reaction_count: resData.feedback_react.feedback.reaction_count
|
18
|
-
};
|
19
|
-
}
|
20
|
-
|
21
6
|
module.exports = function (defaultFuncs, api, ctx) {
|
22
|
-
return function
|
7
|
+
return function setMessageReaction(reaction, messageID, callback, forceCustomReaction) {
|
23
8
|
let resolveFunc = function () { };
|
24
9
|
let rejectFunc = function () { };
|
25
10
|
const returnPromise = new Promise(function (resolve, reject) {
|
@@ -28,82 +13,109 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
28
13
|
});
|
29
14
|
|
30
15
|
if (!callback) {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
if (err) {
|
38
|
-
return rejectFunc(err);
|
39
|
-
}
|
40
|
-
resolveFunc(data);
|
41
|
-
};
|
42
|
-
}
|
16
|
+
callback = function (err, friendList) {
|
17
|
+
if (err) {
|
18
|
+
return rejectFunc(err);
|
19
|
+
}
|
20
|
+
resolveFunc(friendList);
|
21
|
+
};
|
43
22
|
}
|
44
23
|
|
45
|
-
|
46
|
-
|
47
|
-
like: 1,
|
48
|
-
heart: 2,
|
49
|
-
love: 16,
|
50
|
-
haha: 4,
|
51
|
-
wow: 3,
|
52
|
-
sad: 7,
|
53
|
-
angry: 8
|
54
|
-
};
|
55
|
-
|
56
|
-
if (utils.getType(type) !== "Number" && utils.getType(type) === "String") {
|
57
|
-
type = map[type.toLowerCase()];
|
24
|
+
if (ctx.i_userID) {
|
25
|
+
throw { error: "Cannot set reaction as another profile." };
|
58
26
|
}
|
59
27
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
28
|
+
switch (reaction) {
|
29
|
+
case "\uD83D\uDE0D": //:heart_eyes:
|
30
|
+
case "\uD83D\uDE06": //:laughing:
|
31
|
+
case "\uD83D\uDE2E": //:open_mouth:
|
32
|
+
case "\uD83D\uDE22": //:cry:
|
33
|
+
case "\uD83D\uDE20": //:angry:
|
34
|
+
case "\uD83D\uDC4D": //:thumbsup:
|
35
|
+
case "\uD83D\uDC4E": //:thumbsdown:
|
36
|
+
case "\u2764": //:heart:
|
37
|
+
case "\uD83D\uDC97": //:glowingheart:
|
38
|
+
case "":
|
39
|
+
//valid
|
40
|
+
break;
|
41
|
+
case ":heart_eyes:":
|
42
|
+
case ":love:":
|
43
|
+
reaction = "\uD83D\uDE0D";
|
44
|
+
break;
|
45
|
+
case ":laughing:":
|
46
|
+
case ":haha:":
|
47
|
+
reaction = "\uD83D\uDE06";
|
48
|
+
break;
|
49
|
+
case ":open_mouth:":
|
50
|
+
case ":wow:":
|
51
|
+
reaction = "\uD83D\uDE2E";
|
52
|
+
break;
|
53
|
+
case ":cry:":
|
54
|
+
case ":sad:":
|
55
|
+
reaction = "\uD83D\uDE22";
|
56
|
+
break;
|
57
|
+
case ":angry:":
|
58
|
+
reaction = "\uD83D\uDE20";
|
59
|
+
break;
|
60
|
+
case ":thumbsup:":
|
61
|
+
case ":like:":
|
62
|
+
reaction = "\uD83D\uDC4D";
|
63
|
+
break;
|
64
|
+
case ":thumbsdown:":
|
65
|
+
case ":dislike:":
|
66
|
+
reaction = "\uD83D\uDC4E";
|
67
|
+
break;
|
68
|
+
case ":heart:":
|
69
|
+
reaction = "\u2764";
|
70
|
+
break;
|
71
|
+
case ":glowingheart:":
|
72
|
+
reaction = "\uD83D\uDC97";
|
73
|
+
break;
|
74
|
+
default:
|
75
|
+
if (forceCustomReaction) {
|
76
|
+
break;
|
77
|
+
}
|
78
|
+
return callback({ error: "Reaction is not a valid emoji." });
|
64
79
|
}
|
65
80
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
81
|
+
const variables = {
|
82
|
+
data: {
|
83
|
+
client_mutation_id: ctx.clientMutationId++,
|
84
|
+
actor_id: ctx.i_userID || ctx.userID,
|
85
|
+
action: reaction == "" ? "REMOVE_REACTION" : "ADD_REACTION",
|
86
|
+
message_id: messageID,
|
87
|
+
reaction: reaction
|
88
|
+
}
|
89
|
+
};
|
71
90
|
|
72
|
-
const
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
doc_id: "4769042373179384",
|
77
|
-
variables: JSON.stringify({
|
78
|
-
input: {
|
79
|
-
actor_id: ctx.i_userID || ctx.userID,
|
80
|
-
feedback_id: (new Buffer("feedback:" + postID)).toString("base64"),
|
81
|
-
feedback_reaction: type,
|
82
|
-
feedback_source: "OBJECT",
|
83
|
-
is_tracking_encrypted: true,
|
84
|
-
tracking: [],
|
85
|
-
session_id: "f7dd50dd-db6e-4598-8cd9-561d5002b423",
|
86
|
-
client_mutation_id: Math.round(Math.random() * 19).toString()
|
87
|
-
},
|
88
|
-
useDefaultActor: false,
|
89
|
-
scale: 3
|
90
|
-
})
|
91
|
+
const qs = {
|
92
|
+
doc_id: "1491398900900362",
|
93
|
+
variables: JSON.stringify(variables),
|
94
|
+
dpr: 1
|
91
95
|
};
|
92
96
|
|
93
97
|
defaultFuncs
|
94
|
-
.
|
95
|
-
|
98
|
+
.postFormData(
|
99
|
+
"https://www.facebook.com/webgraphql/mutation/",
|
100
|
+
ctx.jar,
|
101
|
+
{},
|
102
|
+
qs
|
103
|
+
)
|
104
|
+
.then(utils.parseAndCheckLogin(ctx.jar, defaultFuncs))
|
96
105
|
.then(function (resData) {
|
97
|
-
if (resData
|
106
|
+
if (!resData) {
|
107
|
+
throw { error: "setReaction returned empty object." };
|
108
|
+
}
|
109
|
+
if (resData.error || resData.errors) {
|
98
110
|
throw resData;
|
99
111
|
}
|
100
|
-
|
112
|
+
callback(null);
|
101
113
|
})
|
102
114
|
.catch(function (err) {
|
103
|
-
log.error("
|
115
|
+
log.error("setReaction", err);
|
104
116
|
return callback(err);
|
105
117
|
});
|
106
118
|
|
107
119
|
return returnPromise;
|
108
120
|
};
|
109
|
-
};
|
121
|
+
};
|