@yudzxml/baileys 7.3.6 → 7.3.7

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 CHANGED
@@ -77,8 +77,8 @@ import makeWASocket from '@yudzxml/baileys'
77
77
 
78
78
  ## 📚 Documentation
79
79
 
80
- - **[Official Channel](https://whatsapp.com/channel/0029Vb7rkVo5q08hZXxxrY3v)**
81
- - **[Group Community](https://chat.whatsapp.com/B9v9lXijkfPKr4QmAQgApu?mode=gi_t)**
80
+ - **[Official Documentation](https://guide.whiskeysockets.io/)** (Core Baileys Docs)
81
+ - **[Discord Community](https://discord.gg/nqssuNjjSH)**
82
82
 
83
83
  ---
84
84
 
@@ -292,6 +292,15 @@ await sock.sendMessage(jid, {
292
292
  })
293
293
  ```
294
294
 
295
+ ### Status Group
296
+ ```ts
297
+ await sock.sendMessage(jid, {
298
+ groupStatusMessage: {
299
+ text: // support image/video
300
+ }
301
+ })
302
+ ```
303
+
295
304
  ---
296
305
 
297
306
  ## Advanced Features
@@ -397,4 +406,4 @@ MIT - Copyright (c) 2026 Yudzxml
397
406
 
398
407
  <div align="center">
399
408
  Made with ❤️ by Yudzxml
400
- </div>
409
+ </div>
@@ -32,7 +32,8 @@ const {
32
32
  parseAndInjectE2ESessions,
33
33
  unixTimestampSeconds,
34
34
  prepareAlbumMessageContent,
35
- aggregateMessageKeysNotFromMe
35
+ aggregateMessageKeysNotFromMe,
36
+ generateWAMessageContent
36
37
  } = require("../Utils")
37
38
  const { WAMessageAddressingMode } = require("../Types")
38
39
  const {
@@ -1621,31 +1622,76 @@ const makeMessagesSocket = (config) => {
1621
1622
  return msg
1622
1623
  },
1623
1624
 
1624
- sendMessage: async (jid, content, options = {}) => {
1625
- const userJid = authState.creds.me.id
1626
- const buildAttributes = () => ({})
1627
- let additionalAttributes = buildAttributes()
1628
-
1629
- const isObj = typeof content === 'object' && content !== null
1630
- if (options.ephemeralExpiration === undefined) {
1631
- if (isJidGroup(jid)) {
1632
- options.ephemeralExpiration = await getEphemeralGroup(jid)
1633
- }
1634
- }
1635
-
1636
- if (isObj && 'disappearingMessagesInChat' in content && content.disappearingMessagesInChat !== undefined && isJidGroup(jid)) {
1637
- const value = typeof content.disappearingMessagesInChat === 'boolean' ? (content.disappearingMessagesInChat ? WA_DEFAULT_EPHEMERAL : 0) : content.disappearingMessagesInChat
1638
-
1639
- await groupToggleEphemeral(jid, value)
1640
- return
1641
- }
1642
-
1643
- if (isObj && content.album) {
1644
- const albumMsg = await prepareAlbumMessageContent(jid, content.album, {
1645
- suki: { relayMessage, waUploadToServer },
1646
- userJid,
1647
- ...options
1625
+ sendMessage: async (jid, content, options = {}) => {
1626
+ const userJid = authState.creds.me.id
1627
+ const isObj = typeof content === 'object' && content !== null
1628
+
1629
+ let mediaHandle
1630
+ let additionalAttributes = {}
1631
+
1632
+ const buildAttributes = () => ({})
1633
+
1634
+ if (options.ephemeralExpiration === undefined && isJidGroup(jid)) {
1635
+ options.ephemeralExpiration = await getEphemeralGroup(jid)
1636
+ }
1637
+
1638
+ if (
1639
+ isObj &&
1640
+ 'disappearingMessagesInChat' in content &&
1641
+ content.disappearingMessagesInChat !== undefined &&
1642
+ isJidGroup(jid)
1643
+ ) {
1644
+ const value =
1645
+ typeof content.disappearingMessagesInChat === 'boolean'
1646
+ ? (
1647
+ content.disappearingMessagesInChat
1648
+ ? WA_DEFAULT_EPHEMERAL
1649
+ : 0
1650
+ )
1651
+ : content.disappearingMessagesInChat
1652
+
1653
+ await groupToggleEphemeral(jid, value)
1654
+ return
1655
+ }
1656
+
1657
+ if (isObj && content.groupStatusMessage) {
1658
+ const storyData = content.groupStatusMessage
1659
+ let waMsgContent
1660
+
1661
+ if (storyData.message) {
1662
+ waMsgContent = storyData
1663
+ } else {
1664
+ const generateContent = generateWAMessageContent
1665
+
1666
+ waMsgContent = await generateContent(storyData, {
1667
+ upload: waUploadToServer
1668
+ })
1669
+ }
1670
+
1671
+ const msg = {
1672
+ groupStatusMessageV2: {
1673
+ message: waMsgContent.message || waMsgContent
1674
+ }
1675
+ }
1676
+
1677
+ return await relayMessage(jid, msg, {
1678
+ messageId: generateMessageID()
1648
1679
  })
1680
+ }
1681
+
1682
+ if (isObj && content.album) {
1683
+ const albumMsg = await prepareAlbumMessageContent(
1684
+ jid,
1685
+ content.album,
1686
+ {
1687
+ suki: {
1688
+ relayMessage,
1689
+ waUploadToServer
1690
+ },
1691
+ userJid,
1692
+ ...options
1693
+ }
1694
+ )
1649
1695
 
1650
1696
  const results = []
1651
1697
 
@@ -1656,7 +1702,8 @@ const makeMessagesSocket = (config) => {
1656
1702
 
1657
1703
  await relayMessage(jid, media.message, {
1658
1704
  messageId: media.key.id,
1659
- useCachedGroupMetadata: options.useCachedGroupMetadata,
1705
+ useCachedGroupMetadata:
1706
+ options.useCachedGroupMetadata,
1660
1707
  additionalAttributes: attrs,
1661
1708
  statusJidList: options.statusJidList,
1662
1709
  additionalNodes: options.additionalNodes,
@@ -1669,31 +1716,38 @@ const makeMessagesSocket = (config) => {
1669
1716
  return results
1670
1717
  }
1671
1718
 
1672
- let mediaHandle
1673
-
1674
1719
  const fullMsg = await generateWAMessage(jid, content, {
1675
1720
  logger,
1676
1721
  userJid,
1722
+
1677
1723
  getUrlInfo: text =>
1678
1724
  getUrlInfo(text, {
1679
- thumbnailWidth: linkPreviewImageThumbnailWidth,
1725
+ thumbnailWidth:
1726
+ linkPreviewImageThumbnailWidth,
1680
1727
  fetchOpts: {
1681
1728
  timeout: 3000,
1682
1729
  ...(httpRequestOptions || {})
1683
1730
  },
1684
1731
  logger,
1685
- uploadImage: generateHighQualityLinkPreview
1686
- ? waUploadToServer
1687
- : undefined
1732
+ uploadImage:
1733
+ generateHighQualityLinkPreview
1734
+ ? waUploadToServer
1735
+ : undefined
1688
1736
  }),
1737
+
1689
1738
  getProfilePicUrl: profilePictureUrl,
1690
1739
  getCallLink: createCallLink,
1691
1740
 
1692
1741
  upload: async (readStream, opts) => {
1693
- const up = await waUploadToServer(readStream, {
1694
- ...opts,
1695
- newsletter: isJidNewsletter(jid)
1696
- })
1742
+ const up = await waUploadToServer(
1743
+ readStream,
1744
+ {
1745
+ ...opts,
1746
+ newsletter:
1747
+ isJidNewsletter(jid)
1748
+ }
1749
+ )
1750
+
1697
1751
  mediaHandle = up.handle
1698
1752
  return up
1699
1753
  },
@@ -1703,14 +1757,18 @@ const makeMessagesSocket = (config) => {
1703
1757
  messageId: generateMessageID(userJid),
1704
1758
  ...options
1705
1759
  })
1706
-
1760
+
1707
1761
  const isPin = isObj && content.pin
1708
1762
  const isEdit = isObj && content.edit
1709
1763
  const isDelete = isObj && content.delete
1710
- const isKeep = isObj && content.keep?.type === 2
1711
-
1712
- const isPollMessage = isObj && 'poll' in content && !!content.poll
1713
- const isEventMsg = isObj && 'event' in content && !!content.event
1764
+ const isKeep =
1765
+ isObj && content.keep?.type === 2
1766
+
1767
+ const isPollMessage =
1768
+ isObj && !!content.poll
1769
+
1770
+ const isEventMsg =
1771
+ isObj && !!content.event
1714
1772
 
1715
1773
  if (isDelete || isKeep) {
1716
1774
  const isGroupAdminDelete =
@@ -1718,39 +1776,53 @@ const makeMessagesSocket = (config) => {
1718
1776
  !content.delete?.fromMe
1719
1777
 
1720
1778
  additionalAttributes.edit =
1721
- isGroupAdminDelete || isJidNewsletter(jid)
1779
+ isGroupAdminDelete ||
1780
+ isJidNewsletter(jid)
1722
1781
  ? '8'
1723
1782
  : '7'
1724
- }
1725
-
1726
- else if (isEdit) {
1727
- additionalAttributes.edit = isJidNewsletter(jid) ? '3' : '1'
1728
- }
1729
-
1730
- else if (isPin) {
1783
+ } else if (isEdit) {
1784
+ additionalAttributes.edit =
1785
+ isJidNewsletter(jid)
1786
+ ? '3'
1787
+ : '1'
1788
+ } else if (isPin) {
1731
1789
  additionalAttributes.edit = '2'
1732
1790
  }
1733
1791
 
1734
1792
  if (mediaHandle) {
1735
- additionalAttributes.media_id = mediaHandle
1793
+ additionalAttributes.media_id =
1794
+ mediaHandle
1736
1795
  }
1737
-
1796
+
1797
+ const internalAdditionalNodes = []
1798
+
1738
1799
  if (isObj && content.ai === true) {
1739
1800
  const msgType = Object.keys(fullMsg.message || {})[0]
1740
-
1741
- if (msgType && fullMsg.message[msgType]) {
1742
- fullMsg.message[msgType].contextInfo = {
1743
- ...(fullMsg.message[msgType].contextInfo || {}),
1744
- businessMessageType: 3,
1745
- aiMessageMetadata: {
1746
- isAiMessage: true
1747
- }
1801
+ const msgContent =
1802
+ fullMsg.message?.[msgType]
1803
+
1804
+ if (
1805
+ msgType &&
1806
+ msgContent &&
1807
+ typeof msgContent === 'object'
1808
+ ) {
1809
+ msgContent.contextInfo = {
1810
+ ...(msgContent.contextInfo || {}),
1811
+ businessMessageType: 3,
1812
+ aiMessageMetadata: {
1813
+ isAiMessage: true
1748
1814
  }
1749
1815
  }
1750
1816
  }
1817
+
1818
+ internalAdditionalNodes.push({
1819
+ tag: 'bot',
1820
+ attrs: {
1821
+ biz_bot: '1'
1822
+ }
1823
+ })
1824
+ }
1751
1825
 
1752
- let internalAdditionalNodes = []
1753
-
1754
1826
  if (isPollMessage) {
1755
1827
  internalAdditionalNodes.push({
1756
1828
  tag: 'meta',
@@ -1769,23 +1841,31 @@ const makeMessagesSocket = (config) => {
1769
1841
 
1770
1842
  await relayMessage(jid, fullMsg.message, {
1771
1843
  messageId: fullMsg.key.id,
1772
- useCachedGroupMetadata: options.useCachedGroupMetadata,
1844
+ useCachedGroupMetadata:
1845
+ options.useCachedGroupMetadata,
1773
1846
  additionalAttributes,
1774
- statusJidList: options.statusJidList,
1775
- additionalNodes: [...(options.additionalNodes || []), ...internalAdditionalNodes],
1847
+ statusJidList:
1848
+ options.statusJidList,
1849
+ additionalNodes: [
1850
+ ...(options.additionalNodes || []),
1851
+ ...internalAdditionalNodes
1852
+ ],
1776
1853
  AI: options.ai
1777
1854
  })
1778
1855
 
1779
1856
  if (config.emitOwnEvents) {
1780
1857
  process.nextTick(async () => {
1781
1858
  await messageMutex.mutex(() =>
1782
- upsertMessage(fullMsg, 'append')
1859
+ upsertMessage(
1860
+ fullMsg,
1861
+ 'append'
1862
+ )
1783
1863
  )
1784
1864
  })
1785
1865
  }
1786
1866
 
1787
1867
  return fullMsg
1788
- }
1868
+ }
1789
1869
  }
1790
1870
  }
1791
1871
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yudzxml/baileys",
3
- "version": "7.3.6",
3
+ "version": "7.3.7",
4
4
  "description": "WhatsApp API Modification By Yudzxml",
5
5
  "keywords": [
6
6
  "whatsapp",
@@ -12,22 +12,28 @@
12
12
  "automation",
13
13
  "multi-device"
14
14
  ],
15
+
15
16
  "homepage": "https://github.com/Yudzxml/Baileys",
17
+
16
18
  "bugs": {
17
- "url": "https://github.com/Yudzxml/Baileys/issues"
19
+ "url": "https://github.com/Yudzxml/Baileys/issues"
18
20
  },
21
+
19
22
  "repository": {
20
23
  "type": "git",
21
24
  "url": "https://github.com/Yudzxml/Baileys.git"
22
25
  },
26
+
23
27
  "license": "MIT",
24
28
  "author": "Yudzxml",
29
+
25
30
  "main": "lib/index.js",
26
31
  "files": [
27
32
  "lib/*",
28
33
  "WAProto/*",
29
34
  "engine-requirements.js"
30
35
  ],
36
+
31
37
  "scripts": {
32
38
  "changelog:last": "conventional-changelog -p angular -r 2",
33
39
  "changelog:preview": "conventional-changelog -p angular -u",
@@ -38,6 +44,7 @@
38
44
  "release": "release-it",
39
45
  "test": "jest"
40
46
  },
47
+
41
48
  "dependencies": {
42
49
  "@hapi/boom": "^9.1.3",
43
50
  "@adiwajshing/keyed-db": "^0.2.4",
@@ -57,6 +64,7 @@
57
64
  "qrcode-terminal": "^0.12.0",
58
65
  "ws": "^8.13.0"
59
66
  },
67
+
60
68
  "devDependencies": {
61
69
  "@types/jest": "^29.5.14",
62
70
  "@types/node": "^16.0.0",
@@ -76,19 +84,24 @@
76
84
  "typedoc-plugin-markdown": "4.4.2",
77
85
  "typescript": "^5.8.2"
78
86
  },
87
+
79
88
  "peerDependencies": {
80
- "jimp": "^0.22.12",
89
+ "jimp": "^0.22.12",
81
90
  "sharp": "*"
82
91
  },
92
+
83
93
  "peerDependenciesMeta": {
84
94
  "jimp": {
85
95
  "optional": true
86
96
  }
87
97
  },
98
+
88
99
  "packageManager": "yarn@1.22.19",
100
+
89
101
  "engines": {
90
102
  "node": ">=20.0.0"
91
103
  },
104
+
92
105
  "directories": {
93
106
  "lib": "lib"
94
107
  }