alwaysaqioo 1.1.3 → 1.1.5
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 +110 -9
- package/WAProto/index.js +56886 -17506
- package/engine-requirements.js +10 -0
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.js +19 -2
- package/lib/Socket/chats.d.ts +215 -32
- package/lib/Socket/chats.js +155 -75
- package/lib/Socket/groups.js +18 -18
- package/lib/Socket/index.js +1 -0
- package/lib/Socket/luxu.d.ts +268 -0
- package/lib/Socket/luxu.js +591 -0
- package/lib/Socket/messages-send.d.ts +2 -2
- package/lib/Socket/messages-send.js +327 -348
- package/lib/Socket/newsletter.js +111 -21
- package/lib/Socket/socket.js +65 -30
- package/lib/Types/Newsletter.d.ts +97 -86
- package/lib/Types/Newsletter.js +38 -32
- package/lib/Utils/generics.js +65 -33
- package/lib/Utils/messages-media.js +145 -57
- package/lib/Utils/messages.js +26 -14
- package/lib/Utils/signal.js +48 -46
- package/lib/Utils/use-multi-file-auth-state.js +45 -6
- package/lib/Utils/validate-connection.js +89 -65
- package/lib/WABinary/constants.d.ts +27 -24
- package/lib/WABinary/encode.js +160 -123
- package/lib/WABinary/generic-utils.d.ts +2 -1
- package/lib/WABinary/generic-utils.js +123 -43
- package/lib/index.d.ts +1 -0
- package/lib/index.js +11 -4
- package/package.json +100 -98
- package/WAProto/GenerateStatics.sh +0 -4
- package/WAProto/WAProto.proto +0 -3344
- package/WAProto/index.d.ts +0 -37016
- package/WASignalGroup/GroupProtocol.js +0 -1697
- package/WASignalGroup/ciphertext_message.js +0 -16
- package/WASignalGroup/group_cipher.js +0 -120
- package/WASignalGroup/group_session_builder.js +0 -46
- package/WASignalGroup/index.js +0 -5
- package/WASignalGroup/keyhelper.js +0 -21
- package/WASignalGroup/protobufs.js +0 -3
- package/WASignalGroup/queue_job.js +0 -69
- package/WASignalGroup/sender_chain_key.js +0 -50
- package/WASignalGroup/sender_key_distribution_message.js +0 -78
- package/WASignalGroup/sender_key_message.js +0 -92
- package/WASignalGroup/sender_key_name.js +0 -70
- package/WASignalGroup/sender_key_record.js +0 -56
- package/WASignalGroup/sender_key_state.js +0 -129
- package/WASignalGroup/sender_message_key.js +0 -39
- package/lib/Signal/Group/x +0 -1
- package/lib/WAUSync/index.d.ts +0 -3
package/lib/Socket/groups.js
CHANGED
|
@@ -263,46 +263,46 @@ const makeGroupsSocket = (config) => {
|
|
|
263
263
|
exports.makeGroupsSocket = makeGroupsSocket;
|
|
264
264
|
const extractGroupMetadata = (result) => {
|
|
265
265
|
var _a, _b;
|
|
266
|
-
const group =
|
|
267
|
-
const descChild =
|
|
266
|
+
const group = WABinary_1.getBinaryNodeChild(result, 'group');
|
|
267
|
+
const descChild = WABinary_1.getBinaryNodeChild(group, 'description');
|
|
268
268
|
let desc;
|
|
269
269
|
let descId;
|
|
270
270
|
let descOwner;
|
|
271
271
|
let descOwnerLid;
|
|
272
272
|
let descTime;
|
|
273
273
|
if (descChild) {
|
|
274
|
-
desc =
|
|
275
|
-
descOwner =
|
|
274
|
+
desc = WABinary_1.getBinaryNodeChildString(descChild, 'body');
|
|
275
|
+
descOwner = WABinary_1.jidNormalizedUser(descChild.attrs.participant_pn || descChild.attrs.participant);
|
|
276
276
|
if (group.attrs.addressing_mode === 'lid') {
|
|
277
|
-
descOwnerLid =
|
|
277
|
+
descOwnerLid = WABinary_1.jidNormalizedUser(descChild.attrs.participant);
|
|
278
278
|
}
|
|
279
279
|
descId = descChild.attrs.id;
|
|
280
280
|
descTime = descChild.attrs.t ? +descChild.attrs.t : undefined;
|
|
281
281
|
}
|
|
282
282
|
const groupSize = group.attrs.size ? Number(group.attrs.size) : undefined;
|
|
283
283
|
const groupId = group.attrs.id.includes('@') ? group.attrs.id : (0, WABinary_1.jidEncode)(group.attrs.id, 'g.us');
|
|
284
|
-
const eph =
|
|
285
|
-
const memberAddMode =
|
|
284
|
+
const eph = WABinary_1.getBinaryNodeChild(group, 'ephemeral')?.attrs.expiration
|
|
285
|
+
const memberAddMode = WABinary_1.getBinaryNodeChildString(group, 'member_add_mode') === 'all_member_add';
|
|
286
286
|
const metadata = {
|
|
287
287
|
id: groupId,
|
|
288
288
|
addressingMode: group.attrs.addressing_mode,
|
|
289
289
|
subject: group.attrs.subject,
|
|
290
|
-
subjectOwner:
|
|
291
|
-
...(group.attrs.addressing_mode === 'lid' ? { subjectOwnerLid:
|
|
290
|
+
subjectOwner: WABinary_1.jidNormalizedUser(group.attrs.s_o_pn || group.attrs.s_o),
|
|
291
|
+
...(group.attrs.addressing_mode === 'lid' ? { subjectOwnerLid: WABinary_1.jidNormalizedUser(group.attrs.s_o) } : {}),
|
|
292
292
|
subjectTime: group.attrs.s_t ? +group.attrs.s_t : undefined,
|
|
293
|
-
size: groupSize ||
|
|
293
|
+
size: groupSize || WABinary_1.getBinaryNodeChildren(group, 'participant').length,
|
|
294
294
|
creation: group.attrs.creation ? +group.attrs.creation : undefined,
|
|
295
|
-
owner:
|
|
296
|
-
...(group.attrs.addressing_mode === 'lid' ? { ownerLid:
|
|
295
|
+
owner: WABinary_1.jidNormalizedUser(group.attrs.creator_pn || group.attrs.creator),
|
|
296
|
+
...(group.attrs.addressing_mode === 'lid' ? { ownerLid: WABinary_1.jidNormalizedUser(group.attrs.creator) } : {}),
|
|
297
297
|
descOwner,
|
|
298
298
|
descOwnerLid,
|
|
299
|
-
restrict: !!
|
|
300
|
-
announce: !!
|
|
301
|
-
isCommunity: !!
|
|
302
|
-
isCommunityAnnounce: !!
|
|
303
|
-
joinApprovalMode: !!
|
|
299
|
+
restrict: !!WABinary_1.getBinaryNodeChild(group, 'locked'),
|
|
300
|
+
announce: !!WABinary_1.getBinaryNodeChild(group, 'announcement'),
|
|
301
|
+
isCommunity: !!WABinary_1.getBinaryNodeChild(group, 'parent'),
|
|
302
|
+
isCommunityAnnounce: !!WABinary_1.getBinaryNodeChild(group, 'default_sub_group'),
|
|
303
|
+
joinApprovalMode: !!WABinary_1.getBinaryNodeChild(group, 'membership_approval_mode'),
|
|
304
304
|
memberAddMode,
|
|
305
|
-
participants:
|
|
305
|
+
participants: WABinary_1.getBinaryNodeChildren(group, 'participant').map(({ attrs }) => {
|
|
306
306
|
return {
|
|
307
307
|
id: attrs.jid,
|
|
308
308
|
jid: attrs.phone_number || attrs.jid,
|
package/lib/Socket/index.js
CHANGED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { proto } from '../../WAProto';
|
|
2
|
+
|
|
3
|
+
declare namespace imup {
|
|
4
|
+
interface MediaUploadOptions {
|
|
5
|
+
fileEncSha256?: Buffer;
|
|
6
|
+
mediaType?: string;
|
|
7
|
+
newsletter?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type WAMediaUploadFunction = (
|
|
11
|
+
stream: Buffer | NodeJS.ReadableStream,
|
|
12
|
+
options?: MediaUploadOptions
|
|
13
|
+
) => Promise<{ url: string; directPath: string }>;
|
|
14
|
+
|
|
15
|
+
interface WAMessageContentGenerationOptions {
|
|
16
|
+
upload?: WAMediaUploadFunction;
|
|
17
|
+
mediaCache?: any;
|
|
18
|
+
options?: any;
|
|
19
|
+
logger?: any;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface StickerMessage {
|
|
23
|
+
url: string;
|
|
24
|
+
fileSha256: Buffer | string;
|
|
25
|
+
fileEncSha256: Buffer | string;
|
|
26
|
+
mediaKey: Buffer | string;
|
|
27
|
+
mimetype: string;
|
|
28
|
+
directPath: string;
|
|
29
|
+
fileLength: number | string;
|
|
30
|
+
mediaKeyTimestamp: number | string;
|
|
31
|
+
isAnimated?: boolean;
|
|
32
|
+
stickerSentTs?: number | string;
|
|
33
|
+
isAvatar?: boolean;
|
|
34
|
+
isAiSticker?: boolean;
|
|
35
|
+
isLottie?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface PaymentMessage {
|
|
39
|
+
amount: number;
|
|
40
|
+
currency?: string;
|
|
41
|
+
from?: string;
|
|
42
|
+
expiry?: number;
|
|
43
|
+
sticker?: { stickerMessage: StickerMessage };
|
|
44
|
+
note?: string;
|
|
45
|
+
background?: {
|
|
46
|
+
id?: string;
|
|
47
|
+
fileLength?: string;
|
|
48
|
+
width?: number;
|
|
49
|
+
height?: number;
|
|
50
|
+
mimetype?: string;
|
|
51
|
+
placeholderArgb?: number;
|
|
52
|
+
textArgb?: number;
|
|
53
|
+
subtextArgb?: number;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface ProductMessage {
|
|
58
|
+
title: string;
|
|
59
|
+
description: string;
|
|
60
|
+
thumbnail: Buffer | { url: string };
|
|
61
|
+
productId: string;
|
|
62
|
+
retailerId: string;
|
|
63
|
+
url: string;
|
|
64
|
+
body?: string;
|
|
65
|
+
footer?: string;
|
|
66
|
+
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
67
|
+
priceAmount1000?: number | null;
|
|
68
|
+
currencyCode?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface InteractiveMessage {
|
|
72
|
+
title: string;
|
|
73
|
+
footer?: string;
|
|
74
|
+
thumbnail?: string;
|
|
75
|
+
image?: string | Buffer | { url: string };
|
|
76
|
+
video?: string | Buffer | { url: string };
|
|
77
|
+
document?: Buffer;
|
|
78
|
+
mimetype?: string;
|
|
79
|
+
fileName?: string;
|
|
80
|
+
jpegThumbnail?: Buffer;
|
|
81
|
+
contextInfo?: {
|
|
82
|
+
mentionedJid?: string[];
|
|
83
|
+
forwardingScore?: number;
|
|
84
|
+
isForwarded?: boolean;
|
|
85
|
+
forwardedNewsletterMessageInfo?: proto.Message.ContextInfo.ForwardedNewsletterMessageInfo;
|
|
86
|
+
externalAdReply?: {
|
|
87
|
+
title?: string;
|
|
88
|
+
body?: string;
|
|
89
|
+
mediaType?: number;
|
|
90
|
+
thumbnailUrl?: string;
|
|
91
|
+
mediaUrl?: string;
|
|
92
|
+
sourceUrl?: string;
|
|
93
|
+
showAdAttribution?: boolean;
|
|
94
|
+
renderLargerThumbnail?: boolean;
|
|
95
|
+
[key: string]: any;
|
|
96
|
+
};
|
|
97
|
+
[key: string]: any;
|
|
98
|
+
};
|
|
99
|
+
externalAdReply?: {
|
|
100
|
+
title?: string;
|
|
101
|
+
body?: string;
|
|
102
|
+
mediaType?: number;
|
|
103
|
+
thumbnailUrl?: string;
|
|
104
|
+
mediaUrl?: string;
|
|
105
|
+
sourceUrl?: string;
|
|
106
|
+
showAdAttribution?: boolean;
|
|
107
|
+
renderLargerThumbnail?: boolean;
|
|
108
|
+
[key: string]: any;
|
|
109
|
+
};
|
|
110
|
+
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
111
|
+
nativeFlowMessage?: {
|
|
112
|
+
messageParamsJson?: string;
|
|
113
|
+
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
114
|
+
[key: string]: any;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface AlbumItem {
|
|
119
|
+
image?: { url: string; caption?: string };
|
|
120
|
+
video?: { url: string; caption?: string };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
interface EventMessageLocation {
|
|
124
|
+
degreesLatitude: number;
|
|
125
|
+
degreesLongitude: number;
|
|
126
|
+
name: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
interface EventMessage {
|
|
130
|
+
isCanceled?: boolean;
|
|
131
|
+
name: string;
|
|
132
|
+
description: string;
|
|
133
|
+
location?: EventMessageLocation;
|
|
134
|
+
joinLink?: string;
|
|
135
|
+
startTime?: string | number;
|
|
136
|
+
endTime?: string | number;
|
|
137
|
+
extraGuestsAllowed?: boolean;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
interface PollVote {
|
|
141
|
+
optionName: string;
|
|
142
|
+
optionVoteCount: string | number;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface PollResultMessage {
|
|
146
|
+
name: string;
|
|
147
|
+
pollVotes: PollVote[];
|
|
148
|
+
newsletter?: {
|
|
149
|
+
newsletterName: string;
|
|
150
|
+
newsletterJid: string;
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
interface StatusMentionMessage {
|
|
155
|
+
image?: { url: string } | string;
|
|
156
|
+
video?: { url: string } | string;
|
|
157
|
+
mentions: string[];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
interface OrderMessage {
|
|
161
|
+
thumbnail?: Buffer | string,
|
|
162
|
+
itemCount?: string | number,
|
|
163
|
+
message: string,
|
|
164
|
+
orderTitle: string,
|
|
165
|
+
totalAmount1000?: string | number,
|
|
166
|
+
totalCurrencyCode?: string
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
interface GroupStatus {
|
|
170
|
+
message?: any;
|
|
171
|
+
image?: string | Buffer | { url: string };
|
|
172
|
+
video?: string | Buffer | { url: string };
|
|
173
|
+
text?: string;
|
|
174
|
+
caption?: string;
|
|
175
|
+
document?: string | Buffer | { url: string };
|
|
176
|
+
[key: string]: any;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
interface MessageContent {
|
|
180
|
+
requestPaymentMessage?: PaymentMessage;
|
|
181
|
+
productMessage?: ProductMessage;
|
|
182
|
+
interactiveMessage?: InteractiveMessage;
|
|
183
|
+
albumMessage?: AlbumItem[];
|
|
184
|
+
eventMessage?: EventMessage;
|
|
185
|
+
pollResultMessage?: PollResultMessage;
|
|
186
|
+
statusMentionMessage?: StatusMentionMessage;
|
|
187
|
+
orderMessage?: OrderMessage;
|
|
188
|
+
sender?: string;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
interface MessageOptions {
|
|
192
|
+
quoted?: proto.IWebMessageInfo;
|
|
193
|
+
filter?: boolean;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
interface Utils {
|
|
197
|
+
prepareWAMessageMedia: (media: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
|
198
|
+
generateWAMessageContent: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
|
199
|
+
generateWAMessageFromContent: (jid: string, content: any, options?: any) => Promise<any>;
|
|
200
|
+
generateWAMessage: (jid: string, content: any, options?: any) => Promise<any>;
|
|
201
|
+
generateMessageID: () => string;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
declare class imup {
|
|
206
|
+
constructor(
|
|
207
|
+
utils: imup.Utils,
|
|
208
|
+
waUploadToServer: imup.WAMediaUploadFunction,
|
|
209
|
+
relayMessageFn?: (jid: string, content: any, options?: any) => Promise<any>
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
detectType(content: imup.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'STATUS_MENTION' | 'ORDER' | null;
|
|
213
|
+
|
|
214
|
+
handlePayment(
|
|
215
|
+
content: { requestPaymentMessage: imup.PaymentMessage },
|
|
216
|
+
quoted?: proto.IWebMessageInfo
|
|
217
|
+
): Promise<{ requestPaymentMessage: proto.Message.RequestPaymentMessage }>;
|
|
218
|
+
|
|
219
|
+
handleProduct(
|
|
220
|
+
content: { productMessage: imup.ProductMessage },
|
|
221
|
+
jid: string,
|
|
222
|
+
quoted?: proto.IWebMessageInfo
|
|
223
|
+
): Promise<{ viewOnceMessage: proto.Message.ViewOnceMessage }>;
|
|
224
|
+
|
|
225
|
+
handleInteractive(
|
|
226
|
+
content: { interactiveMessage: imup.InteractiveMessage },
|
|
227
|
+
jid: string,
|
|
228
|
+
quoted?: proto.IWebMessageInfo
|
|
229
|
+
): Promise<{ interactiveMessage: proto.Message.InteractiveMessage }>;
|
|
230
|
+
|
|
231
|
+
handleAlbum(
|
|
232
|
+
content: { albumMessage: imup.AlbumItem[] },
|
|
233
|
+
jid: string,
|
|
234
|
+
quoted?: proto.IWebMessageInfo
|
|
235
|
+
): Promise<any>;
|
|
236
|
+
|
|
237
|
+
handleEvent(
|
|
238
|
+
content: { eventMessage: imup.EventMessage },
|
|
239
|
+
jid: string,
|
|
240
|
+
quoted?: proto.IWebMessageInfo
|
|
241
|
+
): Promise<any>;
|
|
242
|
+
|
|
243
|
+
handlePollResult(
|
|
244
|
+
content: { pollResultMessage: imup.PollResultMessage },
|
|
245
|
+
jid: string,
|
|
246
|
+
quoted?: proto.IWebMessageInfo
|
|
247
|
+
): Promise<any>;
|
|
248
|
+
|
|
249
|
+
handleStMention(
|
|
250
|
+
content: { statusMentionMessage: imup.StatusMentionMessage },
|
|
251
|
+
jid: string,
|
|
252
|
+
quoted?: proto.IWebMessageInfo
|
|
253
|
+
): Promise<any>;
|
|
254
|
+
|
|
255
|
+
handleOrderMessage(
|
|
256
|
+
content: { orderMessage: imup.OrderMessage },
|
|
257
|
+
jid: string,
|
|
258
|
+
quoted?: proto.IWebMessageInfo
|
|
259
|
+
): Promise<any>;
|
|
260
|
+
|
|
261
|
+
handleGroupStory(
|
|
262
|
+
content: { orderMessage: imup.GroupStatus },
|
|
263
|
+
jid: string,
|
|
264
|
+
quoted?: proto.IWebMessageInfo
|
|
265
|
+
): Promise<any>;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export = imup;
|