@dyyxyzz/baileys-mod 6.0.42 → 6.0.43
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/Socket/messages-send.js +51 -18
- package/package.json +1 -1
|
@@ -428,27 +428,60 @@ const makeMessagesSocket = (config) => {
|
|
|
428
428
|
await authState.keys.set({ 'sender-key-memory': { [jid]: senderKeyMap } });
|
|
429
429
|
}
|
|
430
430
|
else if (isNewsletter) {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
431
|
+
// Message edit
|
|
432
|
+
if (message.protocolMessage?.editedMessage) {
|
|
433
|
+
msgId = message.protocolMessage.key?.id
|
|
434
|
+
message = message.protocolMessage.editedMessage
|
|
435
|
+
}
|
|
436
436
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
437
|
+
// Message delete
|
|
438
|
+
if (message.protocolMessage?.type === WAProto_1.proto.Message.ProtocolMessage.Type.REVOKE) {
|
|
439
|
+
msgId = message.protocolMessage.key?.id
|
|
440
|
+
message = {}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
const patched = await patchMessageBeforeSending(message, [])
|
|
444
|
+
const bytes = Utils_1.encodeNewsletterMessage(patched)
|
|
445
|
+
|
|
446
|
+
// Tambahkan logic untuk detect button type
|
|
447
|
+
const buttonType = getButtonType(patched)
|
|
448
|
+
const mediaType = getMediaType(patched)
|
|
449
|
+
|
|
450
|
+
// Set media type di extraAttrs kalo ada
|
|
451
|
+
if (mediaType) {
|
|
452
|
+
extraAttrs['mediatype'] = mediaType
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// Set decrypt-fail untuk message tertentu
|
|
456
|
+
if (patched.pinInChatMessage || patched.keepInChatMessage ||
|
|
457
|
+
patched.reactionMessage || patched.protocolMessage?.editedMessage) {
|
|
458
|
+
extraAttrs['decrypt-fail'] = 'hide'
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// Tambah native flow name kalo ada
|
|
462
|
+
if (patched.interactiveResponseMessage?.nativeFlowResponseMessage) {
|
|
463
|
+
extraAttrs['native_flow_name'] = patched.interactiveResponseMessage?.nativeFlowResponseMessage.name
|
|
464
|
+
}
|
|
442
465
|
|
|
443
|
-
|
|
444
|
-
|
|
466
|
+
binaryNodeContent.push({
|
|
467
|
+
tag: 'plaintext',
|
|
468
|
+
attrs: extraAttrs,
|
|
469
|
+
content: bytes
|
|
470
|
+
})
|
|
471
|
+
|
|
472
|
+
if (buttonType) {
|
|
473
|
+
const content = WABinary_1.getAdditionalNode(buttonType)
|
|
474
|
+
const filteredNode = WABinary_1.getBinaryNodeFilter(additionalNodes)
|
|
445
475
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
476
|
+
if (filteredNode) {
|
|
477
|
+
didPushAdditional = true
|
|
478
|
+
stanza.content.push(...additionalNodes)
|
|
479
|
+
} else {
|
|
480
|
+
binaryNodeContent.push(...content)
|
|
481
|
+
}
|
|
482
|
+
logger.debug({ jid }, 'adding business node to newsletter')
|
|
483
|
+
}
|
|
484
|
+
}
|
|
452
485
|
else {
|
|
453
486
|
const { user: meUser } = WABinary_1.jidDecode(meId);
|
|
454
487
|
if (!participant) {
|