@open-wa/wa-automate 4.71.11 → 4.71.12
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.js +16 -13
- package/package.json +1 -1
package/dist/api/Client.js
CHANGED
@@ -287,8 +287,7 @@ class Client {
|
|
287
287
|
this._sessionInfo = sessionInfo;
|
288
288
|
this._sessionInfo.INSTANCE_ID = (0, uuid_1.v4)();
|
289
289
|
this._listeners = {};
|
290
|
-
if
|
291
|
-
this._createConfig.stickerServerEndpoint = true;
|
290
|
+
// if(this._createConfig.stickerServerEndpoint!== false) this._createConfig.stickerServerEndpoint = true;
|
292
291
|
this._setOnClose();
|
293
292
|
}
|
294
293
|
/**
|
@@ -3595,10 +3594,9 @@ class Client {
|
|
3595
3594
|
});
|
3596
3595
|
}
|
3597
3596
|
stickerServerRequest(func, a = {}, fallback = false) {
|
3598
|
-
var _a, _b, _c, _d
|
3597
|
+
var _a, _b, _c, _d;
|
3599
3598
|
return __awaiter(this, void 0, void 0, function* () {
|
3600
|
-
|
3601
|
-
return false;
|
3599
|
+
const stickerUrl = this._createConfig.stickerServerEndpoint || (fallback ? pkg.stickerUrl : "https://sticker-api.openwa.dev");
|
3602
3600
|
if (func === 'convertMp4BufferToWebpDataUrl')
|
3603
3601
|
fallback = true;
|
3604
3602
|
const sessionInfo = this.getSessionInfo();
|
@@ -3624,7 +3622,9 @@ class Client {
|
|
3624
3622
|
a.stickerMetadata = Object.assign(Object.assign({}, (a.stickerMetadata || {})), { discord: `${((_b = a.stickerMetadata) === null || _b === void 0 ? void 0 : _b.discord) || this._createConfig.discord}` });
|
3625
3623
|
}
|
3626
3624
|
try {
|
3627
|
-
const
|
3625
|
+
const url = `${stickerUrl.replace(/\/$/, '')}/${func}`;
|
3626
|
+
logging_1.log.info(`Requesting sticker from ${url}`);
|
3627
|
+
const { data } = yield axios_1.default.post(url, 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((
|
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);
|
3641
3641
|
throw err;
|
3642
3642
|
return false;
|
3643
3643
|
}
|
@@ -3654,12 +3654,15 @@ class Client {
|
|
3654
3654
|
console.error("Not an image. Please use convertMp4BufferToWebpDataUrl to process video stickers");
|
3655
3655
|
return false;
|
3656
3656
|
}
|
3657
|
-
if
|
3658
|
-
|
3659
|
-
|
3660
|
-
|
3661
|
-
|
3662
|
-
}
|
3657
|
+
// if(this._createConfig.stickerServerEndpoint) {
|
3658
|
+
return yield this.stickerServerRequest('prepareWebp', {
|
3659
|
+
image,
|
3660
|
+
stickerMetadata
|
3661
|
+
});
|
3662
|
+
// } else {
|
3663
|
+
// log.error("config.stickerServerEndpoint is missing")
|
3664
|
+
// return false
|
3665
|
+
// }
|
3663
3666
|
});
|
3664
3667
|
}
|
3665
3668
|
/**
|
package/package.json
CHANGED