-
Notifications
You must be signed in to change notification settings - Fork 790
/
stickers.js
60 lines (55 loc) · 2.86 KB
/
stickers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const Asena = require('../events');
const {MessageType, Mimetype} = require('@adiwajshing/baileys');
const fs = require('fs');
const ffmpeg = require('fluent-ffmpeg');
const {execFile} = require('child_process');
const cwebp = require('cwebp-bin');
const Config = require('../config');
let w = require('../config');
let v = w.SUPPORT3
let {skbuffer,sticker} = require('raganork-bot');
const Language = require('../language');
const Lang = Language.getString('sticker');
let sk = Config.WORKTYPE == 'public' ? false : true
Asena.addCommand({pattern: 'sticker$', fromMe: sk, desc: Lang.STICKER_DESC}, (async (message, match) => {
if (message.reply_message === false) return await message.client.sendMessage(message.jid,Lang.NEED_REPLY, MessageType.text);
var location = await message.client.downloadAndSaveMediaMessage({
key: {
remoteJid: message.reply_message.jid,
id: message.reply_message.id
},
message: message.reply_message.data.quotedMessage
});
if (message.reply_message.video === false && message.reply_message.image) {
ffmpeg(location)
.outputOptions(["-y", "-vcodec libwebp"])
.videoFilters('scale=2000:2000:flags=lanczos:force_original_aspect_ratio=decrease,format=rgba,pad=2000:2000:(ow-iw)/2:(oh-ih)/2:color=#00000000,setsar=1')
.save('st.webp')
.on('end', async () => {
if (w.def_st_name === 'true') {
var s = w.SOURAVKL11.split('|');
var au = s[1];
var p = s[0];
var res = await sticker('st.webp',au,p,w.take_key,v)
await message.client.sendMessage(message.jid,await skbuffer(res), MessageType.sticker);
}
else await message.sendMessage(fs.readFileSync('st.webp'), MessageType.sticker);
});
return;
}
ffmpeg(location)
.outputOptions(["-y", "-vcodec libwebp", "-lossless 1", "-qscale 1", "-preset default", "-loop 0", "-an", "-vsync 0", "-s 600x600"])
.videoFilters('scale=600:600:flags=lanczos:force_original_aspect_ratio=decrease,format=rgba,pad=600:600:(ow-iw)/2:(oh-ih)/2:color=#00000000,setsar=1')
.save('sticker.webp')
.on('end', async () => {
if (w.def_st_name === 'true') {
var s = w.SOURAVKL11.split('|');
var au = s[1];
var p = s[0];
var res = await sticker('sticker.webp',au,p,w.take_key,v)
await message.client.sendMessage(message.jid,await skbuffer(res), MessageType.sticker);
}
else await message.sendMessage(fs.readFileSync('sticker.webp'), MessageType.sticker);
});
return;
}));