@ryuu-reinzz/haruka-lib 3.3.1 → 3.3.2
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/main/socket.js +15 -25
- package/package.json +1 -1
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
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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:
|
|
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 = "",
|