whatsapp-web.js 1.30.1-alpha.2 → 1.31.0
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 +1 -1
- package/package.json +2 -2
- package/src/util/Injected/Store.js +1 -0
- package/src/util/Injected/Utils.js +34 -2
package/README.md
CHANGED
|
@@ -128,9 +128,9 @@ For further details on saving and restoring sessions, explore the provided [Auth
|
|
|
128
128
|
| Set user status message | ✅ |
|
|
129
129
|
| React to messages | ✅ |
|
|
130
130
|
| Create polls | ✅ |
|
|
131
|
+
| Channels | ✅ |
|
|
131
132
|
| Vote in polls | 🔜 |
|
|
132
133
|
| Communities | 🔜 |
|
|
133
|
-
| Channels | 🔜 |
|
|
134
134
|
|
|
135
135
|
Something missing? Make an issue and let us know!
|
|
136
136
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "whatsapp-web.js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "Library for interacting with the WhatsApp Web API ",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"typings": "./index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"homepage": "https://wwebjs.dev/",
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@pedroslopez/moduleraid": "^5.0.2",
|
|
33
|
-
"fluent-ffmpeg": "2.1.
|
|
33
|
+
"fluent-ffmpeg": "2.1.3",
|
|
34
34
|
"mime": "^3.0.0",
|
|
35
35
|
"node-fetch": "^2.6.9",
|
|
36
36
|
"node-webpmux": "3.1.7",
|
|
@@ -98,6 +98,7 @@ exports.ExposeStore = () => {
|
|
|
98
98
|
window.Store.HistorySync = window.require('WAWebSendNonMessageDataRequest');
|
|
99
99
|
window.Store.AddonReactionTable = window.require('WAWebAddonReactionTableMode').reactionTableMode;
|
|
100
100
|
window.Store.ChatGetters = window.require('WAWebChatGetters');
|
|
101
|
+
window.Store.UploadUtils = window.require('WAWebUploadManager');
|
|
101
102
|
|
|
102
103
|
window.Store.Settings = {
|
|
103
104
|
...window.require('WAWebUserPrefsGeneral'),
|
|
@@ -28,8 +28,9 @@ exports.LoadUtils = () => {
|
|
|
28
28
|
|
|
29
29
|
let mediaOptions = {};
|
|
30
30
|
if (options.media) {
|
|
31
|
-
mediaOptions =
|
|
32
|
-
options.media
|
|
31
|
+
mediaOptions = options.sendMediaAsSticker && !isChannel
|
|
32
|
+
? await window.WWebJS.processStickerData(options.media)
|
|
33
|
+
: await window.WWebJS.processMediaData(options.media, {
|
|
33
34
|
forceSticker: options.sendMediaAsSticker,
|
|
34
35
|
forceGif: options.sendVideoAsGif,
|
|
35
36
|
forceVoice: options.sendAudioAsVoice,
|
|
@@ -301,6 +302,9 @@ exports.LoadUtils = () => {
|
|
|
301
302
|
}
|
|
302
303
|
|
|
303
304
|
await window.Store.SendMessage.addAndSendMsgToChat(chat, message);
|
|
305
|
+
await window.Store.HistorySync.sendPeerDataOperationRequest(3, {
|
|
306
|
+
chatId: chat.id
|
|
307
|
+
});
|
|
304
308
|
return window.Store.Msg.get(newMsgKey._serialized);
|
|
305
309
|
};
|
|
306
310
|
|
|
@@ -362,6 +366,34 @@ exports.LoadUtils = () => {
|
|
|
362
366
|
};
|
|
363
367
|
};
|
|
364
368
|
|
|
369
|
+
window.WWebJS.processStickerData = async (mediaInfo) => {
|
|
370
|
+
if (mediaInfo.mimetype !== 'image/webp') throw new Error('Invalid media type');
|
|
371
|
+
|
|
372
|
+
const file = window.WWebJS.mediaInfoToFile(mediaInfo);
|
|
373
|
+
let filehash = await window.WWebJS.getFileHash(file);
|
|
374
|
+
let mediaKey = await window.WWebJS.generateHash(32);
|
|
375
|
+
|
|
376
|
+
const controller = new AbortController();
|
|
377
|
+
const uploadedInfo = await window.Store.UploadUtils.encryptAndUpload({
|
|
378
|
+
blob: file,
|
|
379
|
+
type: 'sticker',
|
|
380
|
+
signal: controller.signal,
|
|
381
|
+
mediaKey
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
const stickerInfo = {
|
|
385
|
+
...uploadedInfo,
|
|
386
|
+
clientUrl: uploadedInfo.url,
|
|
387
|
+
deprecatedMms3Url: uploadedInfo.url,
|
|
388
|
+
uploadhash: uploadedInfo.encFilehash,
|
|
389
|
+
size: file.size,
|
|
390
|
+
type: 'sticker',
|
|
391
|
+
filehash
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
return stickerInfo;
|
|
395
|
+
};
|
|
396
|
+
|
|
365
397
|
window.WWebJS.processMediaData = async (mediaInfo, { forceSticker, forceGif, forceVoice, forceDocument, forceMediaHd, sendToChannel }) => {
|
|
366
398
|
const file = window.WWebJS.mediaInfoToFile(mediaInfo);
|
|
367
399
|
const opaqueData = await window.Store.OpaqueData.createFromData(file, file.type);
|