@nuiisweety/baileys 0.1.17 → 0.1.18
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 +327 -191
- package/README.md.bak +390 -833
- package/lib/Socket/messages-send.js +12 -4
- package/lib/Socket/messages-send.js.bak +1 -0
- package/package.json +1 -1
|
@@ -478,10 +478,19 @@ export const makeMessagesSocket = (config) => {
|
|
|
478
478
|
}
|
|
479
479
|
if (isNewsletter) {
|
|
480
480
|
const patched = patchMessageBeforeSending ? await patchMessageBeforeSending(message, []) : message;
|
|
481
|
+
// Evaluate mediaType from patched message (after patchMessageBeforeSending),
|
|
482
|
+
// and place it in plaintext attrs — NOT in stanza attrs (WA server requires it there)
|
|
483
|
+
const newsletterMediaType = getMediaType(normalizeMessageContent(patched) || patched);
|
|
484
|
+
if (newsletterMediaType) {
|
|
485
|
+
extraAttrs['mediatype'] = newsletterMediaType;
|
|
486
|
+
}
|
|
487
|
+
if (patched.interactiveMessage && !extraAttrs['mediatype']) {
|
|
488
|
+
extraAttrs['mediatype'] = 'interactive';
|
|
489
|
+
}
|
|
481
490
|
const bytes = encodeNewsletterMessage(patched);
|
|
482
491
|
binaryNodeContent.push({
|
|
483
492
|
tag: 'plaintext',
|
|
484
|
-
attrs:
|
|
493
|
+
attrs: extraAttrs,
|
|
485
494
|
content: bytes
|
|
486
495
|
});
|
|
487
496
|
const stanza = {
|
|
@@ -489,13 +498,12 @@ export const makeMessagesSocket = (config) => {
|
|
|
489
498
|
attrs: {
|
|
490
499
|
to: jid,
|
|
491
500
|
id: msgId,
|
|
492
|
-
type: getMessageType(
|
|
493
|
-
...(extraAttrs || {}),
|
|
501
|
+
type: getMessageType(patched),
|
|
494
502
|
...(additionalAttributes || {})
|
|
495
503
|
},
|
|
496
504
|
content: binaryNodeContent
|
|
497
505
|
};
|
|
498
|
-
logger.debug({ msgId }, `sending newsletter message to ${jid}`);
|
|
506
|
+
logger.debug({ msgId, mediaType: newsletterMediaType, extraAttrs }, `sending newsletter message to ${jid}`);
|
|
499
507
|
await sendNode(stanza);
|
|
500
508
|
return;
|
|
501
509
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuiisweety/baileys",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.18",
|
|
5
5
|
"description": "A WebSockets library for interacting with WhatsApp Web — forked STRICTLY from @whiskeysockets/baileys only, NOT from any other baileys fork. Modified by NuiiS4TORU.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"whatsapp",
|