stfca 1.0.18 → 1.0.19

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stfca",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "Unofficial Facebook Chat API for Node.js with Auto-Update System - Enhanced by ST | Sheikh Tamim",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -0,0 +1,133 @@
1
+ /**
2
+ * ===========================================================
3
+ * 💫 META THEME GENERATOR MODULE 💫
4
+ * ===========================================================
5
+ * 🧑‍💻 Author: Sheikh Tamim (ST | Sheikh Tamim)
6
+ * 🔰 Owner & Developer
7
+ * 🌐 GitHub: https://github.com/sheikhtamimlover
8
+ * 📸 Instagram: https://instagram.com/sheikh.tamim_lover
9
+ * 🧠 Description:
10
+ * This module generates beautiful Messenger AI themes
11
+ * using Meta's hidden GraphQL endpoints. It allows you to
12
+ * create unique chat themes based on your custom prompt
13
+ * or optional image inspiration.
14
+ * -----------------------------------------------------------
15
+ * ⚙️ Features:
16
+ * • Generate AI-based Messenger chat themes.
17
+ * • Custom prompt & optional image URL input.
18
+ * • Returns structured theme data with full color mapping.
19
+ * -----------------------------------------------------------
20
+ * 🕊️ Respect the creator & give proper credits if reused.
21
+ * ===========================================================
22
+ */
23
+
24
+ "use strict";
25
+
26
+ var utils = require("../utils");
27
+ var log = require("npmlog");
28
+
29
+ module.exports = function (defaultFuncs, api, ctx) {
30
+ /** Developed by Sheikh Tamim | GitHub: sheikhtamimlover | Instagram: @sheikh.tamim_lover */
31
+ return function suggestFriend(count, cursor, callback) {
32
+ var resolveFunc = function () { };
33
+ var rejectFunc = function () { };
34
+ var returnPromise = new Promise(function (resolve, reject) {
35
+ resolveFunc = resolve;
36
+ rejectFunc = reject;
37
+ });
38
+
39
+ if (!callback) {
40
+ callback = function (err, data) {
41
+ if (err) return rejectFunc(err);
42
+ resolveFunc(data);
43
+ };
44
+ }
45
+
46
+ if (typeof count === 'function') {
47
+ callback = count;
48
+ count = 30;
49
+ cursor = null;
50
+ }
51
+
52
+ if (typeof cursor === 'function') {
53
+ callback = cursor;
54
+ cursor = null;
55
+ }
56
+
57
+ count = count || 30;
58
+
59
+ var form = {
60
+ av: ctx.userID,
61
+ __aaid: 0,
62
+ __user: ctx.userID,
63
+ __a: 1,
64
+ __req: utils.getSignatureID(),
65
+ __hs: "20405.HYP:comet_pkg.2.1...0",
66
+ dpr: 1,
67
+ __ccg: "EXCELLENT",
68
+ __rev: "1029835515",
69
+ __s: utils.getSignatureID(),
70
+ __hsi: Date.now(),
71
+ __comet_req: 15,
72
+ fb_dtsg: ctx.fb_dtsg,
73
+ jazoest: ctx.ttstamp,
74
+ lsd: ctx.fb_dtsg,
75
+ __spin_r: "1029835515",
76
+ __spin_b: "trunk",
77
+ __spin_t: Date.now(),
78
+ __crn: "comet.fbweb.CometPYMKSuggestionsRoute",
79
+ fb_api_caller_class: "RelayModern",
80
+ fb_api_req_friendly_name: "FriendingCometPYMKPanelPaginationQuery",
81
+ server_timestamps: true,
82
+ variables: JSON.stringify({
83
+ count: count,
84
+ cursor: cursor,
85
+ location: "FRIENDS_HOME_MAIN",
86
+ scale: 3
87
+ }),
88
+ doc_id: "9917809191634193"
89
+ };
90
+
91
+ defaultFuncs
92
+ .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
93
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
94
+ .then(function (resData) {
95
+ if (resData.error) {
96
+ throw resData;
97
+ }
98
+
99
+ if (resData.data && resData.data.viewer && resData.data.viewer.people_you_may_know) {
100
+ var pymkData = resData.data.viewer.people_you_may_know;
101
+ var suggestions = pymkData.edges.map(function (edge) {
102
+ var node = edge.node;
103
+ return {
104
+ id: node.id,
105
+ name: node.name,
106
+ url: node.url,
107
+ friendshipStatus: node.friendship_status,
108
+ profilePicture: node.profile_picture ? node.profile_picture.uri : null,
109
+ mutualFriends: node.social_context ? node.social_context.text : "",
110
+ topMutualFriends: node.social_context_top_mutual_friends || []
111
+ };
112
+ });
113
+
114
+ var result = {
115
+ suggestions: suggestions,
116
+ hasNextPage: pymkData.page_info.has_next_page,
117
+ endCursor: pymkData.page_info.end_cursor
118
+ };
119
+
120
+ return callback(null, result);
121
+ } else {
122
+ return callback({ error: "Invalid response format" });
123
+ }
124
+ })
125
+ .catch(function (err) {
126
+ log.error("suggestFriend", err);
127
+ return callback(err);
128
+ });
129
+
130
+ return returnPromise;
131
+ };
132
+ };
133
+ /** Developed by Sheikh Tamim | GitHub: sheikhtamimlover | Please give credits if reused. */