@open-wa/wa-automate 4.71.13 → 4.71.15
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/bin/oas-type-schemas.json +1 -1
- package/dist/api/Client.d.ts +17 -12
- package/dist/api/Client.js +26 -32
- package/dist/controllers/initializer.js +1 -1
- package/dist/lib/launch.js +1 -1
- package/dist/lib/wapi.js +12 -4
- package/dist/structures/preProcessors.d.ts +2 -1
- package/package.json +2 -2
package/dist/api/Client.d.ts
CHANGED
@@ -701,7 +701,7 @@ export declare class Client {
|
|
701
701
|
* @param text The text you want to inslude in the message section. THIS HAS TO INCLUDE THE URL otherwise the url will be prepended to the text automatically.
|
702
702
|
* @param chatId The chat you want to send this message to.
|
703
703
|
* @param quotedMsgId [INSIDERS] Send this link preview message in response to a given quoted message
|
704
|
-
* @param customSize [INSIDERS] Anchor the size of the thumbnail
|
704
|
+
* @param customSize [INSIDERS] Anchor the size of the thumbnail
|
705
705
|
*/
|
706
706
|
sendMessageWithThumb(thumb: string, url: string, title: string, description: string, text: Content, chatId: ChatId, quotedMsgId?: MessageId, customSize?: {
|
707
707
|
height: number;
|
@@ -748,7 +748,7 @@ export declare class Client {
|
|
748
748
|
* @param text string Custom text as body of the message, this needs to include the link or it will be appended after the link.
|
749
749
|
* @param thumbnail string Base64 of the jpeg/png which will be used to override the automatically generated thumbnail.
|
750
750
|
* @param quotedMsgId [INSIDERS] Send this link preview message in response to a given quoted message
|
751
|
-
* @param customSize [INSIDERS] Anchor the size of the thumbnail
|
751
|
+
* @param customSize [INSIDERS] Anchor the size of the thumbnail
|
752
752
|
*/
|
753
753
|
sendYoutubeLink(to: ChatId, url: string, text?: Content, thumbnail?: Base64, quotedMsgId?: MessageId, customSize?: {
|
754
754
|
height: number;
|
@@ -761,7 +761,7 @@ export declare class Client {
|
|
761
761
|
* @param text string Custom text as body of the message, this needs to include the link or it will be appended after the link.
|
762
762
|
* @param thumbnail Base64 of the jpeg/png which will be used to override the automatically generated thumbnail.
|
763
763
|
* @param quotedMsgId [INSIDERS] Send this link preview message in response to a given quoted message
|
764
|
-
* @param customSize [INSIDERS] Anchor the size of the thumbnail
|
764
|
+
* @param customSize [INSIDERS] Anchor the size of the thumbnail
|
765
765
|
*/
|
766
766
|
sendLinkWithAutoPreview(to: ChatId, url: string, text?: Content, thumbnail?: Base64, quotedMsgId?: MessageId, customSize?: {
|
767
767
|
height: number;
|
@@ -1400,10 +1400,6 @@ export declare class Client {
|
|
1400
1400
|
*
|
1401
1401
|
* Retrieves the groups that you have in common with a contact
|
1402
1402
|
* @param contactId
|
1403
|
-
* @returns Promise returning an array of common groups {
|
1404
|
-
* id:string,
|
1405
|
-
* title:string
|
1406
|
-
* }
|
1407
1403
|
*/
|
1408
1404
|
getCommonGroups(contactId: ContactId): Promise<{
|
1409
1405
|
id: string;
|
@@ -1455,8 +1451,7 @@ export declare class Client {
|
|
1455
1451
|
loadEarlierMessages(contactId: ContactId): Promise<Message[]>;
|
1456
1452
|
/**
|
1457
1453
|
* Get the status of a contact
|
1458
|
-
* @param contactId
|
1459
|
-
* returns: {id: string,status: string}
|
1454
|
+
* @param contactId to '000000000000@c.us'
|
1460
1455
|
*/
|
1461
1456
|
getStatus(contactId: ContactId): Promise<{
|
1462
1457
|
id: string;
|
@@ -1474,8 +1469,18 @@ export declare class Client {
|
|
1474
1469
|
*
|
1475
1470
|
* Use a raw payload within your open-wa session
|
1476
1471
|
*
|
1472
|
+
* @example
|
1473
|
+
* If there is a code block, then both TypeDoc and VSCode will treat
|
1474
|
+
* text outside of the code block as regular text.
|
1475
|
+
*
|
1476
|
+
* ```ts
|
1477
|
+
* await B('44123456789@c.us', {
|
1478
|
+
* test: 1
|
1479
|
+
* })
|
1480
|
+
* ```
|
1481
|
+
* {@link loadAllEarlierMessages}
|
1477
1482
|
* @param chatId
|
1478
|
-
* @param payload
|
1483
|
+
* @param payload
|
1479
1484
|
* returns: MessageId
|
1480
1485
|
*/
|
1481
1486
|
B(chatId: ChatId, payload: {
|
@@ -1853,7 +1858,7 @@ export declare class Client {
|
|
1853
1858
|
*
|
1854
1859
|
* @param to ChatId The chat id you want to send the webp sticker to
|
1855
1860
|
* @param file [[DataURL]], [[Base64]], URL (string GET), Relative filepath (string), or Buffer of the mp4 file
|
1856
|
-
* @param messageId message id of the message you want this sticker to reply to.
|
1861
|
+
* @param messageId message id of the message you want this sticker to reply to. @license:insiders@
|
1857
1862
|
*/
|
1858
1863
|
sendMp4AsSticker(to: ChatId, file: DataURL | Buffer | Base64 | string, processOptions?: Mp4StickerConversionProcessOptions, stickerMetadata?: StickerMetadata, messageId?: MessageId): Promise<MessageId | string | boolean>;
|
1859
1864
|
/**
|
@@ -1861,7 +1866,7 @@ export declare class Client {
|
|
1861
1866
|
*
|
1862
1867
|
* @param to ChatId The chat id you want to send the webp sticker to
|
1863
1868
|
* @param emojiId The discord emoji id without indentifying chars. In discord you would write `:who:`, here use `who`
|
1864
|
-
* @param messageId message id of the message you want this sticker to reply to.
|
1869
|
+
* @param messageId message id of the message you want this sticker to reply to. @license:insiders@
|
1865
1870
|
*/
|
1866
1871
|
sendEmoji(to: ChatId, emojiId: string, messageId?: MessageId): Promise<MessageId | boolean | string>;
|
1867
1872
|
/**
|
package/dist/api/Client.js
CHANGED
@@ -287,7 +287,6 @@ class Client {
|
|
287
287
|
this._sessionInfo = sessionInfo;
|
288
288
|
this._sessionInfo.INSTANCE_ID = (0, uuid_1.v4)();
|
289
289
|
this._listeners = {};
|
290
|
-
// if(this._createConfig.stickerServerEndpoint!== false) this._createConfig.stickerServerEndpoint = true;
|
291
290
|
this._setOnClose();
|
292
291
|
}
|
293
292
|
/**
|
@@ -1714,7 +1713,7 @@ class Client {
|
|
1714
1713
|
* @param text The text you want to inslude in the message section. THIS HAS TO INCLUDE THE URL otherwise the url will be prepended to the text automatically.
|
1715
1714
|
* @param chatId The chat you want to send this message to.
|
1716
1715
|
* @param quotedMsgId [INSIDERS] Send this link preview message in response to a given quoted message
|
1717
|
-
* @param customSize [INSIDERS] Anchor the size of the thumbnail
|
1716
|
+
* @param customSize [INSIDERS] Anchor the size of the thumbnail
|
1718
1717
|
*/
|
1719
1718
|
sendMessageWithThumb(thumb, url, title, description, text, chatId, quotedMsgId, customSize) {
|
1720
1719
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -1842,7 +1841,7 @@ class Client {
|
|
1842
1841
|
* @param text string Custom text as body of the message, this needs to include the link or it will be appended after the link.
|
1843
1842
|
* @param thumbnail string Base64 of the jpeg/png which will be used to override the automatically generated thumbnail.
|
1844
1843
|
* @param quotedMsgId [INSIDERS] Send this link preview message in response to a given quoted message
|
1845
|
-
* @param customSize [INSIDERS] Anchor the size of the thumbnail
|
1844
|
+
* @param customSize [INSIDERS] Anchor the size of the thumbnail
|
1846
1845
|
*/
|
1847
1846
|
sendYoutubeLink(to, url, text = '', thumbnail, quotedMsgId, customSize) {
|
1848
1847
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -1856,7 +1855,7 @@ class Client {
|
|
1856
1855
|
* @param text string Custom text as body of the message, this needs to include the link or it will be appended after the link.
|
1857
1856
|
* @param thumbnail Base64 of the jpeg/png which will be used to override the automatically generated thumbnail.
|
1858
1857
|
* @param quotedMsgId [INSIDERS] Send this link preview message in response to a given quoted message
|
1859
|
-
* @param customSize [INSIDERS] Anchor the size of the thumbnail
|
1858
|
+
* @param customSize [INSIDERS] Anchor the size of the thumbnail
|
1860
1859
|
*/
|
1861
1860
|
sendLinkWithAutoPreview(to, url, text, thumbnail, quotedMsgId, customSize) {
|
1862
1861
|
var _a;
|
@@ -2901,10 +2900,6 @@ class Client {
|
|
2901
2900
|
*
|
2902
2901
|
* Retrieves the groups that you have in common with a contact
|
2903
2902
|
* @param contactId
|
2904
|
-
* @returns Promise returning an array of common groups {
|
2905
|
-
* id:string,
|
2906
|
-
* title:string
|
2907
|
-
* }
|
2908
2903
|
*/
|
2909
2904
|
getCommonGroups(contactId) {
|
2910
2905
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -2985,8 +2980,7 @@ class Client {
|
|
2985
2980
|
}
|
2986
2981
|
/**
|
2987
2982
|
* Get the status of a contact
|
2988
|
-
* @param contactId
|
2989
|
-
* returns: {id: string,status: string}
|
2983
|
+
* @param contactId to '000000000000@c.us'
|
2990
2984
|
*/
|
2991
2985
|
getStatus(contactId) {
|
2992
2986
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -3005,8 +2999,18 @@ class Client {
|
|
3005
2999
|
*
|
3006
3000
|
* Use a raw payload within your open-wa session
|
3007
3001
|
*
|
3002
|
+
* @example
|
3003
|
+
* If there is a code block, then both TypeDoc and VSCode will treat
|
3004
|
+
* text outside of the code block as regular text.
|
3005
|
+
*
|
3006
|
+
* ```ts
|
3007
|
+
* await B('44123456789@c.us', {
|
3008
|
+
* test: 1
|
3009
|
+
* })
|
3010
|
+
* ```
|
3011
|
+
* {@link loadAllEarlierMessages}
|
3008
3012
|
* @param chatId
|
3009
|
-
* @param payload
|
3013
|
+
* @param payload
|
3010
3014
|
* returns: MessageId
|
3011
3015
|
*/
|
3012
3016
|
B(chatId, payload) {
|
@@ -3276,11 +3280,9 @@ class Client {
|
|
3276
3280
|
const mimeInfo = (0, tools_1.base64MimeType)(image);
|
3277
3281
|
if (!mimeInfo || mimeInfo.includes("image")) {
|
3278
3282
|
let imgData;
|
3279
|
-
|
3280
|
-
|
3281
|
-
|
3282
|
-
});
|
3283
|
-
}
|
3283
|
+
imgData = yield this.stickerServerRequest('convertGroupIcon', {
|
3284
|
+
image
|
3285
|
+
});
|
3284
3286
|
return yield this.pup(({ groupId, imgData }) => WAPI.setGroupIcon(groupId, imgData), { groupId, imgData });
|
3285
3287
|
}
|
3286
3288
|
});
|
@@ -3596,7 +3598,7 @@ class Client {
|
|
3596
3598
|
stickerServerRequest(func, a = {}, fallback = false) {
|
3597
3599
|
var _a, _b, _c, _d;
|
3598
3600
|
return __awaiter(this, void 0, void 0, function* () {
|
3599
|
-
const stickerUrl = this._createConfig.stickerServerEndpoint || (fallback ? pkg.stickerUrl : "https://sticker-api.openwa.dev");
|
3601
|
+
const stickerUrl = this._createConfig.stickerServerEndpoint || (fallback ? pkg.stickerUrl : "https://sticker-api.openwa.dev") || "https://sticker-api.openwa.dev";
|
3600
3602
|
if (func === 'convertMp4BufferToWebpDataUrl')
|
3601
3603
|
fallback = true;
|
3602
3604
|
const sessionInfo = this.getSessionInfo();
|
@@ -3654,15 +3656,10 @@ class Client {
|
|
3654
3656
|
console.error("Not an image. Please use convertMp4BufferToWebpDataUrl to process video stickers");
|
3655
3657
|
return false;
|
3656
3658
|
}
|
3657
|
-
// if(this._createConfig.stickerServerEndpoint) {
|
3658
3659
|
return yield this.stickerServerRequest('prepareWebp', {
|
3659
3660
|
image,
|
3660
3661
|
stickerMetadata
|
3661
3662
|
});
|
3662
|
-
// } else {
|
3663
|
-
// log.error("config.stickerServerEndpoint is missing")
|
3664
|
-
// return false
|
3665
|
-
// }
|
3666
3663
|
});
|
3667
3664
|
}
|
3668
3665
|
/**
|
@@ -3705,7 +3702,7 @@ class Client {
|
|
3705
3702
|
*
|
3706
3703
|
* @param to ChatId The chat id you want to send the webp sticker to
|
3707
3704
|
* @param file [[DataURL]], [[Base64]], URL (string GET), Relative filepath (string), or Buffer of the mp4 file
|
3708
|
-
* @param messageId message id of the message you want this sticker to reply to.
|
3705
|
+
* @param messageId message id of the message you want this sticker to reply to. @license:insiders@
|
3709
3706
|
*/
|
3710
3707
|
sendMp4AsSticker(to, file, processOptions = media_1.defaultProcessOptions, stickerMetadata, messageId) {
|
3711
3708
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -3729,14 +3726,11 @@ class Client {
|
|
3729
3726
|
}
|
3730
3727
|
}
|
3731
3728
|
}
|
3732
|
-
|
3733
|
-
|
3734
|
-
|
3735
|
-
|
3736
|
-
|
3737
|
-
stickerMetadata
|
3738
|
-
});
|
3739
|
-
}
|
3729
|
+
const convertedStickerDataUrl = yield this.stickerServerRequest('convertMp4BufferToWebpDataUrl', {
|
3730
|
+
file,
|
3731
|
+
processOptions,
|
3732
|
+
stickerMetadata
|
3733
|
+
});
|
3740
3734
|
try {
|
3741
3735
|
if (!convertedStickerDataUrl)
|
3742
3736
|
return false;
|
@@ -3755,7 +3749,7 @@ class Client {
|
|
3755
3749
|
*
|
3756
3750
|
* @param to ChatId The chat id you want to send the webp sticker to
|
3757
3751
|
* @param emojiId The discord emoji id without indentifying chars. In discord you would write `:who:`, here use `who`
|
3758
|
-
* @param messageId message id of the message you want this sticker to reply to.
|
3752
|
+
* @param messageId message id of the message you want this sticker to reply to. @license:insiders@
|
3759
3753
|
*/
|
3760
3754
|
sendEmoji(to, emojiId, messageId) {
|
3761
3755
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -438,7 +438,7 @@ function create(config = {}) {
|
|
438
438
|
spinner.emit(debugInfo, "DebugInfo");
|
439
439
|
//@ts-ignore
|
440
440
|
const metrics = yield waPage.evaluate(({ config }) => WAPI.launchMetrics(config), { config });
|
441
|
-
const purgedMessage = (metrics === null || metrics === void 0 ? void 0 : metrics.purged) ? Object.entries(metrics.purged).filter(([, e]) => e > 0).map(([k, e]) => `${e} ${k}`).join(" and ") : "";
|
441
|
+
const purgedMessage = (metrics === null || metrics === void 0 ? void 0 : metrics.purged) ? Object.entries(metrics.purged).filter(([, e]) => Number(e) > 0).map(([k, e]) => `${e} ${k}`).join(" and ") : "";
|
442
442
|
if (metrics.isMd && !(config === null || config === void 0 ? void 0 : config.multiDevice))
|
443
443
|
spinner.info("!!!Please set multiDevice: true in the config or use the --mutli-Device flag!!!");
|
444
444
|
spinner.succeed(`Client loaded for ${metrics.isBiz ? "business" : "normal"} account ${metrics.isMd && "[MD] " || ''}with ${metrics.contacts} contacts, ${metrics.chats} chats & ${metrics.messages} messages ${purgedMessage ? `+ purged ${purgedMessage} ` : ``}in ${LAUNCH_TIME_MS / 1000}s`);
|