@@ -1167,14 +1167,19 @@ export class WAStartupService {
11671167 imagePath = `${ join ( process . cwd ( ) , 'temp' , 'temp-sticker.png' ) } ` ;
11681168 await sharp ( imageBuffer ) . toFile ( imagePath ) ;
11691169 } else {
1170- const response = await axios . get ( image , { responseType : 'arraybuffer' } ) ;
1170+ const timestamp = new Date ( ) . getTime ( ) ;
1171+ const url = `${ image } ?timestamp=${ timestamp } ` ;
1172+
1173+ const response = await axios . get ( url , { responseType : 'arraybuffer' } ) ;
11711174 const imageBuffer = Buffer . from ( response . data , 'binary' ) ;
11721175 imagePath = `${ join ( process . cwd ( ) , 'temp' , 'temp-sticker.png' ) } ` ;
11731176 await sharp ( imageBuffer ) . toFile ( imagePath ) ;
11741177 }
11751178
11761179 await sharp ( imagePath ) . webp ( ) . toFile ( outputPath ) ;
11771180
1181+ fs . unlinkSync ( imagePath ) ;
1182+
11781183 return outputPath ;
11791184 } catch ( error ) {
11801185 console . error ( 'Erro ao converter a imagem para WebP:' , error ) ;
@@ -1183,13 +1188,17 @@ export class WAStartupService {
11831188
11841189 public async mediaSticker ( data : SendStickerDto ) {
11851190 const convert = await this . convertToWebP ( data . stickerMessage . image ) ;
1186- return await this . sendMessageWithTyping (
1191+ const result = await this . sendMessageWithTyping (
11871192 data . number ,
11881193 {
11891194 sticker : { url : convert } ,
11901195 } ,
11911196 data ?. options ,
11921197 ) ;
1198+
1199+ fs . unlinkSync ( convert ) ;
1200+
1201+ return result ;
11931202 }
11941203
11951204 public async mediaMessage ( data : SendMediaDto ) {
@@ -1225,7 +1234,6 @@ export class WAStartupService {
12251234
12261235 return new Promise ( ( resolve , reject ) => {
12271236 exec (
1228- // `${ffmpegPath.path} -i ${tempAudioPath} -c:a libopus ${outputAudio} -y`,
12291237 `${ ffmpegPath . path } -i ${ tempAudioPath } -vn -ab 128k -ar 44100 -f ipod ${ outputAudio } -y` ,
12301238 ( error , _stdout , _stderr ) => {
12311239 fs . unlinkSync ( tempAudioPath ) ;
@@ -1245,7 +1253,6 @@ export class WAStartupService {
12451253 {
12461254 audio : Buffer . from ( audio , 'base64' ) ,
12471255 ptt : true ,
1248- // mimetype: 'audio/ogg; codecs=opus',
12491256 mimetype : 'audio/mp4' ,
12501257 } ,
12511258 { presence : 'recording' , delay : data ?. options ?. delay } ,
0 commit comments