@ryuu-reinzz/haruka-lib 3.3.1 → 3.3.3

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.
Files changed (2) hide show
  1. package/main/socket.js +15 -25
  2. package/package.json +6 -6
package/main/socket.js CHANGED
@@ -49,29 +49,19 @@ export default function addProperty(socket, baileys) {
49
49
  const docInfo = mediaMessage.documentMessage;
50
50
  if (!docInfo) throw new Error("Gagal mengunggah gambar cover.");
51
51
 
52
- const uploadedStickers = [];
53
-
54
- for (const s of stickers) {
55
- const stickerMessage = await prepareWAMessageMedia({
56
- document: s.data,
57
- mimetype: 'image/webp',
58
- fileName: 'sticker.webp'
59
- }, {
60
- upload: socket.waUploadToServer
61
- });
62
-
63
- const sDoc = stickerMessage.documentMessage;
64
- if (sDoc) {
65
- uploadedStickers.push({
66
- fileLength: sDoc.fileLength,
67
- fileSha256: sDoc.fileSha256,
68
- fileEncSha256: sDoc.fileEncSha256,
69
- mediaKey: sDoc.mediaKey,
70
- directPath: sDoc.directPath,
71
- mediaKeyTimestamp: sDoc.mediaKeyTimestamp || Math.floor(Date.now() / 1000).toString(),
72
- });
73
- }
74
- }
52
+ const formattedStickers = stickers.map(s => {
53
+ const hash = crypto.createHash('sha256').update(s.data).digest('base64');
54
+ const safeFileName = hash.replace(/\+/g, '-').replace(/\//g, '_') + '.webp';
55
+
56
+ return {
57
+ fileName: safeFileName,
58
+ isAnimated: false,
59
+ emojis: s.emojis || ['🎨'],
60
+ accessibilityLabel: '',
61
+ isLottie: false,
62
+ mimetype: 'image/webp'
63
+ };
64
+ });
75
65
 
76
66
  const stickerPackId = generateMessageID();
77
67
 
@@ -81,8 +71,7 @@ export default function addProperty(socket, baileys) {
81
71
  publisher: publisher,
82
72
  packDescription: description || '',
83
73
 
84
- stickers: uploadedStickers,
85
-
74
+ stickers: formattedStickers,
86
75
  fileLength: docInfo.fileLength,
87
76
  fileSha256: docInfo.fileSha256,
88
77
  fileEncSha256: docInfo.fileEncSha256,
@@ -111,6 +100,7 @@ export default function addProperty(socket, baileys) {
111
100
  }
112
101
  },
113
102
 
103
+
114
104
  sendCard: async (jid, options = {}) => {
115
105
  const {
116
106
  text = "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuu-reinzz/haruka-lib",
3
- "version": "3.3.1",
3
+ "version": "3.3.3",
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
- "axios": "^1.12.1",
19
18
  "audio-decode": "2.2.3",
19
+ "axios": "^1.12.1",
20
20
  "better-sqlite3": "^12.5.0",
21
- "file-type": "^16.5.3",
22
- "fluent-ffmpeg": "^2.1.3",
23
21
  "ffmpeg-static": "^5.3.0",
24
22
  "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",
27
26
  "node-fetch": "^2.6.1",
28
27
  "node-webpmux": "^3.2.1",
28
+ "path": "^0.12.7",
29
29
  "sharp": "^0.34.1"
30
30
  }
31
- }
31
+ }