Skip to content

Commit

Permalink
some fetures
Browse files Browse the repository at this point in the history
  • Loading branch information
LoL-Human committed Mar 27, 2021
1 parent c956702 commit 420a247
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -1388,6 +1388,7 @@ async function starts() {
// Creator
case 'stickerwm':
if ((isMedia && !lol.message.videoMessage || isQuotedImage)) {
if (args.length == 0) return reply(`Example: ${prefix + command} LoL|Human`)
const encmedia = isQuotedImage ? JSON.parse(JSON.stringify(lol).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : lol
filePath = await lolhuman.downloadAndSaveMediaMessage(encmedia, filename = getRandom());
file_name = getRandom(".webp")
Expand All @@ -1414,6 +1415,7 @@ async function starts() {
break
case 'sticker':
if ((isMedia && !lol.message.videoMessage || isQuotedImage) && args.length == 0) {
if (args.length == 0) return reply(`Example: ${prefix + command} LoL|Human`)
const encmedia = isQuotedImage ? JSON.parse(JSON.stringify(lol).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : lol
filePath = await lolhuman.downloadAndSaveMediaMessage(encmedia)
file_name = getRandom('.webp')
Expand All @@ -1435,6 +1437,33 @@ async function starts() {
reply(`Kirim gambar dengan caption ${prefix}sticker atau tag gambar yang sudah dikirim`)
}
break
case 'takestick':
if ((isMedia && !lol.message.videoMessage || isQuotedSticker)) {
if (args.length == 0) return reply(`Example: ${prefix + command} LoL|Human`)
const encmedia = isQuotedSticker ? JSON.parse(JSON.stringify(lol).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : lol
filePath = await lolhuman.downloadAndSaveMediaMessage(encmedia, filename = getRandom());
file_name = getRandom(".webp")
ini_txt = args.join(" ").split("|")
request({
url: `http://api.lolhuman.xyz/api/convert/towebpauthor?apikey=${apikey}`,
method: 'POST',
formData: {
"img": fs.createReadStream(filePath),
"package": ini_txt[0],
"author": ini_txt[1]
},
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 })
fs.unlinkSync(file_name)
});
} else {
reply(`Kirim gambar dengan caption ${prefix + command} atau tag gambar yang sudah dikirim`)
}
break
case 'ttp':
case 'ttp2':
case 'ttp3':
Expand Down Expand Up @@ -1507,8 +1536,8 @@ async function starts() {

// Converter
case 'togif':
if ((isMedia && !lol.message.videoMessage || isQuotedImage)) {
const encmedia = isQuotedImage ? JSON.parse(JSON.stringify(lol).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : lol
if ((isMedia && !lol.message.videoMessage || isQuotedSticker)) {
const encmedia = isQuotedSticker ? JSON.parse(JSON.stringify(lol).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : lol
filePath = await lolhuman.downloadAndSaveMediaMessage(encmedia, filename = getRandom());
file_name = getRandom(".gif")
ini_txt = args.join(" ").split("|")
Expand All @@ -1523,7 +1552,7 @@ async function starts() {
fs.unlinkSync(filePath)
fs.writeFileSync(file_name, body, "binary")
ini_buff = fs.readFileSync(file_name)
lolhuman.sendMessage(from, ini_buff, video, { quoted: lol, mimetype: Mimetype.gif, filename: file_name })
lolhuman.sendMessage(from, ini_buff, video, { quoted: lol, mimetype: "video/gif", filename: file_name })
fs.unlinkSync(file_name)
});
} else {
Expand Down

0 comments on commit 420a247

Please sign in to comment.