@queenanya/baileys 7.3.3 → 7.3.6
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/chats.js
CHANGED
|
@@ -256,7 +256,7 @@ const makeChatsSocket = (config) => {
|
|
|
256
256
|
if ((0, WABinary_1.jidNormalizedUser)(jid) !== (0, WABinary_1.jidNormalizedUser)(authState.creds.me.id)) {
|
|
257
257
|
targetJid = (0, WABinary_1.jidNormalizedUser)(jid); // in case it is someone other than us
|
|
258
258
|
}
|
|
259
|
-
const {
|
|
259
|
+
const { preview } = await (0, Utils_1.generateProfilePictureFP)(content);
|
|
260
260
|
await query({
|
|
261
261
|
tag: 'iq',
|
|
262
262
|
attrs: {
|
|
@@ -269,7 +269,7 @@ const makeChatsSocket = (config) => {
|
|
|
269
269
|
{
|
|
270
270
|
tag: 'picture',
|
|
271
271
|
attrs: { type: 'image' },
|
|
272
|
-
content:
|
|
272
|
+
content: preview
|
|
273
273
|
}
|
|
274
274
|
]
|
|
275
275
|
});
|
package/lib/Socket/groups.d.ts
CHANGED
|
@@ -68,6 +68,12 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
68
68
|
}[]>;
|
|
69
69
|
fetchStatus: (jid: string) => Promise<{
|
|
70
70
|
status: string | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* revoke a v4 invite for someone
|
|
73
|
+
* @param groupJid group jid
|
|
74
|
+
* @param invitedJid jid of person you invited
|
|
75
|
+
* @returns true if successful
|
|
76
|
+
*/
|
|
71
77
|
setAt: Date;
|
|
72
78
|
} | undefined>;
|
|
73
79
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
package/lib/Utils/generics.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export declare const printQRIfNecessaryListener: (ev: BaileysEventEmitter, logge
|
|
|
54
54
|
* utility that fetches latest baileys version from the main branch.
|
|
55
55
|
* Use to ensure your WA connection is always on the latest version
|
|
56
56
|
*/
|
|
57
|
-
export declare const
|
|
57
|
+
export declare const fetchLatestBaileysVersion: (options?: AxiosRequestConfig<any>) => Promise<{
|
|
58
58
|
version: number[];
|
|
59
59
|
isLatest: boolean;
|
|
60
60
|
error?: undefined;
|
|
@@ -67,7 +67,7 @@ export declare const fetchLatestBaileysVersion2: (options?: AxiosRequestConfig<a
|
|
|
67
67
|
* utility that fetches latest baileys version from the master branch.
|
|
68
68
|
* Use to ensure your WA connection is always on the latest version
|
|
69
69
|
*/
|
|
70
|
-
export declare const
|
|
70
|
+
export declare const fetchLatestBaileysVersion2: (options?: AxiosRequestConfig<any>) => Promise<{
|
|
71
71
|
version: WAVersion;
|
|
72
72
|
isLatest: boolean;
|
|
73
73
|
error?: undefined;
|
package/lib/Utils/generics.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.bytesToCrockford = exports.trimUndefined = exports.isWABusinessPlatform = exports.getCodeFromWSError = exports.getCallStatusFromNode = exports.getErrorCodeFromStreamError = exports.getStatusFromReceiptType = exports.generateMdTagPrefix = exports.fetchLatestWaWebVersion = exports.
|
|
6
|
+
exports.bytesToCrockford = exports.trimUndefined = exports.isWABusinessPlatform = exports.getCodeFromWSError = exports.getCallStatusFromNode = exports.getErrorCodeFromStreamError = exports.getStatusFromReceiptType = exports.generateMdTagPrefix = exports.fetchLatestWaWebVersion = exports.fetchLatestBaileysVersion2 = exports.fetchLatestBaileysVersion = exports.printQRIfNecessaryListener = exports.bindWaitForConnectionUpdate = exports.bindWaitForEvent = exports.generateMessageID = exports.generateMessageIDV3 = exports.generateMessageIDV2 = exports.promiseTimeout = exports.delayCancellable = exports.delay = exports.debouncedTimeout = exports.unixTimestampSeconds = exports.toNumber = exports.encodeBigEndian = exports.generateRegistrationId = exports.encodeNewsletterMessage = exports.encodeWAMessage = exports.unpadRandomMax16 = exports.writeRandomPadMax16 = exports.getKeyAuthor = exports.BufferJSON = exports.getPlatformId = exports.Browsers = void 0;
|
|
7
7
|
const boom_1 = require("@hapi/boom");
|
|
8
8
|
const axios_1 = __importDefault(require("axios"));
|
|
9
9
|
const crypto_1 = require("crypto");
|
|
@@ -241,7 +241,7 @@ exports.printQRIfNecessaryListener = printQRIfNecessaryListener;
|
|
|
241
241
|
* utility that fetches latest baileys version from the main branch.
|
|
242
242
|
* Use to ensure your WA connection is always on the latest version
|
|
243
243
|
*/
|
|
244
|
-
const
|
|
244
|
+
const fetchLatestBaileysVersion = async (options = {}) => {
|
|
245
245
|
try {
|
|
246
246
|
const result = await axios_1.default.get('https://raw.githubusercontent.com/wppconnect-team/wa-version/main/versions.json', {
|
|
247
247
|
...options,
|
|
@@ -262,12 +262,12 @@ const fetchLatestBaileysVersion2 = async (options = {}) => {
|
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
264
|
};
|
|
265
|
-
exports.
|
|
265
|
+
exports.fetchLatestBaileysVersion = fetchLatestBaileysVersion;
|
|
266
266
|
/**
|
|
267
267
|
* utility that fetches latest baileys version from the master branch.
|
|
268
268
|
* Use to ensure your WA connection is always on the latest version
|
|
269
269
|
*/
|
|
270
|
-
const
|
|
270
|
+
const fetchLatestBaileysVersion2 = async (options = {}) => {
|
|
271
271
|
const URL = 'https://raw.githubusercontent.com/WhiskeySockets/Baileys/master/src/Defaults/baileys-version.json';
|
|
272
272
|
try {
|
|
273
273
|
const result = await axios_1.default.get(URL, {
|
|
@@ -287,7 +287,7 @@ const fetchLatestBaileysVersion = async (options = {}) => {
|
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
289
|
};
|
|
290
|
-
exports.
|
|
290
|
+
exports.fetchLatestBaileysVersion2 = fetchLatestBaileysVersion2;
|
|
291
291
|
/**
|
|
292
292
|
* A utility that fetches the latest web version of whatsapp.
|
|
293
293
|
* Use to ensure your WA connection is always on the latest version
|
|
@@ -31,13 +31,6 @@ export declare const generateProfilePictureFP: (buffer: any) => Promise<{
|
|
|
31
31
|
img: any;
|
|
32
32
|
preview: any;
|
|
33
33
|
}>;
|
|
34
|
-
export declare const generateProfilePictureFull2: (img: any) => Promise<{
|
|
35
|
-
img: any;
|
|
36
|
-
}>;
|
|
37
|
-
export declare const generateProfilePictureFP2: (buffer: any) => Promise<{
|
|
38
|
-
img: any;
|
|
39
|
-
preview: any;
|
|
40
|
-
}>;
|
|
41
34
|
export declare const generatePP: (buffer: any) => Promise<{
|
|
42
35
|
img: any;
|
|
43
36
|
preview: any;
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.getStatusCodeForMediaRetry = exports.decryptMediaRetryData = exports.decodeMediaRetryNode = exports.encryptMediaRetryRequest = exports.getWAUploadToServer = exports.extensionForMediaMessage = exports.downloadEncryptedContent = exports.downloadContentFromMessage = exports.getUrlFromDirectPath = exports.encryptedStream = exports.prepareStream = exports.getHttpStream = exports.generateThumbnail = exports.getStream = exports.toBuffer = exports.toReadable = exports.getAudioWaveform = exports.getAudioDuration = exports.mediaMessageSHA256B64 = exports.changeprofileFull = exports.generatePP = exports.
|
|
29
|
+
exports.getStatusCodeForMediaRetry = exports.decryptMediaRetryData = exports.decodeMediaRetryNode = exports.encryptMediaRetryRequest = exports.getWAUploadToServer = exports.extensionForMediaMessage = exports.downloadEncryptedContent = exports.downloadContentFromMessage = exports.getUrlFromDirectPath = exports.encryptedStream = exports.prepareStream = exports.getHttpStream = exports.generateThumbnail = exports.getStream = exports.toBuffer = exports.toReadable = exports.getAudioWaveform = exports.getAudioDuration = exports.mediaMessageSHA256B64 = exports.changeprofileFull = exports.generatePP = exports.generateProfilePictureFP = exports.generateProfilePictureFull = exports.generateProfilePicture = exports.encodeBase64EncodedStringForUpload = exports.extractImageThumb = exports.getMediaKeys = exports.hkdfInfoKey = void 0;
|
|
30
30
|
const boom_1 = require("@hapi/boom");
|
|
31
31
|
const axios_1 = __importDefault(require("axios"));
|
|
32
32
|
const child_process_1 = require("child_process");
|
|
@@ -203,7 +203,7 @@ const generateProfilePictureFull = async (img) => {
|
|
|
203
203
|
hight = hight / ratio;
|
|
204
204
|
img = cropped.quality(100).resize(width, hight).getBufferAsync(MIME_JPEG);
|
|
205
205
|
return {
|
|
206
|
-
img: await
|
|
206
|
+
img: await cropped.quality(100).resize(width, hight).getBufferAsync(MIME_JPEG),
|
|
207
207
|
};
|
|
208
208
|
};
|
|
209
209
|
exports.generateProfilePictureFull = generateProfilePictureFull;
|
|
@@ -220,41 +220,6 @@ const generateProfilePictureFP = async (buffer) => {
|
|
|
220
220
|
};
|
|
221
221
|
};
|
|
222
222
|
exports.generateProfilePictureFP = generateProfilePictureFP;
|
|
223
|
-
const generateProfilePictureFull2 = async (img) => {
|
|
224
|
-
const Jimp = require('jimp');
|
|
225
|
-
const { read, MIME_JPEG, RESIZE_BILINEAR } = require('jimp');
|
|
226
|
-
const jimp = await read(img);
|
|
227
|
-
const min = Math.min(jimp.getWidth(), jimp.getHeight());
|
|
228
|
-
const cropped = jimp.crop(0, 0, jimp.getWidth(), jimp.getHeight());
|
|
229
|
-
let width = jimp.getWidth(), hight = jimp.getHeight(), ratio;
|
|
230
|
-
if (width > hight) {
|
|
231
|
-
ratio = jimp.getWidth() / 1280;
|
|
232
|
-
}
|
|
233
|
-
else {
|
|
234
|
-
ratio = jimp.getWidth() / 574;
|
|
235
|
-
}
|
|
236
|
-
;
|
|
237
|
-
width = width / ratio;
|
|
238
|
-
hight = hight / ratio;
|
|
239
|
-
img = cropped.quality(100).resize(width, hight).getBufferAsync(MIME_JPEG);
|
|
240
|
-
return {
|
|
241
|
-
img: await img
|
|
242
|
-
};
|
|
243
|
-
};
|
|
244
|
-
exports.generateProfilePictureFull2 = generateProfilePictureFull2;
|
|
245
|
-
const generateProfilePictureFP2 = async (buffer) => {
|
|
246
|
-
const Jimp = require('jimp');
|
|
247
|
-
const { read, MIME_JPEG, RESIZE_BILINEAR } = require('jimp');
|
|
248
|
-
const jimp = await Jimp.read(buffer);
|
|
249
|
-
const min = jimp.getWidth();
|
|
250
|
-
const max = jimp.getHeight();
|
|
251
|
-
const cropped = jimp.crop(0, 0, min, max);
|
|
252
|
-
return {
|
|
253
|
-
img: await cropped.scaleToFit(1280, 1280).getBufferAsync(Jimp.MIME_JPEG),
|
|
254
|
-
preview: await cropped.normalize().getBufferAsync(Jimp.MIME_JPEG),
|
|
255
|
-
};
|
|
256
|
-
};
|
|
257
|
-
exports.generateProfilePictureFP2 = generateProfilePictureFP2;
|
|
258
223
|
const generatePP = async (buffer) => {
|
|
259
224
|
const Jimp = require('jimp');
|
|
260
225
|
const { read, MIME_JPEG, RESIZE_BILINEAR } = require('jimp');
|
|
@@ -286,7 +251,7 @@ const changeprofileFull = async (img) => {
|
|
|
286
251
|
hight = hight / ratio;
|
|
287
252
|
img = cropped.quality(100).resize(width, hight).getBufferAsync(MIME_JPEG);
|
|
288
253
|
return {
|
|
289
|
-
img: await
|
|
254
|
+
img: await cropped.quality(100).resize(width, hight).getBufferAsync(MIME_JPEG),
|
|
290
255
|
};
|
|
291
256
|
};
|
|
292
257
|
exports.changeprofileFull = changeprofileFull;
|