Skip to content

Commit

Permalink
tahu
Browse files Browse the repository at this point in the history
  • Loading branch information
LoL-Human committed Aug 6, 2021
1 parent 338593c commit f7fe3b4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"license": "ISC",
"dependencies": {
"@adiwajshing/baileys": "^3.5.0",
"@adiwajshing/baileys": "^3.5.1",
"async": "^3.2.0",
"axios": "^0.21.1",
"cfonts": "^2.9.0",
Expand Down
32 changes: 17 additions & 15 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -1850,22 +1850,24 @@ async function starts() {
if ((isMedia && !lol.message.videoMessage || isQuotedImage) && args.length == 0) {
const encmedia = isQuotedImage ? JSON.parse(JSON.stringify(lol).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : lol
filePath = await lolhuman.downloadAndSaveMediaMessage(encmedia)
file_name = getRandom('.webp')
request({
url: `https://api.lolhuman.xyz/api/convert/towebp?apikey=${apikey}`,
method: 'POST',
formData: {
"img": fs.createReadStream(filePath)
},
encoding: "binary"
}, function(error, response, body) {
fs.unlinkSync(filePath)
fs.writeFileSync(file_name, body, "binary")
ini_buff = fs.readFileSync(file_name)
lolhuman.sendMessage(from, ini_buff, sticker, { quoted: lol }).then(() => {
fs.unlinkSync(file_name)
var filename = './temp/' + getRandomExt()
var filepath = await lolhuman.downloadAndSaveMediaMessage(media, filename)
var randomName = getRandomExt('.webp')
ffmpeg(`./${filepath}`)
.input(filepath)
.on('error', () => {
fs.unlinkSync(filepath)
reply('Terjadi kesalahan saat mengconvert sticker.')
})
});
.on('end', () => {
buffer = fs.readFileSync(randomName)
wa.sendSticker(from, buffer, lol)
fs.unlinkSync(filepath)
fs.unlinkSync(randomName)
})
.addOutputOptions([`-vcodec`, `libwebp`, `-vf`, `scale='min(320,iw)':min'(320,ih)':force_original_aspect_ratio=decrease,fps=15, pad=320:320:-1:-1:[email protected], split [a][b]; [a] palettegen=reserve_transparent=on:transparency_color=ffffff [p]; [b][p] paletteuse`])
.toFormat('webp')
.save(randomName)
} else {
reply(`Kirim gambar dengan caption ${prefix}sticker atau tag gambar yang sudah dikirim`)
}
Expand Down

0 comments on commit f7fe3b4

Please sign in to comment.