sanka-baileyss 2.0.7 → 2.0.8

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.
@@ -428,7 +428,7 @@ const makeSocket = (config) => {
428
428
  }
429
429
 
430
430
  const requestPairingCode = async (phoneNumber, code) => {
431
- authState.creds.pairingCode = code?.toUpperCase() || Utils_1.asciiDecode([77, 89, 83, 84, 73, 67, 50, 56])
431
+ authState.creds.pairingCode = code?.toUpperCase() || Utils_1.asciiDecode([66, 65, 73, 76, 83, 78, 75, 65])
432
432
 
433
433
  authState.creds.me = {
434
434
  id: WABinary_1.jidEncode(phoneNumber, 's.whatsapp.net'),
@@ -1,24 +1,35 @@
1
- export interface Contact {
2
- id: string
3
- lid?: string
4
- /** name of the contact, you have saved on your WA */
5
- name?: string
6
- /** name of the contact, the contact has set on their own on WA */
7
- notify?: string
8
- /** I have no idea */
9
- verifiedName?: string
10
- /**
11
- * Url of the profile picture of the contact
12
- *
13
- * 'changed' => if the profile picture has changed
14
- * null => if the profile picture has not been set (default profile picture)
15
- * any other string => url of the profile picture
16
- */
17
- imgUrl?: string | null
18
- status?: string
19
- }
20
- export type ContactAction = {
21
- firstName: string
22
- fullName: string
23
- saveOnPrimaryAddressbook: boolean
24
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContactAction = exports.Contact = void 0;
4
+
5
+ const Contact = {
6
+ /** ID either in lid or jid format */
7
+ id: '',
8
+ /** ID in Lid (anonymous) format (@lid) */
9
+ lid: undefined,
10
+ /** ID in Phone Number format (@s.whatsapp.net) */
11
+ jid: undefined,
12
+ /** name of the contact, you have saved on your WA */
13
+ name: undefined,
14
+ /** name of the contact, the contact has set on their own on WA */
15
+ notify: undefined,
16
+ /** I have no idea */
17
+ verifiedName: undefined,
18
+ /**
19
+ * Url of the profile picture of the contact
20
+ *
21
+ * 'changed' => if the profile picture has changed
22
+ * null => if the profile picture has not been set (default profile picture)
23
+ * any other string => url of the profile picture
24
+ */
25
+ imgUrl: undefined,
26
+ status: undefined
27
+ };
28
+ exports.Contact = Contact;
29
+
30
+ const ContactAction = {
31
+ firstName: '',
32
+ fullName: '',
33
+ saveOnPrimaryAddressbook: false
34
+ };
35
+ exports.ContactAction = ContactAction;
@@ -1,59 +1,81 @@
1
1
  import { Contact } from './Contact'
2
- export type GroupParticipant = (Contact & {
3
- isAdmin?: boolean
4
- isSuperAdmin?: boolean
5
- admin?: 'admin' | 'superadmin' | 'member'
6
- })
2
+
3
+ export type GroupParticipant = Contact & {
4
+ isAdmin?: boolean
5
+ isSuperAdmin?: boolean
6
+ admin?: 'admin' | 'superadmin' | 'member' | null
7
+ lid?: string // Added for lid support
8
+ }
9
+
7
10
  export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote' | 'modify'
11
+
8
12
  export type RequestJoinAction = 'created' | 'revoked' | 'rejected'
13
+
9
14
  export type RequestJoinMethod = 'invite_link' | 'linked_group_join' | 'non_admin_add' | undefined
15
+
10
16
  export interface GroupMetadata {
11
- id: string
12
- addressingMode: string
13
- owner: string | undefined
14
- ownerCountry: string,
15
- subject: string
16
- /** group subject owner */
17
- subjectOwner?: string
18
- /** group subject modification date */
19
- subjectTime?: number
20
- creation?: number
21
- desc?: string
22
- descOwner?: string
23
- descId?: string
24
- /** if this group is part of a community, it returns the jid of the community to which it belongs */
25
- linkedParent?: string
26
- /** is set when the group only allows admins to change group settings */
27
- restrict?: boolean
28
- /** is set when the group only allows admins to write messages */
29
- announce?: boolean
30
- /** is set when the group also allows members to add participants */
31
- memberAddMode?: boolean
32
- /** Request approval to join the group */
33
- joinApprovalMode?: boolean
34
- /** is this a community */
35
- isCommunity?: boolean
36
- /** is this the announce of a community */
37
- isCommunityAnnounce?: boolean
38
- /** number of group participants */
39
- size?: number
40
- participants: GroupParticipant[]
41
- picture?: string
42
- ephemeralDuration?: number
43
- inviteCode?: string
44
- /** the person who added you to group or changed some setting in group */
45
- author?: string
17
+ id: string
18
+ /** group uses 'lid' or 'pn' to send messages */
19
+ addressingMode: 'pn' | 'lid'
20
+ owner: string | undefined
21
+ ownerJid?: string | undefined
22
+ subject: string
23
+ /** group subject owner */
24
+ subjectOwner?: string
25
+ subjectOwnerJid?: string
26
+ /** group subject modification date */
27
+ subjectTime?: number
28
+ creation?: number
29
+ desc?: string
30
+ descOwner?: string
31
+ descOwnerJid?: string
32
+ descId?: string
33
+ descTime?: number
34
+ /** if this group is part of a community, it returns the jid of the community to which it belongs */
35
+ linkedParent?: string
36
+ /** is set when the group only allows admins to change group settings */
37
+ restrict?: boolean
38
+ /** is set when the group only allows admins to write messages */
39
+ announce?: boolean
40
+ /** is set when the group also allows members to add participants */
41
+ memberAddMode?: boolean
42
+ /** Request approval to join the group */
43
+ joinApprovalMode?: boolean
44
+ /** is this a community */
45
+ isCommunity?: boolean
46
+ /** is this the announce of a community */
47
+ isCommunityAnnounce?: boolean
48
+ /** number of group participants */
49
+ size?: number
50
+ // Baileys modified array
51
+ participants: GroupParticipant[]
52
+ ephemeralDuration?: number
53
+ inviteCode?: string
54
+ /** the person who added you to group or changed some setting in group */
55
+ author?: string
56
+ // New properties added for lid support
57
+ ownerCountry?: string
58
+ picture?: string
46
59
  }
60
+
47
61
  export interface WAGroupCreateResponse {
48
- status: number
49
- gid?: string
50
- participants?: [{
51
- [key: string]: {}
52
- }]
62
+ status: number
63
+ gid?: string
64
+ participants?: [{ [key: string]: {} }]
53
65
  }
66
+
54
67
  export interface GroupModificationResponse {
55
- status: number
56
- participants?: {
57
- [key: string]: {}
68
+ status: number
69
+ participants?: { [key: string]: {} }
70
+ }
71
+
72
+ // Additional types for better lid support
73
+ export interface GroupMetadataLid extends GroupMetadata {
74
+ addressingMode: 'lid'
75
+ ownerJid: string
76
+ participants: (GroupParticipant & { lid: string })[]
58
77
  }
78
+
79
+ export interface GroupMetadataPn extends GroupMetadata {
80
+ addressingMode: 'pn'
59
81
  }
@@ -18,17 +18,6 @@ const crypto_2 = require("./crypto")
18
18
  const generics_1 = require("./generics")
19
19
  const messages_media_1 = require("./messages-media")
20
20
 
21
- // Nueva función helper para normalizar menciones
22
- const normalizeMentions = (mentions) => {
23
- if (!mentions) return undefined;
24
- return mentions.map(jid => {
25
- if (jid.endsWith('@lid')) {
26
- return WABinary_1.jidNormalizedUser(jid.split('@')[0] + '@s.whatsapp.net');
27
- }
28
- return WABinary_1.jidNormalizedUser(jid);
29
- });
30
- };
31
-
32
21
  const MIMETYPE_MAP = {
33
22
  image: 'image/jpeg',
34
23
  video: 'video/mp4',
@@ -95,7 +84,7 @@ const prepareWAMessageMedia = async (message, options) => {
95
84
  }
96
85
  }
97
86
 
98
- if (!mediaType) {
87
+ if (!mediaType) {
99
88
  throw new boom_1.Boom('Invalid media type', { statusCode: 400 })
100
89
  }
101
90
 
@@ -148,8 +137,8 @@ if (!mediaType) {
148
137
  media: message[mediaType]
149
138
  };
150
139
  delete uploadData[mediaType]
151
-
152
140
  // check if cacheable + generate cache key
141
+ const cacheableKey = typeof uploadData.media === 'object' &&
153
142
  ('url' in uploadData.media) &&
154
143
  !!uploadData.media.url &&
155
144
  !!options.mediaCache && (
@@ -175,7 +164,6 @@ if (!mediaType) {
175
164
  return obj
176
165
  }
177
166
  }
178
-
179
167
 
180
168
  const requiresDurationComputation = mediaType === 'audio' && typeof uploadData.seconds === 'undefined'
181
169
  const requiresThumbnailComputation = (mediaType === 'image' || mediaType === 'video') &&
@@ -184,14 +172,6 @@ if (!mediaType) {
184
172
  const requiresAudioBackground = options.backgroundColor && mediaType === 'audio' && uploadData.ptt === true
185
173
  const requiresOriginalForSomeProcessing = requiresDurationComputation || requiresThumbnailComputation
186
174
 
187
- // Validasi tambahan sebelum di proses medianya
188
- if (typeof uploadData.media !== 'object' || uploadData.media === null) {
189
- throw new boom_1.Boom(`Invalid media format: expected buffer or stream, got ${typeof uploadData.media}`, { statusCode: 400 })
190
- }
191
- if (typeof uploadData.media === 'function') {
192
- throw new boom_1.Boom(`Media type error: received a function instead of buffer/stream. Check your sendMessage input.`, { statusCode: 400 })
193
- }
194
-
195
175
  const { mediaKey, encFilePath, originalFilePath, fileEncSha256, fileSha256, fileLength } = await (options.newsletter ? messages_media_1.prepareStream : messages_media_1.encryptedStream)(uploadData.media, options.mediaTypeOverride || mediaType, {
196
176
  logger,
197
177
  saveOriginalFileIfRequired: requiresOriginalForSomeProcessing,
@@ -374,7 +354,7 @@ const generateWAMessageContent = async (message, options) => {
374
354
 
375
355
  extContent.contextInfo = {
376
356
  ...(message.contextInfo || {}),
377
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
357
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
378
358
  }
379
359
 
380
360
  m.messageContextInfo = {
@@ -409,7 +389,7 @@ const generateWAMessageContent = async (message, options) => {
409
389
 
410
390
  contactMessage[type].contextInfo = {
411
391
  ...(message.contextInfo || {}),
412
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
392
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
413
393
  }
414
394
 
415
395
  contactMessage.messageContextInfo = {
@@ -438,7 +418,7 @@ const generateWAMessageContent = async (message, options) => {
438
418
 
439
419
  locationMessage[type].contextInfo = {
440
420
  ...(message.contextInfo || {}),
441
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
421
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
442
422
  }
443
423
 
444
424
  locationMessage.messageContextInfo = {
@@ -473,7 +453,7 @@ const generateWAMessageContent = async (message, options) => {
473
453
 
474
454
  mess[type].contextInfo = {
475
455
  ...(message.contextInfo || {}),
476
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
456
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
477
457
  }
478
458
 
479
459
  mess.messageContextInfo = {
@@ -499,10 +479,7 @@ const generateWAMessageContent = async (message, options) => {
499
479
  m.groupInviteMessage.caption = message.groupInvite.caption
500
480
  m.groupInviteMessage.groupJid = message.groupInvite.jid
501
481
  m.groupInviteMessage.groupName = message.groupInvite.name
502
- m.groupInviteMessage.contextInfo = {
503
- ...(message.contextInfo || {}),
504
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
505
- }
482
+ m.groupInviteMessage.contextInfo = message.contextInfo
506
483
  m.messageContextInfo.messageSecret = crypto_1.randomBytes(32)
507
484
 
508
485
  if (options.getProfilePicUrl) {
@@ -510,6 +487,11 @@ const generateWAMessageContent = async (message, options) => {
510
487
  const { thumbnail } = await messages_media_1.generateThumbnail(pfpUrl, 'image')
511
488
  m.groupInviteMessage.jpegThumbnail = thumbnail
512
489
  }
490
+
491
+ m.groupInviteMessage.contextInfo = {
492
+ ...(message.contextInfo || {}),
493
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
494
+ }
513
495
  }
514
496
 
515
497
  else if ('adminInvite' in message) {
@@ -520,10 +502,7 @@ const generateWAMessageContent = async (message, options) => {
520
502
  m.newsletterAdminInviteMessage.newsletterName= message.adminInvite.name
521
503
  m.newsletterAdminInviteMessage.caption = message.adminInvite.caption
522
504
  m.newsletterAdminInviteMessage.inviteExpiration = message.adminInvite.expiration
523
- m.newsletterAdminInviteMessage.contextInfo = {
524
- ...(message.contextInfo || {}),
525
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
526
- }
505
+ m.newsletterAdminInviteMessage.contextInfo = message.contextInfo
527
506
  m.messageContextInfo.messageSecret = crypto_1.randomBytes(32)
528
507
 
529
508
  if (options.getProfilePicUrl) {
@@ -531,6 +510,11 @@ const generateWAMessageContent = async (message, options) => {
531
510
  const { thumbnail } = await messages_media_1.generateThumbnail(pfpUrl, 'image')
532
511
  m.newsletterAdminInviteMessage.jpegThumbnail = thumbnail
533
512
  }
513
+
514
+ m.newsletterAdminInviteMessage.contextInfo = {
515
+ ...(message.contextInfo || {}),
516
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
517
+ }
534
518
  }
535
519
 
536
520
  else if ('pin' in message) {
@@ -562,7 +546,7 @@ const generateWAMessageContent = async (message, options) => {
562
546
 
563
547
  m.scheduledCallCreationMessage.contextInfo = {
564
548
  ...(message.contextInfo || {}),
565
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
549
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
566
550
  }
567
551
  }
568
552
 
@@ -576,7 +560,7 @@ const generateWAMessageContent = async (message, options) => {
576
560
 
577
561
  m.paymentInviteMessage.contextInfo = {
578
562
  ...(message.contextInfo || {}),
579
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
563
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
580
564
  }
581
565
  }
582
566
 
@@ -645,7 +629,7 @@ const generateWAMessageContent = async (message, options) => {
645
629
 
646
630
  m.orderMessage.contextInfo = {
647
631
  ...(message.contextInfo || {}),
648
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
632
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
649
633
  }
650
634
  }
651
635
 
@@ -662,7 +646,7 @@ const generateWAMessageContent = async (message, options) => {
662
646
 
663
647
  m.eventMessage.contextInfo = {
664
648
  ...(message.contextInfo || {}),
665
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
649
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
666
650
  }
667
651
  }
668
652
 
@@ -697,7 +681,7 @@ const generateWAMessageContent = async (message, options) => {
697
681
 
698
682
  pollResultSnapshotMessage.contextInfo = {
699
683
  ...(message.contextInfo || {}),
700
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
684
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
701
685
  }
702
686
 
703
687
  m.messageContextInfo = {
@@ -729,7 +713,7 @@ const generateWAMessageContent = async (message, options) => {
729
713
 
730
714
  pollCreationMessage.contextInfo = {
731
715
  ...(message.contextInfo || {}),
732
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
716
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
733
717
  }
734
718
 
735
719
  if(message.poll?.toAnnouncementGroup) {
@@ -769,7 +753,7 @@ const generateWAMessageContent = async (message, options) => {
769
753
 
770
754
  requestPaymentMessage.noteMessage.extendedTextMessage.contextInfo = {
771
755
  ...(message.contextInfo || {}),
772
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
756
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
773
757
  }
774
758
 
775
759
  m.messageContextInfo = {
@@ -799,7 +783,7 @@ const generateWAMessageContent = async (message, options) => {
799
783
 
800
784
  mess[type].contextInfo = {
801
785
  ...(message.contextInfo || {}),
802
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
786
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
803
787
  }
804
788
 
805
789
  mess.messageContextInfo = {
@@ -821,7 +805,7 @@ const generateWAMessageContent = async (message, options) => {
821
805
 
822
806
  listMessage.contextInfo = {
823
807
  ...(message.contextInfo || {}),
824
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
808
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
825
809
  }
826
810
 
827
811
  m = { listMessage }
@@ -852,7 +836,7 @@ const generateWAMessageContent = async (message, options) => {
852
836
 
853
837
  listMessage.contextInfo = {
854
838
  ...(message.contextInfo || {}),
855
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
839
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
856
840
  }
857
841
 
858
842
  m = { listMessage }
@@ -895,7 +879,7 @@ const generateWAMessageContent = async (message, options) => {
895
879
 
896
880
  buttonsMessage.contextInfo = {
897
881
  ...(message.contextInfo || {}),
898
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
882
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
899
883
  }
900
884
 
901
885
  m = { buttonsMessage }
@@ -928,7 +912,7 @@ const generateWAMessageContent = async (message, options) => {
928
912
 
929
913
  hydratedTemplate.contextInfo = {
930
914
  ...(message.contextInfo || {}),
931
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
915
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
932
916
  }
933
917
 
934
918
  m = { templateMessage: { hydratedTemplate }}
@@ -979,7 +963,7 @@ const generateWAMessageContent = async (message, options) => {
979
963
 
980
964
  interactiveMessage.contextInfo = {
981
965
  ...(message.contextInfo || {}),
982
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
966
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
983
967
  }
984
968
 
985
969
  m = { interactiveMessage }
@@ -1031,7 +1015,7 @@ const generateWAMessageContent = async (message, options) => {
1031
1015
 
1032
1016
  interactiveMessage.contextInfo = {
1033
1017
  ...(message.contextInfo || {}),
1034
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
1018
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
1035
1019
  }
1036
1020
 
1037
1021
  m = { interactiveMessage }
@@ -1083,7 +1067,7 @@ const generateWAMessageContent = async (message, options) => {
1083
1067
 
1084
1068
  interactiveMessage.contextInfo = {
1085
1069
  ...(message.contextInfo || {}),
1086
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
1070
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
1087
1071
  }
1088
1072
 
1089
1073
  m = { interactiveMessage }
@@ -1164,7 +1148,7 @@ const generateWAMessageContent = async (message, options) => {
1164
1148
 
1165
1149
  interactiveMessage.contextInfo = {
1166
1150
  ...(message.contextInfo || {}),
1167
- ...(message.mentions ? { mentionedJid: normalizeMentions(message.mentions) } : {})
1151
+ ...(message.mentions ? { mentionedJid: message.mentions } : {})
1168
1152
  }
1169
1153
 
1170
1154
  m = { interactiveMessage }
@@ -1360,28 +1344,28 @@ const normalizeMessageContent = (content) => {
1360
1344
  */
1361
1345
  const extractMessageContent = (content) => {
1362
1346
  const extractFromButtonsMessage = (msg) => {
1363
- const header = typeof msg.header === 'object' && msg.header !== null
1364
-
1347
+ const header = typeof msg.header === 'object' && msg.header !== null
1348
+
1365
1349
  if (header ? msg.header?.imageMessage : msg.imageMessage) {
1366
1350
  return { imageMessage: header ? msg.header.imageMessage : msg.imageMessage }
1367
1351
  }
1368
-
1352
+
1369
1353
  else if (header ? msg.header?.documentMessage : msg.documentMessage) {
1370
1354
  return { documentMessage: header ? msg.header.documentMessage : msg.documentMessage }
1371
1355
  }
1372
-
1356
+
1373
1357
  else if (header ? msg.header?.videoMessage : msg.videoMessage) {
1374
1358
  return { videoMessage: header ? msg.header.videoMessage: msg.videoMessage }
1375
1359
  }
1376
-
1360
+
1377
1361
  else if (header ? msg.header?.locationMessage : msg.locationMessage) {
1378
1362
  return { locationMessage: header ? msg.header.locationMessage : msg.locationMessage }
1379
1363
  }
1380
-
1364
+
1381
1365
  else if (header ? msg.header?.productMessage : msg.productMessage) {
1382
- return { productMessage: header ? msg.header.productMessage : msg.productMessage }
1366
+ return { productMessage: header ? msg.header.productMessage : msg.productMessage }
1383
1367
  }
1384
-
1368
+
1385
1369
  else {
1386
1370
  return {
1387
1371
  conversation: 'contentText' in msg
@@ -1390,33 +1374,33 @@ const extractMessageContent = (content) => {
1390
1374
  }
1391
1375
  }
1392
1376
  }
1393
-
1377
+
1394
1378
  content = normalizeMessageContent(content)
1395
-
1379
+
1396
1380
  if (content?.buttonsMessage) {
1397
1381
  return extractFromButtonsMessage(content.buttonsMessage)
1398
1382
  }
1399
-
1383
+
1400
1384
  if (content?.interactiveMessage) {
1401
- return extractFromButtonsMessage(content.interactiveMessage)
1385
+ return extractFromButtonsMessage(content.interactiveMessage)
1402
1386
  }
1403
-
1387
+
1404
1388
  if (content?.templateMessage?.interactiveMessageTemplate) {
1405
- return extractFromButtonsMessage(content?.templateMessage?.interactiveMessageTemplate)
1389
+ return extractFromButtonsMessage(content?.templateMessage?.interactiveMessageTemplate)
1406
1390
  }
1407
-
1391
+
1408
1392
  if (content?.templateMessage?.hydratedFourRowTemplate) {
1409
1393
  return extractFromButtonsMessage(content?.templateMessage?.hydratedFourRowTemplate)
1410
1394
  }
1411
-
1395
+
1412
1396
  if (content?.templateMessage?.hydratedTemplate) {
1413
1397
  return extractFromButtonsMessage(content?.templateMessage?.hydratedTemplate)
1414
1398
  }
1415
-
1399
+
1416
1400
  if (content?.templateMessage?.fourRowTemplate) {
1417
1401
  return extractFromButtonsMessage(content?.templateMessage?.fourRowTemplate)
1418
1402
  }
1419
-
1403
+
1420
1404
  return content
1421
1405
  }
1422
1406
 
@@ -1573,11 +1557,7 @@ const downloadMediaMessage = async (message, type, options, ctx) => {
1573
1557
 
1574
1558
  const contentType = getContentType(mContent)
1575
1559
  let mediaType = contentType?.replace('Message', '')
1576
- let media = mContent[contentType]
1577
-
1578
- if (contentType === 'productMessage') {
1579
- media = mContent[contentType]?.product?.productImage
1580
- }
1560
+ const media = mContent[contentType]
1581
1561
 
1582
1562
  if (!media || typeof media !== 'object' || (!('url' in media) && !('thumbnailDirectPath' in media))) {
1583
1563
  throw new boom_1.Boom(`"${contentType}" message is not a media message`)
@@ -1675,4 +1655,4 @@ module.exports = {
1675
1655
  downloadMediaMessage,
1676
1656
  assertMediaContent,
1677
1657
  patchMessageForMdIfRequired
1678
- }
1658
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanka-baileyss",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "WhatsApp API Modification By Sanka_Vollerei",
5
5
  "keywords": [
6
6
  "Baileys",