@open-wa/wa-automate 4.71.9 → 4.71.11

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.
@@ -1913,6 +1913,23 @@ export declare class Client {
1913
1913
  * @returns `Promise<string | boolean>` returns status id if it worked, false if it didn't
1914
1914
  */
1915
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>;
1916
1933
  /**
1917
1934
  * {@license:restricted@}
1918
1935
  *
@@ -3595,7 +3595,7 @@ class Client {
3595
3595
  });
3596
3596
  }
3597
3597
  stickerServerRequest(func, a = {}, fallback = false) {
3598
- var _a, _b, _c, _d;
3598
+ var _a, _b, _c, _d, _e;
3599
3599
  return __awaiter(this, void 0, void 0, function* () {
3600
3600
  if (!this._createConfig.stickerServerEndpoint)
3601
3601
  return false;
@@ -3624,7 +3624,7 @@ class Client {
3624
3624
  a.stickerMetadata = Object.assign(Object.assign({}, (a.stickerMetadata || {})), { discord: `${((_b = a.stickerMetadata) === null || _b === void 0 ? void 0 : _b.discord) || this._createConfig.discord}` });
3625
3625
  }
3626
3626
  try {
3627
- const { data } = yield axios_1.default.post(`${((fallback ? pkg.stickerUrl : 'https://sticker-api.openwa.dev') || this._createConfig.stickerServerEndpoint).replace(/\/$/, '')}/${func}`, Object.assign(Object.assign({}, a), { sessionInfo, config: this.getConfig() }), {
3627
+ const { data } = yield axios_1.default.post(`${(((_c = this._createConfig) === null || _c === void 0 ? void 0 : _c.stickerServerEndpoint) || (fallback ? pkg.stickerUrl : 'https://sticker-api.openwa.dev')).replace(/\/$/, '')}/${func}`, Object.assign(Object.assign({}, a), { sessionInfo, config: this.getConfig() }), {
3628
3628
  maxBodyLength: 20000000,
3629
3629
  maxContentLength: 1500000 // 1.5mb response body limit
3630
3630
  });
@@ -3637,7 +3637,7 @@ class Client {
3637
3637
  else if (!fallback) {
3638
3638
  return yield this.stickerServerRequest(func, a, true);
3639
3639
  }
3640
- console.error((_c = err === null || err === void 0 ? void 0 : err.response) === null || _c === void 0 ? void 0 : _c.status, (_d = err === null || err === void 0 ? void 0 : err.response) === null || _d === void 0 ? void 0 : _d.data);
3640
+ console.error((_d = err === null || err === void 0 ? void 0 : err.response) === null || _d === void 0 ? void 0 : _d.status, (_e = err === null || err === void 0 ? void 0 : err.response) === null || _e === void 0 ? void 0 : _e.data);
3641
3641
  throw err;
3642
3642
  return false;
3643
3643
  }
@@ -3850,6 +3850,40 @@ class Client {
3850
3850
  return yield this.pup(({ text, textRgba, backgroundRgba, font }) => WAPI.postTextStatus(text, textRgba, backgroundRgba, font), { text, textRgba, backgroundRgba, font });
3851
3851
  });
3852
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
+ }
3853
3887
  /**
3854
3888
  * {@license:restricted@}
3855
3889
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate",
3
- "version": "4.71.9",
3
+ "version": "4.71.11",
4
4
  "licenseCheckUrl": "https://funcs.openwa.dev/license-check",
5
5
  "brokenMethodReportUrl": "https://funcs.openwa.dev/report-bm",
6
6
  "patches": "https://cdn.openwa.dev/patches.json",