@ryuu-reinzz/haruka-lib 3.3.2 → 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
@@ -73,7 +73,7 @@ conn.sendOrder(m.chat, {
73
73
  status: 1,
74
74
  surface: 1,
75
75
  orderTitle: "Premium Subscription",
76
- message: "Zahlea botz",
76
+ message: "Haruka botz",
77
77
  sellerJid: conn.user.jid,
78
78
  totalAmount1000: 500000000,
79
79
  totalCurrencyCode: "IDR"
@@ -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://github.com/DikaArdnt/Hisoka-Morou',
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 isVideo(input) {
20
+ function isAnimated(input) {
21
21
  return new Promise((resolve) => {
22
22
  ffmpeg.ffprobe(input, (err, metadata) => {
23
23
  if (err) {
24
- console.log("ffprobe error:", err);
24
+ console.error("ffprobe error:", err);
25
25
  return resolve(false);
26
26
  }
27
27
 
28
- const isVideo = metadata.streams.some(
28
+ const videoStream = metadata.streams.find(
29
29
  (s) => s.codec_type === "video"
30
30
  );
31
31
 
32
- resolve(isVideo);
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 isVideo(tmpPath);
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://github.com/DikaArdnt/Hisoka-Morou',
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.2",
3
+ "version": "3.3.4",
4
4
  "description": "Library extra for bot WhatsApp",
5
5
  "main": "main/index.js",
6
6
  "type": "module",