@denzy-official/baileys 1.1.2 → 1.1.4
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/WAProto/index.js +77698 -117051
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.d.ts +6 -5
- package/lib/Defaults/index.js +118 -79
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -1
- package/lib/Signal/Group/ciphertext-message.js +0 -1
- package/lib/Signal/Group/group-session-builder.d.ts +0 -1
- package/lib/Signal/Group/group-session-builder.js +0 -1
- package/lib/Signal/Group/group_cipher.d.ts +0 -1
- package/lib/Signal/Group/group_cipher.js +0 -1
- package/lib/Signal/Group/index.d.ts +0 -1
- package/lib/Signal/Group/index.js +0 -1
- package/lib/Signal/Group/keyhelper.d.ts +0 -1
- package/lib/Signal/Group/keyhelper.js +0 -1
- package/lib/Signal/Group/queue-job.d.ts +0 -1
- package/lib/Signal/Group/queue-job.js +0 -1
- package/lib/Signal/Group/sender-chain-key.d.ts +0 -1
- package/lib/Signal/Group/sender-chain-key.js +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.js +0 -1
- package/lib/Signal/Group/sender-key-message.d.ts +0 -1
- package/lib/Signal/Group/sender-key-message.js +0 -1
- package/lib/Signal/Group/sender-key-name.d.ts +0 -1
- package/lib/Signal/Group/sender-key-name.js +0 -1
- package/lib/Signal/Group/sender-key-record.d.ts +0 -1
- package/lib/Signal/Group/sender-key-record.js +0 -1
- package/lib/Signal/Group/sender-key-state.d.ts +0 -1
- package/lib/Signal/Group/sender-key-state.js +0 -1
- package/lib/Signal/Group/sender-message-key.d.ts +0 -1
- package/lib/Signal/Group/sender-message-key.js +0 -1
- package/lib/Signal/libsignal.d.ts +0 -1
- package/lib/Signal/libsignal.js +0 -1
- package/lib/Store/index.d.ts +2 -2
- package/lib/Store/index.js +3 -2
- package/lib/Store/make-cache-manager-store.d.ts +13 -0
- package/lib/Store/make-cache-manager-store.js +83 -0
- package/lib/Store/make-in-memory-store.d.ts +24 -25
- package/lib/Store/make-in-memory-store.js +14 -27
- package/lib/Store/make-ordered-dictionary.d.ts +1 -2
- package/lib/Store/make-ordered-dictionary.js +2 -3
- package/lib/Store/object-repository.d.ts +0 -1
- package/lib/Store/object-repository.js +0 -1
- package/lib/Types/Auth.d.ts +7 -1
- package/lib/Types/Auth.js +0 -1
- package/lib/Types/Call.d.ts +1 -2
- package/lib/Types/Call.js +0 -1
- package/lib/Types/Chat.d.ts +7 -15
- package/lib/Types/Chat.js +0 -1
- package/lib/Types/Contact.d.ts +1 -6
- package/lib/Types/Contact.js +0 -1
- package/lib/Types/Events.d.ts +2 -45
- package/lib/Types/Events.js +0 -1
- package/lib/Types/GroupMetadata.d.ts +2 -12
- package/lib/Types/GroupMetadata.js +0 -1
- package/lib/Types/Label.d.ts +0 -1
- package/lib/Types/Label.js +1 -2
- package/lib/Types/LabelAssociation.d.ts +0 -1
- package/lib/Types/LabelAssociation.js +1 -2
- package/lib/Types/Message.d.ts +21 -149
- package/lib/Types/Message.js +2 -1
- package/lib/Types/Newsletter.d.ts +97 -74
- package/lib/Types/Newsletter.js +38 -19
- package/lib/Types/Socket.d.ts +9 -17
- package/lib/Types/index.d.ts +1 -9
- package/lib/Types/index.js +2 -3
- package/lib/WABinary/constants.d.ts +27 -25
- package/lib/WABinary/constants.js +13 -1277
- package/lib/WABinary/decode.d.ts +4 -4
- package/lib/WABinary/decode.js +13 -27
- package/lib/WABinary/encode.d.ts +2 -2
- package/lib/WABinary/encode.js +152 -138
- package/lib/WABinary/generic-utils.d.ts +4 -2
- package/lib/WABinary/generic-utils.js +125 -38
- package/lib/WABinary/index.d.ts +0 -1
- package/lib/WABinary/index.js +0 -1
- package/lib/WABinary/jid-utils.d.ts +5 -11
- package/lib/WABinary/jid-utils.js +5 -27
- package/lib/WABinary/types.d.ts +0 -1
- package/lib/WABinary/types.js +0 -1
- package/lib/WAM/BinaryInfo.d.ts +11 -3
- package/lib/WAM/BinaryInfo.js +0 -1
- package/lib/WAM/constants.d.ts +0 -1
- package/lib/WAM/constants.js +0 -1
- package/lib/WAM/encode.d.ts +2 -2
- package/lib/WAM/encode.js +0 -1
- package/lib/WAM/index.d.ts +0 -1
- package/lib/WAM/index.js +0 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
- package/package.json +94 -96
- package/WAProto/GenerateStatics.sh +0 -5
- package/WAProto/WAProto.proto +0 -4775
- package/WAProto/bocah rename tolol, baileys by denzy +0 -0
- package/WAProto/index.d.ts +0 -55058
- package/WAProto/index.ts.ts +0 -53474
- package/WAProto/p.html +0 -1
package/lib/Types/Message.d.ts
CHANGED
|
@@ -1,40 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
2
4
|
import { AxiosRequestConfig } from 'axios';
|
|
5
|
+
import type { Logger } from 'pino';
|
|
3
6
|
import type { Readable } from 'stream';
|
|
4
7
|
import type { URL } from 'url';
|
|
8
|
+
import { BinaryNode } from '../WABinary';
|
|
5
9
|
import { proto } from '../../WAProto';
|
|
6
10
|
import { MEDIA_HKDF_KEY_MAPPING } from '../Defaults';
|
|
7
|
-
import { BinaryNode } from '../WABinary';
|
|
8
11
|
import type { GroupMetadata } from './GroupMetadata';
|
|
9
12
|
import { CacheStore } from './Socket';
|
|
10
|
-
import { ILogger } from '../Utils/logger';
|
|
11
13
|
export { proto as WAProto };
|
|
12
|
-
export type WAMessage = proto.IWebMessageInfo
|
|
13
|
-
key: WAMessageKey;
|
|
14
|
-
};
|
|
14
|
+
export type WAMessage = proto.IWebMessageInfo;
|
|
15
15
|
export type WAMessageContent = proto.IMessage;
|
|
16
16
|
export type WAContactMessage = proto.Message.IContactMessage;
|
|
17
17
|
export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage;
|
|
18
|
-
export type WAMessageKey = proto.IMessageKey
|
|
19
|
-
senderPn?: string;
|
|
20
|
-
senderLid?: string;
|
|
21
|
-
participantLid?: string;
|
|
22
|
-
server_id?: string;
|
|
23
|
-
isViewOnce?: boolean;
|
|
24
|
-
};
|
|
18
|
+
export type WAMessageKey = proto.IMessageKey;
|
|
25
19
|
export type WATextMessage = proto.Message.IExtendedTextMessage;
|
|
26
20
|
export type WAContextInfo = proto.IContextInfo;
|
|
27
21
|
export type WALocationMessage = proto.Message.ILocationMessage;
|
|
28
22
|
export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
|
|
29
|
-
export
|
|
30
|
-
export
|
|
31
|
-
export type
|
|
23
|
+
export import WAMessageStubType = proto.WebMessageInfo.StubType;
|
|
24
|
+
export import WAMessageStatus = proto.WebMessageInfo.Status;
|
|
25
|
+
export type WAMediaUpload = Buffer | {
|
|
32
26
|
url: URL | string;
|
|
33
|
-
}
|
|
34
|
-
export type WAMediaPayloadStream = {
|
|
27
|
+
} | {
|
|
35
28
|
stream: Readable;
|
|
36
29
|
};
|
|
37
|
-
export type WAMediaUpload = Buffer | WAMediaPayloadStream | WAMediaPayloadURL;
|
|
38
30
|
/** Set of message types that are supported by the library */
|
|
39
31
|
export type MessageType = keyof proto.Message;
|
|
40
32
|
export type DownloadableMessage = {
|
|
@@ -81,24 +73,6 @@ type Templatable = {
|
|
|
81
73
|
templateButtons?: proto.IHydratedTemplateButton[];
|
|
82
74
|
footer?: string;
|
|
83
75
|
};
|
|
84
|
-
type Interactiveable = {
|
|
85
|
-
/** add buttons to the message */
|
|
86
|
-
interactiveButtons?: proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton[];
|
|
87
|
-
title?: string;
|
|
88
|
-
subtitle?: string;
|
|
89
|
-
media?: boolean;
|
|
90
|
-
};
|
|
91
|
-
type Shopable = {
|
|
92
|
-
shop?: proto.Message.InteractiveMessage.ShopMessage.Surface;
|
|
93
|
-
id?: string;
|
|
94
|
-
title?: string;
|
|
95
|
-
subtitle?: string;
|
|
96
|
-
media?: boolean;
|
|
97
|
-
};
|
|
98
|
-
type Cardsable = {
|
|
99
|
-
cards?: string[];
|
|
100
|
-
subtitle?: string;
|
|
101
|
-
};
|
|
102
76
|
type Editable = {
|
|
103
77
|
edit?: WAMessageKey;
|
|
104
78
|
};
|
|
@@ -107,10 +81,8 @@ type Listable = {
|
|
|
107
81
|
sections?: proto.Message.ListMessage.ISection[];
|
|
108
82
|
/** Title of a List Message only */
|
|
109
83
|
title?: string;
|
|
110
|
-
/** Text of the
|
|
84
|
+
/** Text of the bnutton on the list (required) */
|
|
111
85
|
buttonText?: string;
|
|
112
|
-
/** ListType of a List Message only */
|
|
113
|
-
listType?: proto.Message.ListMessage.ListType;
|
|
114
86
|
};
|
|
115
87
|
type WithDimensions = {
|
|
116
88
|
width?: number;
|
|
@@ -122,7 +94,6 @@ export type PollMessageOptions = {
|
|
|
122
94
|
values: string[];
|
|
123
95
|
/** 32 byte message secret to encrypt poll selections */
|
|
124
96
|
messageSecret?: Uint8Array;
|
|
125
|
-
toAnnouncementGroup?: boolean;
|
|
126
97
|
};
|
|
127
98
|
type SharePhoneNumber = {
|
|
128
99
|
sharePhoneNumber: boolean;
|
|
@@ -135,14 +106,14 @@ export type AnyMediaMessageContent = (({
|
|
|
135
106
|
image: WAMediaUpload;
|
|
136
107
|
caption?: string;
|
|
137
108
|
jpegThumbnail?: string;
|
|
138
|
-
} & Mentionable & Contextable & Buttonable & Templatable &
|
|
109
|
+
} & Mentionable & Contextable & Buttonable & Templatable & WithDimensions) | ({
|
|
139
110
|
video: WAMediaUpload;
|
|
140
111
|
caption?: string;
|
|
141
112
|
gifPlayback?: boolean;
|
|
142
113
|
jpegThumbnail?: string;
|
|
143
114
|
/** if set to true, will send as a `video note` */
|
|
144
115
|
ptv?: boolean;
|
|
145
|
-
} & Mentionable & Contextable & Buttonable & Templatable &
|
|
116
|
+
} & Mentionable & Contextable & Buttonable & Templatable & WithDimensions) | {
|
|
146
117
|
audio: WAMediaUpload;
|
|
147
118
|
/** if set to true, will send as a `voice note` */
|
|
148
119
|
ptt?: boolean;
|
|
@@ -156,7 +127,7 @@ export type AnyMediaMessageContent = (({
|
|
|
156
127
|
mimetype: string;
|
|
157
128
|
fileName?: string;
|
|
158
129
|
caption?: string;
|
|
159
|
-
} & Contextable & Buttonable & Templatable
|
|
130
|
+
} & Contextable & Buttonable & Templatable)) & {
|
|
160
131
|
mimetype?: string;
|
|
161
132
|
} & Editable;
|
|
162
133
|
export type ButtonReplyInfo = {
|
|
@@ -164,76 +135,13 @@ export type ButtonReplyInfo = {
|
|
|
164
135
|
id: string;
|
|
165
136
|
index: number;
|
|
166
137
|
};
|
|
167
|
-
export type GroupInviteInfo = {
|
|
168
|
-
inviteCode: string;
|
|
169
|
-
inviteExpiration: number;
|
|
170
|
-
text: string;
|
|
171
|
-
jid: string;
|
|
172
|
-
subject: string;
|
|
173
|
-
};
|
|
174
|
-
export type CallCreationInfo = {
|
|
175
|
-
time?: number;
|
|
176
|
-
title?: string;
|
|
177
|
-
type?: number;
|
|
178
|
-
};
|
|
179
|
-
export type AdminInviteInfo = {
|
|
180
|
-
inviteExpiration: number;
|
|
181
|
-
text: string;
|
|
182
|
-
jid: string;
|
|
183
|
-
subject: string;
|
|
184
|
-
thumbnail: Buffer;
|
|
185
|
-
};
|
|
186
|
-
export type PaymentInviteInfo = {
|
|
187
|
-
type?: number;
|
|
188
|
-
expiry?: number;
|
|
189
|
-
};
|
|
190
|
-
export type RequestPaymentInfo = {
|
|
191
|
-
expiry: number;
|
|
192
|
-
amount: number;
|
|
193
|
-
currency: string;
|
|
194
|
-
from: string;
|
|
195
|
-
note?: string;
|
|
196
|
-
sticker?: WAMediaUpload;
|
|
197
|
-
background: string;
|
|
198
|
-
/** add contextInfo to the message */
|
|
199
|
-
contextInfo?: proto.IContextInfo;
|
|
200
|
-
};
|
|
201
|
-
export type EventsInfo = {
|
|
202
|
-
isCanceled?: boolean;
|
|
203
|
-
name: string;
|
|
204
|
-
description: string;
|
|
205
|
-
joinLink?: string;
|
|
206
|
-
startTime?: number;
|
|
207
|
-
messageSecret?: Uint8Array;
|
|
208
|
-
};
|
|
209
|
-
export type OrderInfo = {
|
|
210
|
-
id: number;
|
|
211
|
-
thumbnail: string;
|
|
212
|
-
itemCount: number;
|
|
213
|
-
status: number;
|
|
214
|
-
surface: number;
|
|
215
|
-
title: string;
|
|
216
|
-
text: string;
|
|
217
|
-
seller: string;
|
|
218
|
-
token: string;
|
|
219
|
-
amount: number;
|
|
220
|
-
currency: string;
|
|
221
|
-
};
|
|
222
138
|
export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
|
|
223
139
|
productImage: WAMediaUpload;
|
|
224
140
|
};
|
|
225
|
-
export type AlbumMedia = {
|
|
226
|
-
image: WAMediaUpload;
|
|
227
|
-
caption?: string;
|
|
228
|
-
} | {
|
|
229
|
-
video: WAMediaUpload;
|
|
230
|
-
caption?: string;
|
|
231
|
-
gifPlayback?: boolean;
|
|
232
|
-
};
|
|
233
141
|
export type AnyRegularMessageContent = (({
|
|
234
142
|
text: string;
|
|
235
143
|
linkPreview?: WAUrlInfo | null;
|
|
236
|
-
} & Mentionable & Contextable & Buttonable & Templatable &
|
|
144
|
+
} & Mentionable & Contextable & Buttonable & Templatable & Listable & Editable) | AnyMediaMessageContent | ({
|
|
237
145
|
poll: PollMessageOptions;
|
|
238
146
|
} & Mentionable & Contextable & Buttonable & Templatable & Editable) | {
|
|
239
147
|
contacts: {
|
|
@@ -247,47 +155,14 @@ export type AnyRegularMessageContent = (({
|
|
|
247
155
|
} | {
|
|
248
156
|
buttonReply: ButtonReplyInfo;
|
|
249
157
|
type: 'template' | 'plain';
|
|
250
|
-
} | {
|
|
251
|
-
groupInvite: GroupInviteInfo;
|
|
252
158
|
} | {
|
|
253
159
|
listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>;
|
|
254
160
|
} | {
|
|
255
|
-
pin: WAMessageKey;
|
|
256
|
-
type: proto.PinInChat.Type;
|
|
257
|
-
/**
|
|
258
|
-
* 24 hours, 7 days, 30 days
|
|
259
|
-
*/
|
|
260
|
-
time?: 86400 | 604800 | 2592000;
|
|
261
|
-
} | {
|
|
262
|
-
keep: WAMessageKey;
|
|
263
|
-
type: number;
|
|
264
|
-
/**
|
|
265
|
-
* 24 hours, 7 days, 90 days
|
|
266
|
-
*/
|
|
267
|
-
time?: 86400 | 604800 | 7776000;
|
|
268
|
-
} | {
|
|
269
|
-
paymentInvite: PaymentInviteInfo;
|
|
270
|
-
} | {
|
|
271
|
-
requestPayment: RequestPaymentInfo;
|
|
272
|
-
} | {
|
|
273
|
-
event: EventsInfo;
|
|
274
|
-
} | {
|
|
275
|
-
order: OrderInfo;
|
|
276
|
-
} | {
|
|
277
|
-
call: CallCreationInfo;
|
|
278
|
-
} | {
|
|
279
|
-
inviteAdmin: AdminInviteInfo;
|
|
280
|
-
} | {
|
|
281
|
-
listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>;
|
|
282
|
-
} | ({
|
|
283
161
|
product: WASendableProduct;
|
|
284
162
|
businessOwnerJid?: string;
|
|
285
163
|
body?: string;
|
|
286
164
|
footer?: string;
|
|
287
|
-
}
|
|
288
|
-
album: AlbumMedia[];
|
|
289
|
-
caption?: string;
|
|
290
|
-
} & Mentionable & Contextable & Editable)) & ViewOnce;
|
|
165
|
+
} | SharePhoneNumber | RequestPhoneNumber) & ViewOnce;
|
|
291
166
|
export type AnyMessageContent = AnyRegularMessageContent | {
|
|
292
167
|
forward: WAMessage;
|
|
293
168
|
force?: boolean;
|
|
@@ -301,8 +176,8 @@ export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>;
|
|
|
301
176
|
type MinimalRelayOptions = {
|
|
302
177
|
/** override the message ID with a custom provided string */
|
|
303
178
|
messageId?: string;
|
|
304
|
-
/**
|
|
305
|
-
|
|
179
|
+
/** cached group metadata, use to prevent redundant requests to WA & speed up msg sending */
|
|
180
|
+
cachedGroupMetadata?: (jid: string) => Promise<GroupMetadataParticipants | undefined>;
|
|
306
181
|
};
|
|
307
182
|
export type MessageRelayOptions = MinimalRelayOptions & {
|
|
308
183
|
/** only send to a specific participant; used when a message decryption fails for a single user */
|
|
@@ -319,13 +194,13 @@ export type MessageRelayOptions = MinimalRelayOptions & {
|
|
|
319
194
|
useUserDevicesCache?: boolean;
|
|
320
195
|
/** jid list of participants for status@broadcast */
|
|
321
196
|
statusJidList?: string[];
|
|
322
|
-
newsletter?: boolean;
|
|
323
197
|
};
|
|
324
198
|
export type MiscMessageGenerationOptions = MinimalRelayOptions & {
|
|
325
199
|
/** optional, if you want to manually set the timestamp of the message */
|
|
326
200
|
timestamp?: Date;
|
|
327
201
|
/** the message you want to quote */
|
|
328
202
|
quoted?: WAMessage;
|
|
203
|
+
additionalNodes?: BinaryNode[];
|
|
329
204
|
/** disappearing messages settings */
|
|
330
205
|
ephemeralExpiration?: number | string;
|
|
331
206
|
/** timeout for media upload to WA server */
|
|
@@ -338,8 +213,6 @@ export type MiscMessageGenerationOptions = MinimalRelayOptions & {
|
|
|
338
213
|
font?: number;
|
|
339
214
|
/** if it is broadcast */
|
|
340
215
|
broadcast?: boolean;
|
|
341
|
-
newsletter?: boolean;
|
|
342
|
-
additionalNodes?: BinaryNode[];
|
|
343
216
|
};
|
|
344
217
|
export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
|
|
345
218
|
userJid: string;
|
|
@@ -356,7 +229,7 @@ export type WAMediaUploadFunction = (readStream: Readable | Buffer, opts: WAMedi
|
|
|
356
229
|
handle?: string;
|
|
357
230
|
}>;
|
|
358
231
|
export type MediaGenerationOptions = {
|
|
359
|
-
logger?:
|
|
232
|
+
logger?: Logger;
|
|
360
233
|
mediaTypeOverride?: MediaType;
|
|
361
234
|
upload: WAMediaUploadFunction;
|
|
362
235
|
/** cache media so it does not have to be uploaded again */
|
|
@@ -370,7 +243,6 @@ export type MediaGenerationOptions = {
|
|
|
370
243
|
};
|
|
371
244
|
export type MessageContentGenerationOptions = MediaGenerationOptions & {
|
|
372
245
|
getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
|
|
373
|
-
getProfilePicUrl?: (jid: string, type: 'image' | 'preview') => Promise<string | undefined>;
|
|
374
246
|
};
|
|
375
247
|
export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent;
|
|
376
248
|
/**
|
package/lib/Types/Message.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
// baileys by denzy
|
|
2
1
|
"use strict";
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.WAMessageStatus = exports.WAMessageStubType = exports.WAProto = void 0;
|
|
5
4
|
const WAProto_1 = require("../../WAProto");
|
|
6
5
|
Object.defineProperty(exports, "WAProto", { enumerable: true, get: function () { return WAProto_1.proto; } });
|
|
6
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
7
7
|
exports.WAMessageStubType = WAProto_1.proto.WebMessageInfo.StubType;
|
|
8
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
8
9
|
exports.WAMessageStatus = WAProto_1.proto.WebMessageInfo.Status;
|
|
@@ -1,80 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type NewsletterReactionMode =
|
|
4
|
-
export type NewsletterState =
|
|
5
|
-
export type NewsletterVerification =
|
|
6
|
-
export type NewsletterMute =
|
|
7
|
-
export type NewsletterViewRole =
|
|
1
|
+
import { proto } from "../../WAProto"
|
|
2
|
+
|
|
3
|
+
export type NewsletterReactionMode = "ALL" | "BASIC" | "NONE"
|
|
4
|
+
export type NewsletterState = "ACTIVE" | "GEOSUSPENDED" | "SUSPENDED"
|
|
5
|
+
export type NewsletterVerification = "VERIFIED" | "UNVERIFIED"
|
|
6
|
+
export type NewsletterMute = "ON" | "OFF" | "UNDEFINED"
|
|
7
|
+
export type NewsletterViewRole = "ADMIN" | "GUEST" | "OWNER" | "SUBSCRIBER"
|
|
8
|
+
|
|
8
9
|
export type NewsletterViewerMetadata = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
10
|
+
mute: NewsletterMute
|
|
11
|
+
view_role: NewsletterViewRole
|
|
12
|
+
}
|
|
13
|
+
|
|
12
14
|
export type NewsletterMetadata = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
15
|
+
/** jid of newsletter */
|
|
16
|
+
id: string
|
|
17
|
+
/** state of newsletter */
|
|
18
|
+
state: NewsletterState
|
|
19
|
+
/** creation timestamp of newsletter */
|
|
20
|
+
creation_time: number
|
|
21
|
+
/** name of newsletter */
|
|
22
|
+
name: string
|
|
23
|
+
/** timestamp of last name modification of newsletter */
|
|
24
|
+
nameTime: number
|
|
25
|
+
/** description of newsletter */
|
|
26
|
+
description: string
|
|
27
|
+
/** timestamp of last description modification of newsletter */
|
|
28
|
+
descriptionTime: number
|
|
29
|
+
/** invite code of newsletter */
|
|
30
|
+
invite: string
|
|
31
|
+
/** direct path of picture */
|
|
32
|
+
picture: string | null
|
|
33
|
+
/** direct path of picture preview (lower quality) */
|
|
34
|
+
preview: string | null
|
|
35
|
+
/** reaction mode of newsletter */
|
|
36
|
+
reaction_codes?: NewsletterReactionMode
|
|
37
|
+
/** subscribers count of newsletter */
|
|
38
|
+
subscribers: number
|
|
39
|
+
/** verification state of newsletter */
|
|
40
|
+
verification: NewsletterVerification
|
|
41
|
+
/** viewer metadata */
|
|
42
|
+
viewer_metadata: NewsletterViewerMetadata
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type SubscriberAction = "promote" | "demote"
|
|
46
|
+
|
|
45
47
|
export type ReactionModeUpdate = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
reaction_codes: {
|
|
49
|
+
blocked_codes: null
|
|
50
|
+
enabled_ts_sec: null
|
|
51
|
+
value: NewsletterReactionMode
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** only exists reaction mode update */
|
|
56
|
+
export type NewsletterSettingsUpdate = ReactionModeUpdate
|
|
57
|
+
|
|
54
58
|
export type NewsletterReaction = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
};
|
|
58
|
-
export type NewsletterFetchedUpdate = {
|
|
59
|
-
/**id of message in newsletter, starts from 100 */
|
|
60
|
-
server_id: string;
|
|
61
|
-
/**count of views in this message */
|
|
62
|
-
views?: number;
|
|
63
|
-
/**reactions in this message */
|
|
64
|
-
reactions: NewsletterReaction[];
|
|
65
|
-
/**the message, if you requested only updates, you will not receive message */
|
|
66
|
-
message?: proto.IWebMessageInfo;
|
|
67
|
-
};
|
|
68
|
-
export declare enum MexOperations {
|
|
69
|
-
PROMOTE = "NotificationNewsletterAdminPromote",
|
|
70
|
-
DEMOTE = "NotificationNewsletterAdminDemote",
|
|
71
|
-
UPDATE = "NotificationNewsletterUpdate"
|
|
59
|
+
count: number
|
|
60
|
+
code: string
|
|
72
61
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
62
|
+
|
|
63
|
+
export type NewsletterFetchedUpdate = {
|
|
64
|
+
/** id of message in newsletter, starts from 100 */
|
|
65
|
+
server_id: string
|
|
66
|
+
/** count of views in this message */
|
|
67
|
+
views?: number
|
|
68
|
+
/** reactions in this message */
|
|
69
|
+
reactions: NewsletterReaction[]
|
|
70
|
+
/** the message, if you requested only updates, you will not receive message */
|
|
71
|
+
message?: proto.IWebMessageInfo
|
|
80
72
|
}
|
|
73
|
+
|
|
74
|
+
export const MexOperations = {
|
|
75
|
+
PROMOTE: "NotificationNewsletterAdminPromote",
|
|
76
|
+
DEMOTE: "NotificationNewsletterAdminDemote",
|
|
77
|
+
UPDATE: "NotificationNewsletterUpdate"
|
|
78
|
+
} as const
|
|
79
|
+
|
|
80
|
+
export const XWAPaths = {
|
|
81
|
+
PROMOTE: "xwa2_notify_newsletter_admin_promote",
|
|
82
|
+
DEMOTE: "xwa2_notify_newsletter_admin_demote",
|
|
83
|
+
ADMIN_COUNT: "xwa2_newsletter_admin",
|
|
84
|
+
CREATE: "xwa2_newsletter_create",
|
|
85
|
+
NEWSLETTER: "xwa2_newsletter",
|
|
86
|
+
SUBSCRIBED: "xwa2_newsletter_subscribed",
|
|
87
|
+
METADATA_UPDATE: "xwa2_notify_newsletter_on_metadata_update"
|
|
88
|
+
} as const
|
|
89
|
+
|
|
90
|
+
export const QueryIds = {
|
|
91
|
+
JOB_MUTATION: "7150902998257522",
|
|
92
|
+
METADATA: "6620195908089573",
|
|
93
|
+
UNFOLLOW: "7238632346214362",
|
|
94
|
+
FOLLOW: "7871414976211147",
|
|
95
|
+
UNMUTE: "7337137176362961",
|
|
96
|
+
MUTE: "25151904754424642",
|
|
97
|
+
CREATE: "6996806640408138",
|
|
98
|
+
ADMIN_COUNT: "7130823597031706",
|
|
99
|
+
CHANGE_OWNER: "7341777602580933",
|
|
100
|
+
DELETE: "8316537688363079",
|
|
101
|
+
DEMOTE: "6551828931592903",
|
|
102
|
+
SUBSCRIBED: "6388546374527196"
|
|
103
|
+
} as const
|
package/lib/Types/Newsletter.js
CHANGED
|
@@ -1,19 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true })
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
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/lib/Types/Socket.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
1
3
|
import { AxiosRequestConfig } from 'axios';
|
|
2
4
|
import type { Agent } from 'https';
|
|
5
|
+
import type { Logger } from 'pino';
|
|
3
6
|
import type { URL } from 'url';
|
|
4
7
|
import { proto } from '../../WAProto';
|
|
5
8
|
import { AuthenticationState, SignalAuthState, TransactionCapabilityOptions } from './Auth';
|
|
6
|
-
import { GroupMetadata } from './GroupMetadata';
|
|
7
9
|
import { MediaConnInfo } from './Message';
|
|
8
10
|
import { SignalRepository } from './Signal';
|
|
9
|
-
import { ILogger } from '../Utils/logger';
|
|
10
11
|
export type WAVersion = [number, number, number];
|
|
11
12
|
export type WABrowserDescription = [string, string, string];
|
|
12
13
|
export type CacheStore = {
|
|
@@ -19,9 +20,6 @@ export type CacheStore = {
|
|
|
19
20
|
/** flush all data */
|
|
20
21
|
flushAll(): void;
|
|
21
22
|
};
|
|
22
|
-
export type PatchedMessageWithRecipientJID = proto.IMessage & {
|
|
23
|
-
recipientJid?: string;
|
|
24
|
-
};
|
|
25
23
|
export type SocketConfig = {
|
|
26
24
|
/** the WS url to connect to WA */
|
|
27
25
|
waWebSocketUrl: string | URL;
|
|
@@ -31,14 +29,12 @@ export type SocketConfig = {
|
|
|
31
29
|
defaultQueryTimeoutMs: number | undefined;
|
|
32
30
|
/** ping-pong interval for WS connection */
|
|
33
31
|
keepAliveIntervalMs: number;
|
|
34
|
-
/** should baileys use the mobile api instead of the multi device api
|
|
35
|
-
* @deprecated This feature has been removed
|
|
36
|
-
*/
|
|
32
|
+
/** should baileys use the mobile api instead of the multi device api */
|
|
37
33
|
mobile?: boolean;
|
|
38
34
|
/** proxy agent */
|
|
39
35
|
agent?: Agent;
|
|
40
|
-
/** logger */
|
|
41
|
-
logger:
|
|
36
|
+
/** pino logger */
|
|
37
|
+
logger: Logger;
|
|
42
38
|
/** version to connect with */
|
|
43
39
|
version: WAVersion;
|
|
44
40
|
/** override browser config */
|
|
@@ -65,8 +61,6 @@ export type SocketConfig = {
|
|
|
65
61
|
transactionOpts: TransactionCapabilityOptions;
|
|
66
62
|
/** marks the client as online whenever the socket successfully connects */
|
|
67
63
|
markOnlineOnConnect: boolean;
|
|
68
|
-
/** alphanumeric country code (USA -> US) for the number used */
|
|
69
|
-
countryCode: string;
|
|
70
64
|
/** provide a cache to store media, so does not have to be re-uploaded */
|
|
71
65
|
mediaCache?: CacheStore;
|
|
72
66
|
/**
|
|
@@ -77,8 +71,6 @@ export type SocketConfig = {
|
|
|
77
71
|
userDevicesCache?: CacheStore;
|
|
78
72
|
/** cache to store call offers */
|
|
79
73
|
callOfferCache?: CacheStore;
|
|
80
|
-
/** cache to track placeholder resends */
|
|
81
|
-
placeholderResendCache?: CacheStore;
|
|
82
74
|
/** width for link preview images */
|
|
83
75
|
linkPreviewImageThumbnailWidth: number;
|
|
84
76
|
/** Should Baileys ask the phone for full history, will be received async */
|
|
@@ -99,7 +91,7 @@ export type SocketConfig = {
|
|
|
99
91
|
/**
|
|
100
92
|
* Optionally patch the message before sending out
|
|
101
93
|
* */
|
|
102
|
-
patchMessageBeforeSending: (msg: proto.IMessage, recipientJids
|
|
94
|
+
patchMessageBeforeSending: (msg: proto.IMessage, recipientJids: string[]) => Promise<proto.IMessage> | proto.IMessage;
|
|
103
95
|
/** verify app state MACs */
|
|
104
96
|
appStateMacVerification: {
|
|
105
97
|
patch: boolean;
|
|
@@ -113,7 +105,7 @@ export type SocketConfig = {
|
|
|
113
105
|
* (solves the "this message can take a while" issue) can be retried
|
|
114
106
|
* */
|
|
115
107
|
getMessage: (key: proto.IMessageKey) => Promise<proto.IMessage | undefined>;
|
|
116
|
-
/** cached group metadata, use to prevent redundant requests to WA & speed up msg sending */
|
|
117
|
-
cachedGroupMetadata: (jid: string) => Promise<GroupMetadata | undefined>;
|
|
118
108
|
makeSignalRepository: (auth: SignalAuthState) => SignalRepository;
|
|
109
|
+
/** Socket passthrough */
|
|
110
|
+
socket?: any;
|
|
119
111
|
};
|
package/lib/Types/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
// baileys by denzy
|
|
2
1
|
export * from './Auth';
|
|
3
2
|
export * from './GroupMetadata';
|
|
4
|
-
export * from './Newsletter';
|
|
5
3
|
export * from './Chat';
|
|
6
4
|
export * from './Contact';
|
|
7
5
|
export * from './State';
|
|
8
6
|
export * from './Message';
|
|
7
|
+
export * from './Newsletter';
|
|
9
8
|
export * from './Socket';
|
|
10
9
|
export * from './Events';
|
|
11
10
|
export * from './Product';
|
|
@@ -16,13 +15,6 @@ import { SocketConfig } from './Socket';
|
|
|
16
15
|
export type UserFacingSocketConfig = Partial<SocketConfig> & {
|
|
17
16
|
auth: AuthenticationState;
|
|
18
17
|
};
|
|
19
|
-
export type BrowsersMap = {
|
|
20
|
-
ubuntu(browser: string): [string, string, string];
|
|
21
|
-
macOS(browser: string): [string, string, string];
|
|
22
|
-
baileys(browser: string): [string, string, string];
|
|
23
|
-
windows(browser: string): [string, string, string];
|
|
24
|
-
appropriate(browser: string): [string, string, string];
|
|
25
|
-
};
|
|
26
18
|
export declare enum DisconnectReason {
|
|
27
19
|
connectionClosed = 428,
|
|
28
20
|
connectionLost = 408,
|