Spaces:
Runtime error
Runtime error
/*╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺ | |
⭐PROJECT NAME: | |
SUBZERO WHATSAPP MD BOT | |
⭐DEVELOPER | |
MR FRANK | |
⭐ MY TEAM | |
XERO CODERS | |
⭐ OUR WEBSITE | |
https://github.com/ZwSyntax/SUBZERO-MD | |
© TRY DECRYPTING IF YOU CAN⚠ | |
╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺*/ | |
const config = require('../config'); | |
const { Sticker, StickerTypes } = require('wa-sticker-formatter'); | |
const { cmd } = require('../command'); | |
const { getRandom } = require('../lib/functions'); | |
var imgmsg = ''; | |
if (config.LANG === 'SI') imgmsg = 'ඡායාරූපයකට mention දෙන්න!'; | |
else imgmsg = 'ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴘʜᴏᴛᴏ ғᴏʀ sᴛɪᴄᴋᴇʀ!'; | |
var descg = ''; | |
if (config.LANG === 'SI') descg = 'එය ඔබගේ mention දුන් ඡායාරූපය ස්ටිකර් බවට පරිවර්තනය කරයි.'; | |
else descg = 'ɪᴛ ᴄᴏɴᴠᴇʀᴛs ʏᴏᴜʀ ʀᴇᴘʟɪᴇᴅ ᴘʜᴏᴛᴏ ᴛᴏ sᴛɪᴄᴋᴇʀ.'; | |
cmd({ | |
pattern: 'sticker', | |
react: '🤹♀️', | |
alias: ['s', 'stic'], | |
desc: descg, | |
category: 'convert', | |
use: '.sticker <Reply to image>', | |
filename: __filename | |
}, async (conn, mek, m, { from, reply, isCmd, command, args, q, isGroup, pushname }) => { | |
try { | |
const isQuotedImage = m.quoted && (m.quoted.type === 'imageMessage' || (m.quoted.type === 'viewOnceMessage' && m.quoted.msg.type === 'imageMessage')); | |
const isQuotedSticker = m.quoted && m.quoted.type === 'stickerMessage'; | |
if ((m.type === 'imageMessage') || isQuotedImage) { | |
const nameJpg = getRandom('.jpg'); | |
const imageBuffer = isQuotedImage ? await m.quoted.download() : await m.download(); | |
await require('fs').promises.writeFile(nameJpg, imageBuffer); | |
let sticker = new Sticker(nameJpg, { | |
pack: pushname, // The pack name | |
author: '', // The author name | |
type: q.includes('--crop') || q.includes('-c') ? StickerTypes.CROPPED : StickerTypes.FULL, | |
categories: ['🤩', '🎉'], // The sticker category | |
id: '12345', // The sticker id | |
quality: 75, // The quality of the output file | |
background: 'transparent', // The sticker background color (only for full stickers) | |
}); | |
const buffer = await sticker.toBuffer(); | |
return conn.sendMessage(from, { sticker: buffer }, { quoted: mek }); | |
} else if (isQuotedSticker) { | |
const nameWebp = getRandom('.webp'); | |
const stickerBuffer = await m.quoted.download(); | |
await require('fs').promises.writeFile(nameWebp, stickerBuffer); | |
let sticker = new Sticker(nameWebp, { | |
pack: '❄️SUBZERO - MD❄️', // The pack name | |
author: '『 Mʀ Fʀᴀɴᴋ Oғᴄ』', // The author name | |
type: q.includes('--crop') || q.includes('-c') ? StickerTypes.CROPPED : StickerTypes.FULL, | |
categories: ['🤩', '🎉'], // The sticker category | |
id: '12345', // The sticker id | |
quality: 75, // The quality of the output file | |
background: 'transparent', // The sticker background color (only for full stickers) | |
}); | |
const buffer = await sticker.toBuffer(); | |
return conn.sendMessage(from, { sticker: buffer }, { quoted: mek }); | |
} else { | |
return await reply(imgmsg); | |
} | |
} catch (e) { | |
reply('Error !!'); | |
console.error(e); | |
} | |
}); | |