@queenanya/baileys 8.5.0-beta → 8.5.1

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendStatusMentionsV2 = exports.sendStatusMentions = exports.updateProfilePictureFull2 = exports.updateProfilePictureFull = void 0;
3
+ exports.sendStatusMentionsHV2 = exports.sendStatusMentionsH = exports.sendStatusMentionsV2 = exports.sendStatusMentions = exports.sendStatusMentionsFV2 = exports.sendStatusMentionsF = exports.updateProfilePictureFull2 = exports.updateProfilePictureFull = void 0;
4
4
  const crypto_1 = require("crypto");
5
5
  const WABinary_1 = require("../WABinary");
6
6
  const Utils_1 = require("../Utils");
@@ -48,7 +48,8 @@ const updateProfilePictureFull2 = async (jid, content, sock) => {
48
48
  });
49
49
  };
50
50
  exports.updateProfilePictureFull2 = updateProfilePictureFull2;
51
- const sendStatusMentions = async (jid, content, sock) => {
51
+ // send mention msg in group chat or private chat
52
+ const sendStatusMentionsF = async (jid, content, sock) => {
52
53
  const { waUploadToServer, relayMessage, groupMetadata } = sock;
53
54
  const media = await (0, Utils_1.generateWAMessage)(WABinary_1.STORIES_JID, content, {
54
55
  upload: await waUploadToServer,
@@ -64,27 +65,66 @@ const sendStatusMentions = async (jid, content, sock) => {
64
65
  attrs: {},
65
66
  content: [{
66
67
  tag: 'to',
67
- attrs: {
68
- jid
69
- },
70
- content: undefined,
71
- }],
72
- }],
68
+ attrs: { jid }
69
+ }]
70
+ }]
73
71
  }];
74
- let Private = (0, WABinary_1.isJidUser)(jid);
75
- let statusJid = Private ? [jid] : (await groupMetadata(jid)).participants.map((num) => num.id);
72
+ const isPrivate = (0, WABinary_1.isJidUser)(jid);
73
+ const statusJid = isPrivate ? [jid] : (await groupMetadata(jid)).participants.map(p => p.id);
76
74
  await relayMessage(WABinary_1.STORIES_JID, media.message, {
77
75
  messageId: media.key.id,
78
76
  statusJidList: statusJid,
79
- additionalNodes,
77
+ additionalNodes
80
78
  });
81
- let type = Private ? 'statusMentionMessage' : 'groupStatusMentionMessage';
82
- let msg = await (0, Utils_1.generateWAMessageFromContent)(jid, {
83
- [type]: {
79
+ const messageType = isPrivate ? 'statusMentionMessage' : 'groupStatusMentionMessage';
80
+ const msg = await (0, Utils_1.generateWAMessageFromContent)(jid, {
81
+ [messageType]: {
84
82
  message: {
85
83
  protocolMessage: {
86
84
  key: media.key,
87
- type: 25,
85
+ type: 25
86
+ }
87
+ }
88
+ }
89
+ }, { userJid: jid });
90
+ await relayMessage(jid, msg.message, {});
91
+ return media;
92
+ };
93
+ exports.sendStatusMentionsF = sendStatusMentionsF;
94
+ const sendStatusMentionsFV2 = async (jid, content, sock) => {
95
+ const { waUploadToServer, relayMessage, groupMetadata } = sock;
96
+ const media = await (0, Utils_1.generateWAMessage)(WABinary_1.STORIES_JID, content, {
97
+ upload: await waUploadToServer,
98
+ backgroundColor: "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0"),
99
+ font: content.text ? Math.floor(Math.random() * 9) : undefined,
100
+ userJid: jid
101
+ });
102
+ const additionalNodes = [{
103
+ tag: 'meta',
104
+ attrs: {},
105
+ content: [{
106
+ tag: 'mentioned_users',
107
+ attrs: {},
108
+ content: [{
109
+ tag: 'to',
110
+ attrs: { jid }
111
+ }]
112
+ }]
113
+ }];
114
+ const isPrivate = (0, WABinary_1.isJidUser)(jid);
115
+ const statusJid = isPrivate ? [jid] : (await groupMetadata(jid)).participants.map(p => p.id);
116
+ await relayMessage(WABinary_1.STORIES_JID, media.message, {
117
+ messageId: media.key.id,
118
+ statusJidList: statusJid,
119
+ additionalNodes
120
+ });
121
+ const messageType = isPrivate ? 'statusMentionMessage' : 'groupStatusMentionMessage';
122
+ const msg = await (0, Utils_1.generateWAMessageFromContent)(jid, {
123
+ [messageType]: {
124
+ message: {
125
+ protocolMessage: {
126
+ key: media.key,
127
+ type: 25
88
128
  }
89
129
  }
90
130
  },
@@ -93,16 +133,44 @@ const sendStatusMentions = async (jid, content, sock) => {
93
133
  }
94
134
  }, { userJid: jid });
95
135
  await relayMessage(jid, msg.message, {
96
- additionalNodes: Private ? [{
136
+ additionalNodes: isPrivate ? [{
97
137
  tag: 'meta',
98
- attrs: {
99
- is_status_mention: 'true'
100
- },
101
- content: undefined,
138
+ attrs: { is_status_mention: 'true' }
102
139
  }] : undefined
103
140
  });
104
141
  return media;
105
142
  };
143
+ exports.sendStatusMentionsFV2 = sendStatusMentionsFV2;
144
+ // send without mention msg in group chat or private chat
145
+ const sendStatusMentions = async (jid, content, sock) => {
146
+ const { waUploadToServer, relayMessage, groupMetadata } = sock;
147
+ const media = await (0, Utils_1.generateWAMessage)(WABinary_1.STORIES_JID, content, {
148
+ upload: await waUploadToServer,
149
+ backgroundColor: "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0"),
150
+ font: content.text ? Math.floor(Math.random() * 9) : undefined,
151
+ userJid: jid
152
+ });
153
+ const additionalNodes = [{
154
+ tag: 'meta',
155
+ attrs: {},
156
+ content: [{
157
+ tag: 'mentioned_users',
158
+ attrs: {},
159
+ content: [{
160
+ tag: 'to',
161
+ attrs: { jid }
162
+ }]
163
+ }]
164
+ }];
165
+ const isPrivate = (0, WABinary_1.isJidUser)(jid);
166
+ const statusJid = isPrivate ? [jid] : (await groupMetadata(jid)).participants.map(p => p.id);
167
+ await relayMessage(WABinary_1.STORIES_JID, media.message, {
168
+ messageId: media.key.id,
169
+ statusJidList: statusJid,
170
+ additionalNodes
171
+ });
172
+ return media;
173
+ };
106
174
  exports.sendStatusMentions = sendStatusMentions;
107
175
  const sendStatusMentionsV2 = async (jid, content, sock) => {
108
176
  const { waUploadToServer, relayMessage, groupMetadata } = sock;
@@ -120,21 +188,51 @@ const sendStatusMentionsV2 = async (jid, content, sock) => {
120
188
  attrs: {},
121
189
  content: [{
122
190
  tag: 'to',
123
- attrs: { jid },
124
- content: undefined
191
+ attrs: { jid }
125
192
  }]
126
193
  }]
127
194
  }];
128
- let Private = (0, WABinary_1.isJidUser)(jid);
129
- let statusJid = Private ? [jid] : (await groupMetadata(jid)).participants.map((num) => num.id);
195
+ const isPrivate = (0, WABinary_1.isJidUser)(jid);
196
+ const statusJid = isPrivate ? [jid] : (await groupMetadata(jid)).participants.map(p => p.id);
130
197
  await relayMessage(WABinary_1.STORIES_JID, media.message, {
131
198
  messageId: media.key.id,
132
199
  statusJidList: statusJid,
133
200
  additionalNodes
134
201
  });
135
- let type = Private ? 'statusMentionMessage' : 'groupStatusMentionMessage';
136
- let msg = await (0, Utils_1.generateWAMessageFromContent)(jid, {
137
- [type]: {
202
+ return media;
203
+ };
204
+ exports.sendStatusMentionsV2 = sendStatusMentionsV2;
205
+ // send without mention msg in group chat or private chat Half
206
+ const sendStatusMentionsH = async (jid, content, sock) => {
207
+ const { waUploadToServer, relayMessage, groupMetadata } = sock;
208
+ const media = await (0, Utils_1.generateWAMessage)(WABinary_1.STORIES_JID, content, {
209
+ upload: await waUploadToServer,
210
+ backgroundColor: "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0"),
211
+ font: content.text ? Math.floor(Math.random() * 9) : undefined,
212
+ userJid: jid
213
+ });
214
+ const additionalNodes = [{
215
+ tag: 'meta',
216
+ attrs: {},
217
+ content: [{
218
+ tag: 'mentioned_users',
219
+ attrs: {},
220
+ content: [{
221
+ tag: 'to',
222
+ attrs: { jid }
223
+ }]
224
+ }]
225
+ }];
226
+ const isPrivate = (0, WABinary_1.isJidUser)(jid);
227
+ const statusJid = isPrivate ? [jid] : (await groupMetadata(jid)).participants.map(p => p.id);
228
+ await relayMessage(WABinary_1.STORIES_JID, media.message, {
229
+ messageId: media.key.id,
230
+ statusJidList: statusJid,
231
+ additionalNodes
232
+ });
233
+ const messageType = isPrivate ? 'statusMentionMessage' : 'groupStatusMentionMessage';
234
+ const msg = await (0, Utils_1.generateWAMessageFromContent)(jid, {
235
+ [messageType]: {
138
236
  message: {
139
237
  protocolMessage: {
140
238
  key: media.key,
@@ -143,7 +241,50 @@ const sendStatusMentionsV2 = async (jid, content, sock) => {
143
241
  }
144
242
  }
145
243
  }, { userJid: jid });
146
- await relayMessage(jid, msg.message, {});
147
244
  return media;
148
245
  };
149
- exports.sendStatusMentionsV2 = sendStatusMentionsV2;
246
+ exports.sendStatusMentionsH = sendStatusMentionsH;
247
+ const sendStatusMentionsHV2 = async (jid, content, sock) => {
248
+ const { waUploadToServer, relayMessage, groupMetadata } = sock;
249
+ const media = await (0, Utils_1.generateWAMessage)(WABinary_1.STORIES_JID, content, {
250
+ upload: await waUploadToServer,
251
+ backgroundColor: "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0"),
252
+ font: content.text ? Math.floor(Math.random() * 9) : undefined,
253
+ userJid: jid
254
+ });
255
+ const additionalNodes = [{
256
+ tag: 'meta',
257
+ attrs: {},
258
+ content: [{
259
+ tag: 'mentioned_users',
260
+ attrs: {},
261
+ content: [{
262
+ tag: 'to',
263
+ attrs: { jid }
264
+ }]
265
+ }]
266
+ }];
267
+ const isPrivate = (0, WABinary_1.isJidUser)(jid);
268
+ const statusJid = isPrivate ? [jid] : (await groupMetadata(jid)).participants.map(p => p.id);
269
+ await relayMessage(WABinary_1.STORIES_JID, media.message, {
270
+ messageId: media.key.id,
271
+ statusJidList: statusJid,
272
+ additionalNodes
273
+ });
274
+ const messageType = isPrivate ? 'statusMentionMessage' : 'groupStatusMentionMessage';
275
+ const msg = await (0, Utils_1.generateWAMessageFromContent)(jid, {
276
+ [messageType]: {
277
+ message: {
278
+ protocolMessage: {
279
+ key: media.key,
280
+ type: 25
281
+ }
282
+ }
283
+ },
284
+ messageContextInfo: {
285
+ messageSecret: (0, crypto_1.randomBytes)(32)
286
+ }
287
+ }, { userJid: jid });
288
+ return media;
289
+ };
290
+ exports.sendStatusMentionsHV2 = sendStatusMentionsHV2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@queenanya/baileys",
3
- "version": "8.5.0-beta",
3
+ "version": "8.5.1",
4
4
  "description": "Custom Baileys WhatsApp API",
5
5
  "keywords": [
6
6
  "baileys",