Skip to content

Instantly share code, notes, and snippets.

@spark-shadow
Last active July 2, 2022 20:26
Show Gist options
  • Save spark-shadow/7a03decfda97e6da7606880d9db85456 to your computer and use it in GitHub Desktop.
Save spark-shadow/7a03decfda97e6da7606880d9db85456 to your computer and use it in GitHub Desktop.
CSTICKER - CROP STICKER AS 1:1 RATIO
const Shadow = require('../Utilis/events')
const { MessageType, Mimetype } = require("@adiwajshing/baileys");
const { sticker, addExif, cropsticker } = require("../Utilis/fFmpeg");
//csticker by lyfe ser
//re edited & created as external by Shadow...
Shadow.addCommand( //by shadow...
{ pattern: "cs ?(.*)", fromMe: true, desc: "croped sticker maker" },
async (message, match) => {
if (
!message.reply_message ||
(!message.reply_message.video && !message.reply_message.image)
) //csticker re edited & created as external by shadow
return await message.sendMessage('Replay to a photo or video');
let location = await message.reply_message.downloadAndSaveMediaMessage(
"sticker"
); //csticker by shadow
if (message.reply_message.image == true) {
let buffer = await cropsticker("cimagesticker", location, 1, match);
return await message.sendMessage(
buffer,
{ mimetype: Mimetype.webp, quoted: message.quoted },
MessageType.sticker
); //csticker re edited & created as external by shadow
} else if (message.reply_message.video == true) {
let buffer = await cropsticker(
"canimatedsticker",
location,
message.reply_message.seconds < 10 ? 2 : 3,
match
); //csticker re edited & created as external by shadow
return await message.sendMessage(
buffer,
{ mimetype: Mimetype.webp, isAnimated: true, quoted: message.quoted },
MessageType.sticker
); //csticker re edited & created as external by shadow
} //thanks to lyfe ser
} //use and enjoy...
); //*******************
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment