@zhuxee/baileys 0.3.19 → 0.3.20

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.
@@ -1102,6 +1102,19 @@ export const generateWAMessageContent = async (message, options) => {
1102
1102
  }
1103
1103
  if (hasOptionalProperty(message, 'text')) {
1104
1104
  interactiveMessage.body = { text: message.text };
1105
+ // FIX(menu-image): text + image dikirim bersamaan -> bangun header dari media (m)
1106
+ if (m && (m.imageMessage || m.videoMessage || m.documentMessage)) {
1107
+ if (m.imageMessage && !m.imageMessage.jpegThumbnail) {
1108
+ const _thumb = Buffer.isBuffer(message.jpegThumbnail) ? message.jpegThumbnail : (Buffer.isBuffer(message.thumbnail) ? message.thumbnail : null);
1109
+ if (_thumb) m.imageMessage.jpegThumbnail = _thumb;
1110
+ }
1111
+ interactiveMessage.header = {
1112
+ title: message.title || '',
1113
+ subtitle: message.subtitle || '',
1114
+ hasMediaAttachment: true
1115
+ };
1116
+ Object.assign(interactiveMessage.header, m);
1117
+ }
1105
1118
  }
1106
1119
  else {
1107
1120
  if (hasOptionalProperty(message, 'caption')) {
@@ -1114,6 +1127,12 @@ export const generateWAMessageContent = async (message, options) => {
1114
1127
  subtitle: message.subtitle || '',
1115
1128
  hasMediaAttachment: isValidHeader
1116
1129
  };
1130
+
1131
+ // FIX: Tambah imageMessage ke header
1132
+ if (message.imageMessage) {
1133
+ interactiveMessage.header.imageMessage = message.imageMessage;
1134
+ interactiveMessage.header.hasMediaAttachment = true;
1135
+ }
1117
1136
  interactiveMessage.body = { text: message.caption };
1118
1137
  }
1119
1138
  if (hasOptionalProperty(message, 'thumbnail') && !!message.thumbnail) {