@open-wa/wa-automate 4.71.6 → 4.71.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/api/Client.d.ts +18 -4
- package/dist/api/Client.js +16 -9
- package/dist/controllers/browser.js +8 -2
- package/package.json +1 -1
package/dist/api/Client.d.ts
CHANGED
@@ -700,9 +700,13 @@ export declare class Client {
|
|
700
700
|
* @param description The long description of the link preview
|
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 (e.g {height: 100, width: 100})
|
704
705
|
*/
|
705
|
-
sendMessageWithThumb(thumb: string, url: string, title: string, description: string, text: Content, chatId: ChatId
|
706
|
+
sendMessageWithThumb(thumb: string, url: string, title: string, description: string, text: Content, chatId: ChatId, quotedMsgId?: MessageId, customSize?: {
|
707
|
+
height: number;
|
708
|
+
width: number;
|
709
|
+
}): Promise<MessageId | boolean>;
|
706
710
|
/**
|
707
711
|
* Note: `address` and `url` are parameters available to insiders only.
|
708
712
|
*
|
@@ -743,16 +747,26 @@ export declare class Client {
|
|
743
747
|
* @param url string A youtube link.
|
744
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.
|
745
749
|
* @param thumbnail string Base64 of the jpeg/png which will be used to override the automatically generated thumbnail.
|
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 (e.g {height: 100, width: 100})
|
746
752
|
*/
|
747
|
-
sendYoutubeLink(to: ChatId, url: string, text?: Content, thumbnail?: Base64
|
753
|
+
sendYoutubeLink(to: ChatId, url: string, text?: Content, thumbnail?: Base64, quotedMsgId?: MessageId, customSize?: {
|
754
|
+
height: number;
|
755
|
+
width: number;
|
756
|
+
}): Promise<boolean | MessageId>;
|
748
757
|
/**
|
749
758
|
* Automatically sends a link with the auto generated link preview. You can also add a custom message.
|
750
759
|
* @param chatId
|
751
760
|
* @param url string A link.
|
752
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.
|
753
762
|
* @param thumbnail Base64 of the jpeg/png which will be used to override the automatically generated thumbnail.
|
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 (e.g {height: 100, width: 100})
|
754
765
|
*/
|
755
|
-
sendLinkWithAutoPreview(to: ChatId, url: string, text?: Content, thumbnail?: Base64
|
766
|
+
sendLinkWithAutoPreview(to: ChatId, url: string, text?: Content, thumbnail?: Base64, quotedMsgId?: MessageId, customSize?: {
|
767
|
+
height: number;
|
768
|
+
width: number;
|
769
|
+
}): Promise<boolean | MessageId>;
|
756
770
|
/**
|
757
771
|
*
|
758
772
|
* Sends a reply to a given message. Please note, you need to have at least sent one normal message to a contact in order for this to work properly.
|
package/dist/api/Client.js
CHANGED
@@ -1714,19 +1714,22 @@ class Client {
|
|
1714
1714
|
* @param description The long description of the link preview
|
1715
1715
|
* @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.
|
1716
1716
|
* @param chatId The chat you want to send this message to.
|
1717
|
-
*
|
1717
|
+
* @param quotedMsgId [INSIDERS] Send this link preview message in response to a given quoted message
|
1718
|
+
* @param customSize [INSIDERS] Anchor the size of the thumbnail (e.g {height: 100, width: 100})
|
1718
1719
|
*/
|
1719
|
-
sendMessageWithThumb(thumb, url, title, description, text, chatId) {
|
1720
|
+
sendMessageWithThumb(thumb, url, title, description, text, chatId, quotedMsgId, customSize) {
|
1720
1721
|
return __awaiter(this, void 0, void 0, function* () {
|
1721
|
-
return yield this.pup(({ thumb, url, title, description, text, chatId }) => {
|
1722
|
-
WAPI.sendMessageWithThumb(thumb, url, title, description, text, chatId);
|
1722
|
+
return yield this.pup(({ thumb, url, title, description, text, chatId, quotedMsgId, customSize }) => {
|
1723
|
+
WAPI.sendMessageWithThumb(thumb, url, title, description, text, chatId, quotedMsgId, customSize);
|
1723
1724
|
}, {
|
1724
1725
|
thumb,
|
1725
1726
|
url,
|
1726
1727
|
title,
|
1727
1728
|
description,
|
1728
1729
|
text,
|
1729
|
-
chatId
|
1730
|
+
chatId,
|
1731
|
+
quotedMsgId,
|
1732
|
+
customSize
|
1730
1733
|
});
|
1731
1734
|
});
|
1732
1735
|
}
|
@@ -1839,10 +1842,12 @@ class Client {
|
|
1839
1842
|
* @param url string A youtube link.
|
1840
1843
|
* @param text string Custom text as body of the message, this needs to include the link or it will be appended after the link.
|
1841
1844
|
* @param thumbnail string Base64 of the jpeg/png which will be used to override the automatically generated thumbnail.
|
1845
|
+
* @param quotedMsgId [INSIDERS] Send this link preview message in response to a given quoted message
|
1846
|
+
* @param customSize [INSIDERS] Anchor the size of the thumbnail (e.g {height: 100, width: 100})
|
1842
1847
|
*/
|
1843
|
-
sendYoutubeLink(to, url, text = '', thumbnail) {
|
1848
|
+
sendYoutubeLink(to, url, text = '', thumbnail, quotedMsgId, customSize) {
|
1844
1849
|
return __awaiter(this, void 0, void 0, function* () {
|
1845
|
-
return this.sendLinkWithAutoPreview(to, url, text, thumbnail);
|
1850
|
+
return this.sendLinkWithAutoPreview(to, url, text, thumbnail, quotedMsgId, customSize);
|
1846
1851
|
});
|
1847
1852
|
}
|
1848
1853
|
/**
|
@@ -1851,8 +1856,10 @@ class Client {
|
|
1851
1856
|
* @param url string A link.
|
1852
1857
|
* @param text string Custom text as body of the message, this needs to include the link or it will be appended after the link.
|
1853
1858
|
* @param thumbnail Base64 of the jpeg/png which will be used to override the automatically generated thumbnail.
|
1859
|
+
* @param quotedMsgId [INSIDERS] Send this link preview message in response to a given quoted message
|
1860
|
+
* @param customSize [INSIDERS] Anchor the size of the thumbnail (e.g {height: 100, width: 100})
|
1854
1861
|
*/
|
1855
|
-
sendLinkWithAutoPreview(to, url, text, thumbnail) {
|
1862
|
+
sendLinkWithAutoPreview(to, url, text, thumbnail, quotedMsgId, customSize) {
|
1856
1863
|
var _a;
|
1857
1864
|
return __awaiter(this, void 0, void 0, function* () {
|
1858
1865
|
let linkData;
|
@@ -1867,7 +1874,7 @@ class Client {
|
|
1867
1874
|
console.error(error);
|
1868
1875
|
}
|
1869
1876
|
if (linkData && (thumbnail || thumb))
|
1870
|
-
return yield this.sendMessageWithThumb(thumbnail || thumb, url, linkData.title, linkData.description, text, to);
|
1877
|
+
return yield this.sendMessageWithThumb(thumbnail || thumb, url, linkData.title, linkData.description, text, to, quotedMsgId, customSize);
|
1871
1878
|
else
|
1872
1879
|
return yield this.pup(({ to, url, text, thumbnail }) => WAPI.sendLinkWithAutoPreview(to, url, text, thumbnail), { to, url, text, thumbnail });
|
1873
1880
|
});
|
@@ -100,8 +100,14 @@ function initPage(sessionId, config, qrManager, customUserAgent, spinner, _page,
|
|
100
100
|
// const content = await frame.content() //not using content right now so save some ms by commenting out
|
101
101
|
logging_1.log.info(`FRAME NAV DETECTED, ${frame.url()}, Reinjecting APIs...`);
|
102
102
|
// there's no more webpack so reinject anyways
|
103
|
-
|
104
|
-
|
103
|
+
const hasWapi = yield waPage.evaluate("window.WAPI ? true : false");
|
104
|
+
if (!hasWapi) {
|
105
|
+
logging_1.log.info("FN: WAPI missing. Reinjecting APIs...");
|
106
|
+
frameNavPromises.push(injectApi(waPage, spinner, true));
|
107
|
+
frameNavPromises.push(qrManager.waitFirstQr(waPage, config, spinner));
|
108
|
+
}
|
109
|
+
else
|
110
|
+
logging_1.log.info("FN: WAPI intact. Skipping reinjection...");
|
105
111
|
if (frame.url().includes('post_logout=1')) {
|
106
112
|
console.log("Session most likely logged out");
|
107
113
|
}
|
package/package.json
CHANGED