-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
417 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = { | ||
help: ['totag'], | ||
use: 'reply chat', | ||
tags: ['admin'], | ||
command: /^(totag)$/i, | ||
run: async (m, { | ||
conn, | ||
text, | ||
participants, | ||
Func | ||
}) => { | ||
let users = participants.map(u => u.id).filter(v => v !== conn.user.jid) | ||
if (!m.quoted) return conn.reply(m.chat, Func.texted('bold', '🚩 Reply chat'), m) | ||
conn.sendMessage(m.chat, { forward: m.quoted.fakeObj, mentions: users }) | ||
}, | ||
group: true, | ||
admin: true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
module.exports = { | ||
help: ['smeta'], | ||
use: 'query / reply media', | ||
tags: ['converter'], | ||
command: /^(smeta|stikermeta|stickermeta)$/i, | ||
run: async (m, { | ||
conn, | ||
usedPrefix, | ||
command, | ||
text, | ||
Func | ||
}) => { | ||
try { | ||
if (!m.quoted) return conn.reply(m.chat, Func.texted('bold', `🚩 Reply sticker.`), m) | ||
var stiker = false | ||
let [packname, ...author] = text.split`|` | ||
author = (author || []).join`|` | ||
let q = m.quoted ? m.quoted : m | ||
let mime = (q.msg || q).mimetype || '' | ||
if (!/webp/.test(mime)) return conn.reply(m.chat, Func.texted('bold', `🚩 Reply to the sticker you want to make into a meta sticker.`), m) | ||
let img = await q.download() | ||
if (!img) return conn.reply(m.chat, global.status.wrong, m) | ||
stiker = await addExif(img, packname || global.db.data.setting.sk_pack, author || global.db.data.setting.sk_author) | ||
} catch (e) { | ||
console.error(e) | ||
if (Buffer.isBuffer(e)) stiker = e | ||
} finally { | ||
if (stiker) conn.sendMessage(m.chat, { | ||
sticker: stiker | ||
}, { | ||
quoted: m | ||
}) | ||
else return conn.reply(m.chat, Func.texted('bold', `🚩 Conversion failed.`), m) | ||
} | ||
}, | ||
limit: true | ||
} | ||
|
||
const { Image } = require('node-webpmux') | ||
async function addExif(buffer, packname, author, categories = [''], extra = {}) { | ||
const img = new Image() | ||
const json = { | ||
'sticker-pack-id': packname || 'Sticker By', | ||
'sticker-pack-name': author || 'moon-bot', | ||
'sticker-pack-publisher': global.creator || '@naando.io', | ||
'emojis': categories, | ||
'is-avatar-sticker': 1, | ||
...extra | ||
} | ||
let exifAttr = Buffer.from([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00]) | ||
let jsonBuffer = Buffer.from(JSON.stringify(json), 'utf8') | ||
let exif = Buffer.concat([exifAttr, jsonBuffer]) | ||
exif.writeUIntLE(jsonBuffer.length, 14, 4) | ||
await img.load(buffer) | ||
img.exif = exif | ||
return await img.save(null) | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.