@open-wa/wa-automate 4.71.8 → 4.71.10
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/dist/api/Client.d.ts +35 -4
- package/dist/api/Client.js +50 -9
- 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.
|
@@ -1899,6 +1913,23 @@ export declare class Client {
|
|
1899
1913
|
* @returns `Promise<string | boolean>` returns status id if it worked, false if it didn't
|
1900
1914
|
*/
|
1901
1915
|
postTextStatus(text: Content, textRgba: string, backgroundRgba: string, font: number): Promise<MessageId | string | boolean>;
|
1916
|
+
/**
|
1917
|
+
* {@license:restricted@}
|
1918
|
+
*
|
1919
|
+
* Sends a formatted text story with a thumbnail.
|
1920
|
+
* @param url The URL to share in the story
|
1921
|
+
* @param text The text to be displayed in the story
|
1922
|
+
* @param textRgba The colour of the text in the story in hex format, make sure to add the alpha value also. E.g "#FF00F4F2"
|
1923
|
+
* @param backgroundRgba The colour of the background in the story in hex format, make sure to add the alpha value also. E.g "#4FF31FF2"
|
1924
|
+
* @param font The font of the text to be used in the story. This has to be a number. Each number refers to a specific predetermined font. Here are the fonts you can choose from:
|
1925
|
+
* @param thumbnail base64 thumbnail override, if not provided the link server will try to figure it out.
|
1926
|
+
* 0: Sans Serif
|
1927
|
+
* 1: Serif
|
1928
|
+
* 2: [Norican Regular](https://fonts.google.com/specimen/Norican)
|
1929
|
+
* 3: [Bryndan Write](https://www.dafontfree.net/freefonts-bryndan-write-f160189.htm)
|
1930
|
+
* @returns `Promise<MessageId>` returns status id if it worked, false if it didn't
|
1931
|
+
*/
|
1932
|
+
postThumbnailStatus(url: string, text: Content, textRgba: string, backgroundRgba: string, font: number, thumbnail?: Base64): Promise<MessageId>;
|
1902
1933
|
/**
|
1903
1934
|
* {@license:restricted@}
|
1904
1935
|
*
|
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
|
});
|
@@ -3843,6 +3850,40 @@ class Client {
|
|
3843
3850
|
return yield this.pup(({ text, textRgba, backgroundRgba, font }) => WAPI.postTextStatus(text, textRgba, backgroundRgba, font), { text, textRgba, backgroundRgba, font });
|
3844
3851
|
});
|
3845
3852
|
}
|
3853
|
+
/**
|
3854
|
+
* {@license:restricted@}
|
3855
|
+
*
|
3856
|
+
* Sends a formatted text story with a thumbnail.
|
3857
|
+
* @param url The URL to share in the story
|
3858
|
+
* @param text The text to be displayed in the story
|
3859
|
+
* @param textRgba The colour of the text in the story in hex format, make sure to add the alpha value also. E.g "#FF00F4F2"
|
3860
|
+
* @param backgroundRgba The colour of the background in the story in hex format, make sure to add the alpha value also. E.g "#4FF31FF2"
|
3861
|
+
* @param font The font of the text to be used in the story. This has to be a number. Each number refers to a specific predetermined font. Here are the fonts you can choose from:
|
3862
|
+
* @param thumbnail base64 thumbnail override, if not provided the link server will try to figure it out.
|
3863
|
+
* 0: Sans Serif
|
3864
|
+
* 1: Serif
|
3865
|
+
* 2: [Norican Regular](https://fonts.google.com/specimen/Norican)
|
3866
|
+
* 3: [Bryndan Write](https://www.dafontfree.net/freefonts-bryndan-write-f160189.htm)
|
3867
|
+
* @returns `Promise<MessageId>` returns status id if it worked, false if it didn't
|
3868
|
+
*/
|
3869
|
+
postThumbnailStatus(url, text, textRgba, backgroundRgba, font, thumbnail) {
|
3870
|
+
var _a;
|
3871
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3872
|
+
let linkData;
|
3873
|
+
let thumb = thumbnail;
|
3874
|
+
try {
|
3875
|
+
linkData = (yield axios_1.default.get(`${((_a = this._createConfig) === null || _a === void 0 ? void 0 : _a.linkParser) || "https://link.openwa.cloud/api"}?url=${url}`)).data;
|
3876
|
+
logging_1.log.info("Got link data");
|
3877
|
+
if (!thumbnail)
|
3878
|
+
thumb = yield (0, tools_1.getDUrl)(linkData.image);
|
3879
|
+
}
|
3880
|
+
catch (error) {
|
3881
|
+
console.error(error);
|
3882
|
+
}
|
3883
|
+
const { title, description } = linkData;
|
3884
|
+
return yield this.pup(({ thumb, url, title, description, text, textRgba, backgroundRgba, font }) => WAPI.sendStoryWithThumb(thumb, url, title, description, text, textRgba, backgroundRgba, font), { thumb, url, title, description, text, textRgba, backgroundRgba, font });
|
3885
|
+
});
|
3886
|
+
}
|
3846
3887
|
/**
|
3847
3888
|
* {@license:restricted@}
|
3848
3889
|
*
|
package/package.json
CHANGED