ishumdz-bail 1.0.24 → 1.0.25

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.
@@ -652,12 +652,27 @@ export const generateWAMessageContent = async (message, options) => {
652
652
  m = { interactiveMessage };
653
653
  }
654
654
  else if ('buttonsMessage' in message && !!message.buttonsMessage) {
655
- // PATCH: raw buttonsMessage — always classic pass-through. Modern clients
656
- // render the horizontal row when a header exists (image/video/document/
657
- // location) or when a thumbnail header is attached; text-only without any
658
- // header is the "version doesn't support it" case. Add a header in that
659
- // situation, or use the `buttons` API which auto-adds one.
660
- m = { buttonsMessage: proto.Message.ButtonsMessage.create(message.buttonsMessage) };
655
+ // PATCH: raw buttonsMessage — classic pass-through. Modern clients render
656
+ // the horizontal row only when a header exists (image/video/document/
657
+ // location). A text-only raw message WITHOUT any header is exactly the
658
+ // "version doesn't support it" case — so when the caller passed none, we
659
+ // attach the invisible 1x1 PNG image header automatically (same trick the
660
+ // `buttons` API uses) and the row always renders. This is unconditional:
661
+ // header-less raw messages can never produce the "not supported" bubble.
662
+ const raw = proto.Message.ButtonsMessage.fromObject(message.buttonsMessage)
663
+ // NOTE: fromObject turns missing fields into null (protobuf defaults), so
664
+ // a nullish headerType (= caller never set it) counts as "no header" too.
665
+ const hasHeader = !!(raw.imageMessage || raw.videoMessage || raw.documentMessage ||
666
+ raw.locationMessage ||
667
+ (raw.headerType != null && raw.headerType !== ButtonType.EMPTY && raw.headerType !== ButtonType.UNKNOWN))
668
+ if (!hasHeader) {
669
+ try {
670
+ const media = await prepareWAMessageMedia({ image: BUTTONS_INVISIBLE_PNG() }, options)
671
+ raw.imageMessage = media.imageMessage
672
+ raw.headerType = ButtonType.IMAGE
673
+ } catch { /* upload failed — send as-is */ }
674
+ }
675
+ m = { buttonsMessage: raw };
661
676
  }
662
677
  else if ('buttons' in message && !!message.buttons) {
663
678
  // PATCH: `buttons` API — HORIZONTAL button row via classic ButtonsMessage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ishumdz-bail",
3
- "version": "1.0.24",
3
+ "version": "1.0.25",
4
4
  "description": "WhatsApp API Modification By Lovely",
5
5
  "keywords": [
6
6
  "whatsapp",