@ryuu-reinzz/haruka-lib 3.3.3 → 3.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ export async function stickerImg(media, metadata) {
|
|
|
41
41
|
if (metadata.packname || metadata.author) {
|
|
42
42
|
const img = new webp.Image();
|
|
43
43
|
const json = {
|
|
44
|
-
'sticker-pack-id': 'https://
|
|
44
|
+
'sticker-pack-id': 'https://www.npmjs.com/package/@ryuu-reinzz/baileys',
|
|
45
45
|
'sticker-pack-name': metadata.packname,
|
|
46
46
|
'sticker-pack-publisher': metadata.author,
|
|
47
47
|
'emojis': metadata.categories ?? ['']
|
|
@@ -17,23 +17,29 @@ import Crypto from 'crypto';
|
|
|
17
17
|
ffmpeg.setFfmpegPath(ffmpegPath);
|
|
18
18
|
ffmpeg.setFfprobePath(ffprobePath.path);
|
|
19
19
|
|
|
20
|
-
function
|
|
20
|
+
function isAnimated(input) {
|
|
21
21
|
return new Promise((resolve) => {
|
|
22
22
|
ffmpeg.ffprobe(input, (err, metadata) => {
|
|
23
23
|
if (err) {
|
|
24
|
-
console.
|
|
24
|
+
console.error("ffprobe error:", err);
|
|
25
25
|
return resolve(false);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const
|
|
28
|
+
const videoStream = metadata.streams.find(
|
|
29
29
|
(s) => s.codec_type === "video"
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
resolve(
|
|
32
|
+
if (!videoStream) return resolve(false);
|
|
33
|
+
const frameCount = parseInt(videoStream.nb_frames);
|
|
34
|
+
const duration = parseFloat(metadata.format.duration);
|
|
35
|
+
const isMoving = frameCount > 1 || duration > 0;
|
|
36
|
+
|
|
37
|
+
resolve(isMoving);
|
|
33
38
|
});
|
|
34
39
|
});
|
|
35
40
|
}
|
|
36
41
|
|
|
42
|
+
|
|
37
43
|
async function bufferToTmp(buffer, ext = '.bin') {
|
|
38
44
|
const tmp = path.join(
|
|
39
45
|
tmpdir(),
|
|
@@ -99,7 +105,7 @@ class Sticker {
|
|
|
99
105
|
Buffer.alloc(0);
|
|
100
106
|
|
|
101
107
|
const tmpPath = await bufferToTmp(buff);
|
|
102
|
-
const thisVideo = await
|
|
108
|
+
const thisVideo = await isAnimated(tmpPath);
|
|
103
109
|
|
|
104
110
|
return thisVideo ?
|
|
105
111
|
await this.toStickerVid() :
|
|
@@ -60,7 +60,7 @@ export async function stickerVid(media, metadata) {
|
|
|
60
60
|
if (metadata.packname || metadata.author) {
|
|
61
61
|
const img = new webp.Image();
|
|
62
62
|
const json = {
|
|
63
|
-
'sticker-pack-id': 'https://
|
|
63
|
+
'sticker-pack-id': 'https://www.npmjs.com/package/@ryuu-reinzz/baileys',
|
|
64
64
|
'sticker-pack-name': metadata.packname,
|
|
65
65
|
'sticker-pack-publisher': metadata.author,
|
|
66
66
|
'emojis': metadata.categories ?? ['']
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ryuu-reinzz/haruka-lib",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.4",
|
|
4
4
|
"description": "Library extra for bot WhatsApp",
|
|
5
5
|
"main": "main/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
":v"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"audio-decode": "2.2.3",
|
|
19
18
|
"axios": "^1.12.1",
|
|
19
|
+
"audio-decode": "2.2.3",
|
|
20
20
|
"better-sqlite3": "^12.5.0",
|
|
21
|
+
"file-type": "^16.5.3",
|
|
22
|
+
"fluent-ffmpeg": "^2.1.3",
|
|
21
23
|
"ffmpeg-static": "^5.3.0",
|
|
22
24
|
"ffprobe-static": "^3.1.0",
|
|
23
|
-
"file-type": "^22.0.1",
|
|
24
|
-
"fluent-ffmpeg": "^2.1.3",
|
|
25
25
|
"fs-extra": "^11.2.0",
|
|
26
|
+
"path": "^0.12.7",
|
|
26
27
|
"node-fetch": "^2.6.1",
|
|
27
28
|
"node-webpmux": "^3.2.1",
|
|
28
|
-
"path": "^0.12.7",
|
|
29
29
|
"sharp": "^0.34.1"
|
|
30
30
|
}
|
|
31
|
-
}
|
|
31
|
+
}
|