Skip to content

Commit 0ec9214

Browse files
committed
🐛 fix custom sticker endpoint issue #3215
1 parent 6e10622 commit 0ec9214

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/api/Client.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ export class Client {
355355
this._sessionInfo = sessionInfo;
356356
this._sessionInfo.INSTANCE_ID = uuidv4();
357357
this._listeners = {};
358-
if(this._createConfig.stickerServerEndpoint!== false) this._createConfig.stickerServerEndpoint = true;
358+
// if(this._createConfig.stickerServerEndpoint!== false) this._createConfig.stickerServerEndpoint = true;
359359
this._setOnClose();
360360
}
361361

@@ -3982,7 +3982,7 @@ public async getStatus(contactId: ContactId) : Promise<{
39823982
}
39833983

39843984
private async stickerServerRequest(func: string, a : any = {}, fallback = false){
3985-
if(!this._createConfig.stickerServerEndpoint) return false;
3985+
const stickerUrl =this._createConfig.stickerServerEndpoint || (fallback ? pkg.stickerUrl : "https://sticker-api.openwa.dev")
39863986
if(func === 'convertMp4BufferToWebpDataUrl') fallback = true;
39873987
const sessionInfo = this.getSessionInfo()
39883988
sessionInfo.WA_AUTOMATE_VERSION = sessionInfo.WA_AUTOMATE_VERSION.split(' ')[0]
@@ -4008,7 +4008,9 @@ public async getStatus(contactId: ContactId) : Promise<{
40084008
}
40094009
}
40104010
try {
4011-
const {data} = await axios.post(`${(this._createConfig?.stickerServerEndpoint || (fallback ? pkg.stickerUrl : 'https://sticker-api.openwa.dev')).replace(/\/$/, '')}/${func}`, {
4011+
const url = `${stickerUrl.replace(/\/$/, '')}/${func}`
4012+
log.info(`Requesting sticker from ${url}`)
4013+
const {data} = await axios.post(url, {
40124014
...a,
40134015
sessionInfo,
40144016
config: this.getConfig()
@@ -4038,13 +4040,15 @@ public async getStatus(contactId: ContactId) : Promise<{
40384040
console.error("Not an image. Please use convertMp4BufferToWebpDataUrl to process video stickers");
40394041
return false
40404042
}
4041-
if(this._createConfig.stickerServerEndpoint) {
4043+
// if(this._createConfig.stickerServerEndpoint) {
40424044
return await this.stickerServerRequest('prepareWebp', {
40434045
image,
40444046
stickerMetadata
40454047
})
4046-
}
4047-
4048+
// } else {
4049+
// log.error("config.stickerServerEndpoint is missing")
4050+
// return false
4051+
// }
40484052
}
40494053

40504054
/**

0 commit comments

Comments
 (0)