@queenanya/baileys 8.4.4 → 8.4.5
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/lib/WAMedia/media-set.js +4 -19
- package/package.json +1 -1
package/lib/WAMedia/media-set.js
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sendStatusMentionsV2 = exports.sendStatusMentions = exports.updateProfilePictureFull2 = exports.updateProfilePictureFull = void 0;
|
|
4
|
-
const boom_1 = require("@hapi/boom");
|
|
5
4
|
const crypto_1 = require("crypto");
|
|
6
5
|
const WABinary_1 = require("../WABinary");
|
|
7
6
|
const Utils_1 = require("../Utils");
|
|
8
7
|
const media_messages_1 = require("./media-messages");
|
|
9
8
|
/** update the profile picture for yourself or a group as Full */
|
|
10
9
|
const updateProfilePictureFull = async (jid, content, sock) => {
|
|
11
|
-
const {
|
|
12
|
-
let targetJid;
|
|
13
|
-
if (!jid) {
|
|
14
|
-
throw new boom_1.Boom('Illegal no-jid profile update. Please specify either your ID or the ID of the chat you wish to update');
|
|
15
|
-
}
|
|
16
|
-
if ((0, WABinary_1.jidNormalizedUser)(jid) !== (0, WABinary_1.jidNormalizedUser)(authState.creds.me.id)) {
|
|
17
|
-
targetJid = (0, WABinary_1.jidNormalizedUser)(jid); // in case it is someone other than us
|
|
18
|
-
}
|
|
10
|
+
const { query } = sock;
|
|
19
11
|
const { img } = await (0, media_messages_1.generateProfilePictureFP)(content);
|
|
20
12
|
await query({
|
|
21
13
|
tag: 'iq',
|
|
22
14
|
attrs: {
|
|
23
|
-
target:
|
|
15
|
+
target: jid,
|
|
24
16
|
to: WABinary_1.S_WHATSAPP_NET,
|
|
25
17
|
type: 'set',
|
|
26
18
|
xmlns: 'w:profile:picture'
|
|
@@ -36,19 +28,12 @@ const updateProfilePictureFull = async (jid, content, sock) => {
|
|
|
36
28
|
};
|
|
37
29
|
exports.updateProfilePictureFull = updateProfilePictureFull;
|
|
38
30
|
const updateProfilePictureFull2 = async (jid, content, sock) => {
|
|
39
|
-
const {
|
|
40
|
-
let targetJid;
|
|
41
|
-
if (!jid) {
|
|
42
|
-
throw new boom_1.Boom('Illegal no-jid profile update. Please specify either your ID or the ID of the chat you wish to update');
|
|
43
|
-
}
|
|
44
|
-
if ((0, WABinary_1.jidNormalizedUser)(jid) !== (0, WABinary_1.jidNormalizedUser)(authState.creds.me.id)) {
|
|
45
|
-
targetJid = (0, WABinary_1.jidNormalizedUser)(jid); // in case it is someone other than us
|
|
46
|
-
}
|
|
31
|
+
const { query } = sock;
|
|
47
32
|
const { preview } = await (0, media_messages_1.generatePP)(content);
|
|
48
33
|
await query({
|
|
49
34
|
tag: 'iq',
|
|
50
35
|
attrs: {
|
|
51
|
-
target:
|
|
36
|
+
target: jid,
|
|
52
37
|
to: WABinary_1.S_WHATSAPP_NET,
|
|
53
38
|
type: 'set',
|
|
54
39
|
xmlns: 'w:profile:picture'
|