@jkt48connect-corp/baileys 7.2.7 → 7.2.8
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/LICENSE +1 -1
- package/README.md +838 -94
- package/WAProto/WAProto.proto +969 -88
- package/WAProto/index.d.ts +13199 -1260
- package/WAProto/index.js +124901 -74525
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.d.ts +7 -8
- package/lib/Defaults/index.js +5 -3
- package/lib/Defaults/phonenumber-mcc.json +221 -221
- package/lib/Signal/libsignal.js +18 -9
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -2
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -1
- package/lib/Socket/business.d.ts +40 -40
- package/lib/Socket/chats.d.ts +13 -14
- package/lib/Socket/groups.d.ts +20 -21
- package/lib/Socket/groups.js +1 -1
- package/lib/Socket/index.d.ts +49 -49
- package/lib/Socket/messages-recv.d.ts +39 -39
- package/lib/Socket/messages-recv.js +310 -151
- package/lib/Socket/messages-send.d.ts +33 -31
- package/lib/Socket/messages-send.js +269 -36
- package/lib/Socket/newsletter.d.ts +24 -25
- package/lib/Socket/newsletter.js +3 -3
- package/lib/Socket/registration.d.ts +49 -52
- package/lib/Socket/registration.js +7 -7
- package/lib/Socket/socket.d.ts +6 -7
- package/lib/Socket/socket.js +7 -3
- package/lib/Store/make-cache-manager-store.d.ts +1 -0
- package/lib/Store/make-in-memory-store.d.ts +3 -4
- package/lib/Store/make-in-memory-store.js +13 -11
- package/lib/Store/make-ordered-dictionary.d.ts +1 -1
- package/lib/Types/Auth.d.ts +0 -1
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +12 -7
- package/lib/Types/Events.d.ts +17 -2
- package/lib/Types/GroupMetadata.d.ts +3 -1
- package/lib/Types/Label.d.ts +11 -0
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.d.ts +164 -13
- package/lib/Types/Newsletter.js +3 -3
- package/lib/Types/Socket.d.ts +7 -2
- package/lib/Types/index.d.ts +9 -0
- package/lib/Types/index.js +1 -1
- package/lib/Utils/auth-utils.js +3 -3
- package/lib/Utils/business.d.ts +1 -1
- package/lib/Utils/business.js +2 -2
- package/lib/Utils/chat-utils.d.ts +11 -12
- package/lib/Utils/chat-utils.js +41 -20
- package/lib/Utils/crypto.d.ts +15 -16
- package/lib/Utils/crypto.js +35 -23
- package/lib/Utils/decode-wa-message.d.ts +17 -0
- package/lib/Utils/decode-wa-message.js +43 -15
- package/lib/Utils/generics.d.ts +10 -19
- package/lib/Utils/generics.js +32 -16
- package/lib/Utils/history.d.ts +6 -2
- package/lib/Utils/history.js +3 -0
- package/lib/Utils/index.d.ts +0 -1
- package/lib/Utils/index.js +0 -1
- package/lib/Utils/logger.d.ts +1 -3
- package/lib/Utils/make-mutex.d.ts +2 -2
- package/lib/Utils/messages-media.d.ts +25 -28
- package/lib/Utils/messages-media.js +38 -47
- package/lib/Utils/messages.d.ts +5 -8
- package/lib/Utils/messages.js +430 -12
- package/lib/Utils/noise-handler.d.ts +4 -5
- package/lib/Utils/process-message.js +2 -2
- package/lib/Utils/use-multi-file-auth-state.js +17 -3
- package/lib/Utils/validate-connection.d.ts +2 -2
- package/lib/Utils/validate-connection.js +12 -23
- package/lib/WABinary/decode.d.ts +1 -2
- package/lib/WABinary/decode.js +17 -7
- package/lib/WABinary/encode.d.ts +1 -2
- package/lib/WABinary/encode.js +33 -17
- package/lib/WABinary/generic-utils.d.ts +2 -3
- package/lib/WABinary/generic-utils.js +2 -2
- package/lib/WABinary/jid-utils.d.ts +1 -1
- package/lib/WAM/BinaryInfo.d.ts +2 -11
- package/lib/WAM/encode.d.ts +1 -2
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
- package/lib/WAUSync/Protocols/index.d.ts +4 -0
- package/lib/WAUSync/Protocols/index.js +20 -0
- package/lib/WAUSync/USyncQuery.d.ts +26 -0
- package/lib/WAUSync/USyncQuery.js +79 -0
- package/lib/WAUSync/USyncUser.d.ts +10 -0
- package/lib/WAUSync/USyncUser.js +22 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/WAUSync/index.js +19 -0
- package/lib/index.js +4 -1
- package/package.json +15 -10
- package/lib/Socket/community.d.ts +0 -219
- package/lib/Socket/community.js +0 -354
- package/lib/Utils/use-single-file-auth-statev2.d.ts +0 -12
- package/lib/Utils/use-single-file-auth-statev2.js +0 -75
- package/lib/index.d.ts +0 -11
@@ -1,7 +1,7 @@
|
|
1
1
|
export declare const makeMutex: () => {
|
2
|
-
mutex<T>(code: () => T |
|
2
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
3
3
|
};
|
4
4
|
export type Mutex = ReturnType<typeof makeMutex>;
|
5
5
|
export declare const makeKeyedMutex: () => {
|
6
|
-
mutex<T>(key: string, task: () => T |
|
6
|
+
mutex<T>(key: string, task: () => Promise<T> | T): Promise<T>;
|
7
7
|
};
|
@@ -1,10 +1,7 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
/// <reference types="node" />
|
3
|
-
/// <reference types="node" />
|
4
1
|
import { Boom } from '@hapi/boom';
|
5
2
|
import { AxiosRequestConfig } from 'axios';
|
6
3
|
import type { Logger } from 'pino';
|
7
|
-
import { Readable
|
4
|
+
import { Readable } from 'stream';
|
8
5
|
import { URL } from 'url';
|
9
6
|
import { proto } from '../../WAProto';
|
10
7
|
import { DownloadableMessage, MediaConnInfo, MediaDecryptionKeyInfo, MediaType, SocketConfig, WAMediaUpload, WAMediaUploadFunction, WAMessageContent } from '../Types';
|
@@ -13,10 +10,10 @@ export declare const hkdfInfoKey: (type: MediaType) => string;
|
|
13
10
|
/** generates all the keys required to encrypt/decrypt & sign a media message */
|
14
11
|
export declare function getMediaKeys(buffer: Uint8Array | string | null | undefined, mediaType: MediaType): MediaDecryptionKeyInfo;
|
15
12
|
export declare const extractImageThumb: (bufferOrFilePath: Readable | Buffer | string, width?: number) => Promise<{
|
16
|
-
buffer:
|
13
|
+
buffer: any;
|
17
14
|
original: {
|
18
|
-
width:
|
19
|
-
height:
|
15
|
+
width: any;
|
16
|
+
height: any;
|
20
17
|
};
|
21
18
|
}>;
|
22
19
|
export declare const encodeBase64EncodedStringForUpload: (b64: string) => string;
|
@@ -24,25 +21,25 @@ export declare const generateProfilePicture: (mediaUpload: WAMediaUpload) => Pro
|
|
24
21
|
img: Buffer;
|
25
22
|
}>;
|
26
23
|
/** gets the SHA256 of the given media message */
|
27
|
-
export declare const mediaMessageSHA256B64: (message: WAMessageContent) =>
|
28
|
-
export declare function getAudioDuration(buffer: Buffer | string | Readable): Promise<
|
24
|
+
export declare const mediaMessageSHA256B64: (message: WAMessageContent) => any;
|
25
|
+
export declare function getAudioDuration(buffer: Buffer | string | Readable): Promise<any>;
|
29
26
|
/**
|
30
27
|
referenced from and modifying https://github.com/wppconnect-team/wa-js/blob/main/src/chat/functions/prepareAudioWaveform.ts
|
31
28
|
*/
|
32
|
-
export declare function getAudioWaveform(buffer: Buffer | string | Readable, logger?: Logger): Promise<Uint8Array | undefined>;
|
33
|
-
export declare const toReadable: (buffer: Buffer) =>
|
34
|
-
export declare const toBuffer: (stream: Readable) => Promise<
|
29
|
+
export declare function getAudioWaveform(buffer: Buffer | string | Readable, logger?: Logger): Promise<Uint8Array<ArrayBuffer> | undefined>;
|
30
|
+
export declare const toReadable: (buffer: Buffer) => any;
|
31
|
+
export declare const toBuffer: (stream: Readable) => Promise<any>;
|
35
32
|
export declare const getStream: (item: WAMediaUpload, opts?: AxiosRequestConfig) => Promise<{
|
36
|
-
readonly stream:
|
33
|
+
readonly stream: any;
|
37
34
|
readonly type: "buffer";
|
38
35
|
} | {
|
39
|
-
readonly stream:
|
36
|
+
readonly stream: any;
|
40
37
|
readonly type: "readable";
|
41
38
|
} | {
|
42
39
|
readonly stream: Readable;
|
43
40
|
readonly type: "remote";
|
44
41
|
} | {
|
45
|
-
readonly stream:
|
42
|
+
readonly stream: any;
|
46
43
|
readonly type: "file";
|
47
44
|
}>;
|
48
45
|
/** generates a thumbnail for a given media, if required */
|
@@ -65,20 +62,20 @@ type EncryptedStreamOptions = {
|
|
65
62
|
};
|
66
63
|
export declare const prepareStream: (media: WAMediaUpload, mediaType: MediaType, { logger, saveOriginalFileIfRequired, opts }?: EncryptedStreamOptions) => Promise<{
|
67
64
|
mediaKey: undefined;
|
68
|
-
encWriteStream:
|
69
|
-
fileLength:
|
70
|
-
fileSha256:
|
65
|
+
encWriteStream: any;
|
66
|
+
fileLength: any;
|
67
|
+
fileSha256: any;
|
71
68
|
fileEncSha256: undefined;
|
72
69
|
bodyPath: string | undefined;
|
73
70
|
didSaveToTmpPath: boolean;
|
74
71
|
}>;
|
75
72
|
export declare const encryptedStream: (media: WAMediaUpload, mediaType: MediaType, { logger, saveOriginalFileIfRequired, opts }?: EncryptedStreamOptions) => Promise<{
|
76
|
-
mediaKey:
|
77
|
-
encWriteStream:
|
73
|
+
mediaKey: any;
|
74
|
+
encWriteStream: any;
|
78
75
|
bodyPath: string | undefined;
|
79
|
-
mac:
|
80
|
-
fileEncSha256:
|
81
|
-
fileSha256:
|
76
|
+
mac: any;
|
77
|
+
fileEncSha256: any;
|
78
|
+
fileSha256: any;
|
82
79
|
fileLength: number;
|
83
80
|
didSaveToTmpPath: boolean;
|
84
81
|
}>;
|
@@ -88,12 +85,12 @@ export type MediaDownloadOptions = {
|
|
88
85
|
options?: AxiosRequestConfig<any>;
|
89
86
|
};
|
90
87
|
export declare const getUrlFromDirectPath: (directPath: string) => string;
|
91
|
-
export declare const downloadContentFromMessage: ({ mediaKey, directPath, url }: DownloadableMessage, type: MediaType, opts?: MediaDownloadOptions) => Promise<
|
88
|
+
export declare const downloadContentFromMessage: ({ mediaKey, directPath, url }: DownloadableMessage, type: MediaType, opts?: MediaDownloadOptions) => Promise<any>;
|
92
89
|
/**
|
93
90
|
* Decrypts and downloads an AES256-CBC encrypted file given the keys.
|
94
91
|
* Assumes the SHA256 of the plaintext is appended to the end of the ciphertext
|
95
92
|
* */
|
96
|
-
export declare const downloadEncryptedContent: (downloadUrl: string, { cipherKey, iv }: MediaDecryptionKeyInfo, { startByte, endByte, options }?: MediaDownloadOptions) => Promise<
|
93
|
+
export declare const downloadEncryptedContent: (downloadUrl: string, { cipherKey, iv }: MediaDecryptionKeyInfo, { startByte, endByte, options }?: MediaDownloadOptions) => Promise<any>;
|
97
94
|
export declare function extensionForMediaMessage(message: WAMessageContent): string;
|
98
95
|
export declare const getWAUploadToServer: ({ customUploadHosts, fetchAgent, logger, options }: SocketConfig, refreshMediaConn: (force: boolean) => Promise<MediaConnInfo>) => WAMediaUploadFunction;
|
99
96
|
/**
|
@@ -101,12 +98,12 @@ export declare const getWAUploadToServer: ({ customUploadHosts, fetchAgent, logg
|
|
101
98
|
*/
|
102
99
|
export declare const encryptMediaRetryRequest: (key: proto.IMessageKey, mediaKey: Buffer | Uint8Array, meId: string) => BinaryNode;
|
103
100
|
export declare const decodeMediaRetryNode: (node: BinaryNode) => {
|
104
|
-
key:
|
101
|
+
key: import("../Types").WAMessageKey;
|
105
102
|
media?: {
|
106
103
|
ciphertext: Uint8Array;
|
107
104
|
iv: Uint8Array;
|
108
|
-
}
|
109
|
-
error?: Boom
|
105
|
+
};
|
106
|
+
error?: Boom;
|
110
107
|
};
|
111
108
|
export declare const decryptMediaRetryData: ({ ciphertext, iv }: {
|
112
109
|
ciphertext: Uint8Array;
|
@@ -15,15 +15,30 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
15
15
|
}) : function(o, v) {
|
16
16
|
o["default"] = v;
|
17
17
|
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
};
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
19
|
+
var ownKeys = function(o) {
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
21
|
+
var ar = [];
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
23
|
+
return ar;
|
24
|
+
};
|
25
|
+
return ownKeys(o);
|
26
|
+
};
|
27
|
+
return function (mod) {
|
28
|
+
if (mod && mod.__esModule) return mod;
|
29
|
+
var result = {};
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
31
|
+
__setModuleDefault(result, mod);
|
32
|
+
return result;
|
33
|
+
};
|
34
|
+
})();
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.getStatusCodeForMediaRetry = exports.decryptMediaRetryData = exports.decodeMediaRetryNode = exports.encryptMediaRetryRequest = exports.getWAUploadToServer = exports.
|
36
|
+
exports.getStatusCodeForMediaRetry = exports.decryptMediaRetryData = exports.decodeMediaRetryNode = exports.encryptMediaRetryRequest = exports.getWAUploadToServer = exports.downloadEncryptedContent = exports.downloadContentFromMessage = exports.getUrlFromDirectPath = exports.encryptedStream = exports.prepareStream = exports.getHttpStream = exports.getStream = exports.toBuffer = exports.toReadable = exports.mediaMessageSHA256B64 = exports.generateProfilePicture = exports.encodeBase64EncodedStringForUpload = exports.extractImageThumb = exports.hkdfInfoKey = void 0;
|
37
|
+
exports.getMediaKeys = getMediaKeys;
|
38
|
+
exports.getAudioDuration = getAudioDuration;
|
39
|
+
exports.getAudioWaveform = getAudioWaveform;
|
40
|
+
exports.generateThumbnail = generateThumbnail;
|
41
|
+
exports.extensionForMediaMessage = extensionForMediaMessage;
|
27
42
|
const boom_1 = require("@hapi/boom");
|
28
43
|
const child_process_1 = require("child_process");
|
29
44
|
const Crypto = __importStar(require("crypto"));
|
@@ -81,7 +96,6 @@ function getMediaKeys(buffer, mediaType) {
|
|
81
96
|
macKey: expandedMediaKey.slice(48, 80),
|
82
97
|
};
|
83
98
|
}
|
84
|
-
exports.getMediaKeys = getMediaKeys;
|
85
99
|
/** Extracts video thumb using FFMPEG */
|
86
100
|
const extractVideoThumb = async (path, destPath, time, size) => new Promise((resolve, reject) => {
|
87
101
|
const cmd = `ffmpeg -ss ${time} -i ${path} -y -vf scale=${size.width}:-1 -vframes 1 -f image2 ${destPath}`;
|
@@ -142,42 +156,23 @@ const encodeBase64EncodedStringForUpload = (b64) => (encodeURIComponent(b64
|
|
142
156
|
.replace(/\=+$/, '')));
|
143
157
|
exports.encodeBase64EncodedStringForUpload = encodeBase64EncodedStringForUpload;
|
144
158
|
const generateProfilePicture = async (mediaUpload) => {
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
else if ('url' in mediaUpload) {
|
151
|
-
bufferOrFilePath = mediaUpload.url.toString();
|
152
|
-
}
|
153
|
-
else {
|
154
|
-
bufferOrFilePath = await (0, exports.toBuffer)(mediaUpload.stream);
|
155
|
-
}
|
156
|
-
const lib = await getImageProcessingLibrary();
|
159
|
+
const bufferOrFilePath = Buffer.isBuffer(mediaUpload)
|
160
|
+
? mediaUpload
|
161
|
+
: typeof mediaUpload === 'object' && 'url' in mediaUpload
|
162
|
+
? mediaUpload.url.toString()
|
163
|
+
: await (0, exports.toBuffer)(mediaUpload.stream);
|
157
164
|
let img;
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
const { read, MIME_JPEG, RESIZE_BILINEAR } = lib.jimp;
|
168
|
-
const jimp = await read(bufferOrFilePath);
|
169
|
-
const min = Math.min(jimp.getWidth(), jimp.getHeight());
|
170
|
-
const cropped = jimp.crop(0, 0, min, min);
|
171
|
-
img = cropped
|
172
|
-
.quality(50)
|
173
|
-
.resize(640, 640, RESIZE_BILINEAR)
|
174
|
-
.getBufferAsync(MIME_JPEG);
|
175
|
-
}
|
176
|
-
else {
|
177
|
-
throw new boom_1.Boom('No image processing library available');
|
178
|
-
}
|
165
|
+
const { read, MIME_JPEG, AUTO } = require('jimp');
|
166
|
+
const jimp = await read(bufferOrFilePath);
|
167
|
+
const min = jimp.getWidth();
|
168
|
+
const max = jimp.getHeight();
|
169
|
+
const cropped = jimp.crop(0, 0, min, max);
|
170
|
+
img = cropped
|
171
|
+
.quality(100)
|
172
|
+
.scaleToFit(720, 720, AUTO)
|
173
|
+
.getBufferAsync(MIME_JPEG);
|
179
174
|
return {
|
180
|
-
img: await img
|
175
|
+
img: await img
|
181
176
|
};
|
182
177
|
};
|
183
178
|
exports.generateProfilePicture = generateProfilePicture;
|
@@ -207,7 +202,6 @@ async function getAudioDuration(buffer) {
|
|
207
202
|
}
|
208
203
|
return metadata.format.duration;
|
209
204
|
}
|
210
|
-
exports.getAudioDuration = getAudioDuration;
|
211
205
|
/**
|
212
206
|
referenced from and modifying https://github.com/wppconnect-team/wa-js/blob/main/src/chat/functions/prepareAudioWaveform.ts
|
213
207
|
*/
|
@@ -249,7 +243,6 @@ async function getAudioWaveform(buffer, logger) {
|
|
249
243
|
logger === null || logger === void 0 ? void 0 : logger.debug('Failed to generate waveform: ' + e);
|
250
244
|
}
|
251
245
|
}
|
252
|
-
exports.getAudioWaveform = getAudioWaveform;
|
253
246
|
const toReadable = (buffer) => {
|
254
247
|
const readable = new stream_1.Readable({ read: () => { } });
|
255
248
|
readable.push(buffer);
|
@@ -311,7 +304,6 @@ async function generateThumbnail(file, mediaType, options) {
|
|
311
304
|
originalImageDimensions
|
312
305
|
};
|
313
306
|
}
|
314
|
-
exports.generateThumbnail = generateThumbnail;
|
315
307
|
const getHttpStream = async (url, options = {}) => {
|
316
308
|
const { default: axios } = await import('axios');
|
317
309
|
const fetched = await axios.get(url.toString(), { ...options, responseType: 'stream' });
|
@@ -565,7 +557,6 @@ function extensionForMediaMessage(message) {
|
|
565
557
|
}
|
566
558
|
return extension;
|
567
559
|
}
|
568
|
-
exports.extensionForMediaMessage = extensionForMediaMessage;
|
569
560
|
const getWAUploadToServer = ({ customUploadHosts, fetchAgent, logger, options }, refreshMediaConn) => {
|
570
561
|
return async (stream, { mediaType, fileEncSha256B64, newsletter, timeoutMs }) => {
|
571
562
|
var _a, _b;
|
package/lib/Utils/messages.d.ts
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
/// <reference types="node" />
|
3
1
|
import { Logger } from 'pino';
|
4
|
-
import { type Transform } from 'stream';
|
5
2
|
import { proto } from '../../WAProto';
|
6
3
|
import { AnyMediaMessageContent, AnyMessageContent, MediaGenerationOptions, MessageContentGenerationOptions, MessageGenerationOptions, MessageGenerationOptionsFromContent, MessageUserReceipt, WAMessage, WAMessageContent, WAProto } from '../Types';
|
7
4
|
import { MediaDownloadOptions } from './messages-media';
|
@@ -11,7 +8,7 @@ import { MediaDownloadOptions } from './messages-media';
|
|
11
8
|
* @returns the URL, eg. https://google.com
|
12
9
|
*/
|
13
10
|
export declare const extractUrlFromText: (text: string) => string | undefined;
|
14
|
-
export declare const generateLinkPreviewIfRequired: (text: string, getUrlInfo: MessageGenerationOptions[
|
11
|
+
export declare const generateLinkPreviewIfRequired: (text: string, getUrlInfo: MessageGenerationOptions["getUrlInfo"], logger: MessageGenerationOptions["logger"]) => Promise<import("../Types").WAUrlInfo | undefined>;
|
15
12
|
export declare const prepareWAMessageMedia: (message: AnyMediaMessageContent, options: MediaGenerationOptions) => Promise<proto.Message>;
|
16
13
|
export declare const prepareDisappearingMessageSettingContent: (ephemeralExpiration?: number) => proto.Message;
|
17
14
|
/**
|
@@ -42,11 +39,11 @@ export declare const extractMessageContent: (content: WAMessageContent | undefin
|
|
42
39
|
*/
|
43
40
|
export declare const getDevice: (id: string) => "android" | "unknown" | "web" | "ios" | "desktop";
|
44
41
|
/** Upserts a receipt in the message */
|
45
|
-
export declare const updateMessageWithReceipt: (msg: Pick<WAMessage,
|
42
|
+
export declare const updateMessageWithReceipt: (msg: Pick<WAMessage, "userReceipt">, receipt: MessageUserReceipt) => void;
|
46
43
|
/** Update the message with a new reaction */
|
47
|
-
export declare const updateMessageWithReaction: (msg: Pick<WAMessage,
|
44
|
+
export declare const updateMessageWithReaction: (msg: Pick<WAMessage, "reactions">, reaction: proto.IReaction) => void;
|
48
45
|
/** Update the message with a new poll update */
|
49
|
-
export declare const updateMessageWithPollUpdate: (msg: Pick<WAMessage,
|
46
|
+
export declare const updateMessageWithPollUpdate: (msg: Pick<WAMessage, "pollUpdates">, update: proto.IPollUpdate) => void;
|
50
47
|
type VoteAggregation = {
|
51
48
|
name: string;
|
52
49
|
voters: string[];
|
@@ -71,7 +68,7 @@ type DownloadMediaMessageContext = {
|
|
71
68
|
/**
|
72
69
|
* Downloads the given message. Throws an error if it's not a media message
|
73
70
|
*/
|
74
|
-
export declare const downloadMediaMessage: <Type extends "
|
71
|
+
export declare const downloadMediaMessage: <Type extends "buffer" | "stream">(message: WAMessage, type: Type, options: MediaDownloadOptions, ctx?: DownloadMediaMessageContext) => Promise<Type extends "buffer" ? Buffer : Transform>;
|
75
72
|
/** Checks whether the given message is a media message; if it is returns the inner content */
|
76
73
|
export declare const assertMediaContent: (content: proto.IMessage | null | undefined) => proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
|
77
74
|
export {};
|