junexbaileys 1.0.5 → 1.0.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 +57 -3
- package/WAProto/GenerateStatics.sh +0 -0
- package/lib/Defaults/index.d.ts +2 -0
- package/lib/Defaults/index.d.ts.map +1 -1
- package/lib/Defaults/index.js +4 -0
- package/lib/Defaults/index.js.map +1 -1
- package/lib/Socket/business.d.ts +37 -0
- package/lib/Socket/business.d.ts.map +1 -1
- package/lib/Socket/channelStatus.d.ts +53 -0
- package/lib/Socket/channelStatus.d.ts.map +1 -0
- package/lib/Socket/channelStatus.js +90 -0
- package/lib/Socket/channelStatus.js.map +1 -0
- package/lib/Socket/communities.d.ts +37 -0
- package/lib/Socket/communities.d.ts.map +1 -1
- package/lib/Socket/groupStatus.d.ts +3 -3
- package/lib/Socket/groupStatus.d.ts.map +1 -1
- package/lib/Socket/groupStatus.js +2 -2
- package/lib/Socket/groupStatus.js.map +1 -1
- package/lib/Socket/index.d.ts +37 -0
- package/lib/Socket/index.d.ts.map +1 -1
- package/lib/Socket/messages-recv.d.ts +37 -0
- package/lib/Socket/messages-recv.d.ts.map +1 -1
- package/lib/Socket/messages-recv.js +16 -0
- package/lib/Socket/messages-recv.js.map +1 -1
- package/lib/Socket/messages-send.d.ts +41 -0
- package/lib/Socket/messages-send.d.ts.map +1 -1
- package/lib/Socket/messages-send.js +25 -2
- package/lib/Socket/messages-send.js.map +1 -1
- package/lib/Socket/stickerPack.d.ts +29 -0
- package/lib/Socket/stickerPack.d.ts.map +1 -0
- package/lib/Socket/stickerPack.js +118 -0
- package/lib/Socket/stickerPack.js.map +1 -0
- package/lib/Socket/username.d.ts +55 -0
- package/lib/Socket/username.d.ts.map +1 -0
- package/lib/Socket/username.js +114 -0
- package/lib/Socket/username.js.map +1 -0
- package/lib/Types/ChannelStatus.d.ts +34 -0
- package/lib/Types/ChannelStatus.d.ts.map +1 -0
- package/lib/Types/ChannelStatus.js +2 -0
- package/lib/Types/ChannelStatus.js.map +1 -0
- package/lib/Types/Events.d.ts +3 -0
- package/lib/Types/Events.d.ts.map +1 -1
- package/lib/Types/StickerPack.d.ts +46 -0
- package/lib/Types/StickerPack.d.ts.map +1 -0
- package/lib/Types/StickerPack.js +2 -0
- package/lib/Types/StickerPack.js.map +1 -0
- package/lib/Types/Username.d.ts +19 -0
- package/lib/Types/Username.d.ts.map +1 -0
- package/lib/Types/Username.js +2 -0
- package/lib/Types/Username.js.map +1 -0
- package/lib/Types/index.d.ts +3 -0
- package/lib/Types/index.d.ts.map +1 -1
- package/lib/Types/index.js +3 -0
- package/lib/Types/index.js.map +1 -1
- package/lib/Utils/messages-media.d.ts +4 -2
- package/lib/Utils/messages-media.d.ts.map +1 -1
- package/lib/Utils/messages-media.js +2 -2
- package/lib/Utils/messages-media.js.map +1 -1
- package/lib/Utils/zip.d.ts +11 -0
- package/lib/Utils/zip.d.ts.map +1 -0
- package/lib/Utils/zip.js +88 -0
- package/lib/Utils/zip.js.map +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ To run the example script, download or clone the repo and then type the followin
|
|
|
57
57
|
Install this fork while keeping the standard Baileys package name and imports:
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
|
-
npm install @whiskeysockets/baileys@npm:junexbaileys@1.0.
|
|
60
|
+
npm install @whiskeysockets/baileys@npm:junexbaileys@1.0.4
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
This adds the following dependency to your application's `package.json`:
|
|
@@ -65,7 +65,7 @@ This adds the following dependency to your application's `package.json`:
|
|
|
65
65
|
```json
|
|
66
66
|
{
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@whiskeysockets/baileys": "npm:junexbaileys@1.0.
|
|
68
|
+
"@whiskeysockets/baileys": "npm:junexbaileys@1.0.4"
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
```
|
|
@@ -76,7 +76,7 @@ Because the package is installed under the standard alias, keep using the normal
|
|
|
76
76
|
import makeWASocket from '@whiskeysockets/baileys'
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
The alias points to `junexbaileys@1.0.
|
|
79
|
+
The alias points to `junexbaileys@1.0.4`, while your application continues to use `@whiskeysockets/baileys` in source code.
|
|
80
80
|
|
|
81
81
|
# Links
|
|
82
82
|
|
|
@@ -183,6 +183,9 @@ The alias points to `junexbaileys@1.0.5`, while your application continues to us
|
|
|
183
183
|
- [Broadcast Lists & Stories](#broadcast-lists--stories)
|
|
184
184
|
- [Send Broadcast & Stories](#send-broadcast--stories)
|
|
185
185
|
- [Experimental Group Status Media](#experimental-group-status-media)
|
|
186
|
+
- [Channel Statuses](#channel-statuses)
|
|
187
|
+
- [Send a Sticker Pack](#send-a-sticker-pack)
|
|
188
|
+
- [WhatsApp Usernames](#whatsapp-usernames)
|
|
186
189
|
- [Query a Broadcast List's Recipients & Name](#query-a-broadcast-lists-recipients--name)
|
|
187
190
|
- [Writing Custom Functionality](#writing-custom-functionality)
|
|
188
191
|
- [Enabling Debug Level in Baileys Logs](#enabling-debug-level-in-baileys-logs)
|
|
@@ -1261,6 +1264,57 @@ await sock.sendGroupStatus(groupJid, {
|
|
|
1261
1264
|
|
|
1262
1265
|
The group JID must end in `@g.us`. `sock.sendGroupStatus` builds the inner message with the normal JunexBaileys content generator, adds the required shared message secret, and relays it in a `groupStatusMessageV2` wrapper. For text statuses, pass `backgroundColor` (and optionally `font`) as the third argument so the color is encoded in the generated `extendedTextMessage`. It does not bypass group membership, WhatsApp privacy controls, or server-side restrictions, and may not be available in published Baileys packages.
|
|
1263
1266
|
|
|
1267
|
+
### Channel Statuses
|
|
1268
|
+
|
|
1269
|
+
Channel statuses are temporary updates posted by channel admins. They are different from ordinary newsletter posts and personal `status@broadcast` stories. Posting requires the authenticated account to have permission to publish in the channel; server-side restrictions still apply.
|
|
1270
|
+
|
|
1271
|
+
```ts
|
|
1272
|
+
const channelJid = '120363000000000000@newsletter'
|
|
1273
|
+
|
|
1274
|
+
// Post a text status. Media content such as image or video is also supported.
|
|
1275
|
+
await sock.sendChannelStatus(channelJid, { text: 'A channel status update' }, {
|
|
1276
|
+
backgroundColor: '#128C7E',
|
|
1277
|
+
font: 0
|
|
1278
|
+
})
|
|
1279
|
+
|
|
1280
|
+
// Receive statuses as they arrive, including offline backlog entries.
|
|
1281
|
+
sock.ev.on('newsletter.status', status => {
|
|
1282
|
+
console.log(status.channelJid, status.text, status.messageTimestamp)
|
|
1283
|
+
})
|
|
1284
|
+
```
|
|
1285
|
+
|
|
1286
|
+
### Send a Sticker Pack
|
|
1287
|
+
|
|
1288
|
+
`sendStickerPack` uploads a ZIP of 1–60 WebP stickers plus a tray icon, then sends a pack message that recipients can add to their sticker collection.
|
|
1289
|
+
|
|
1290
|
+
```ts
|
|
1291
|
+
await sock.sendStickerPack('254700000000@s.whatsapp.net', {
|
|
1292
|
+
name: 'My Pack',
|
|
1293
|
+
publisher: 'My App',
|
|
1294
|
+
trayIcon: { url: './Media/tray.png' },
|
|
1295
|
+
stickers: [
|
|
1296
|
+
{ data: { url: './Media/sticker-1.webp' }, emojis: ['😀'] },
|
|
1297
|
+
{ data: { url: './Media/sticker-2.webp' }, emojis: ['🎉'] }
|
|
1298
|
+
]
|
|
1299
|
+
})
|
|
1300
|
+
```
|
|
1301
|
+
|
|
1302
|
+
### WhatsApp Usernames
|
|
1303
|
+
|
|
1304
|
+
The socket includes methods to check or claim your username, retrieve or delete it, set a username PIN, look up a user by username, and fetch usernames for contacts. Availability depends on the account and WhatsApp server support.
|
|
1305
|
+
|
|
1306
|
+
```ts
|
|
1307
|
+
const result = await sock.checkUsername('my_app_name')
|
|
1308
|
+
if (result.available) {
|
|
1309
|
+
await sock.setUsername(result.username, { sessionId: result.session_id })
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
const myUsername = await sock.getMyUsername()
|
|
1313
|
+
const user = await sock.findUserByUsername('someone_name')
|
|
1314
|
+
```
|
|
1315
|
+
|
|
1316
|
+
Username query identifiers are managed by WhatsApp and may rotate. If requests begin failing after a server-side change, use `sock.setUsernameQueryIds({ ... })` to update them at runtime.
|
|
1317
|
+
|
|
1264
1318
|
### Query a Broadcast List's Recipients & Name
|
|
1265
1319
|
```ts
|
|
1266
1320
|
const bList = await sock.getBroadcastListInfo('1234@broadcast')
|
|
File without changes
|
package/lib/Defaults/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Defaults/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE9C,OAAO,KAAK,EAAuB,YAAY,EAAa,MAAM,UAAU,CAAA;AAM5E,eAAO,MAAM,kBAAkB,UAAkB,CAAA;AAEjD,eAAO,MAAM,cAAc,6BAA6B,CAAA;AACxD,eAAO,MAAM,iBAAiB,qCAAqC,CAAA;AACnE,eAAO,MAAM,iBAAiB,qCAAqC,CAAA;AACnE,eAAO,MAAM,mBAAmB,QAAQ,CAAA;AACxC,eAAO,MAAM,cAAc,SAAS,CAAA;AACpC,eAAO,MAAM,mBAAmB,YAAY,CAAA;AAE5C,eAAO,MAAM,yBAAyB,qBAAsB,CAAA;AAC5D,eAAO,MAAM,wBAAwB,qBAAsB,CAAA;AAC3D,eAAO,MAAM,gCAAgC,qBAAsB,CAAA;AACnE,eAAO,MAAM,+BAA+B,qBAAsB,CAAA;AAElE,eAAO,MAAM,oBAAoB,QAAmB,CAAA;AAEpD,iEAAiE;AACjE,eAAO,MAAM,qBAAqB,QAAe,CAAA;AAEjD,2EAA2E;AAC3E,eAAO,MAAM,2BAA2B,QAAoB,CAAA;AAE5D,eAAO,MAAM,UAAU,yCAAyC,CAAA;AAChE,eAAO,MAAM,YAAY,IAAI,CAAA;AAC7B,eAAO,MAAM,eAAe,qBAAmB,CAAA;AAC/C,eAAO,MAAM,eAAe,qBAAyC,CAAA;AACrE,yGAAyG;AACzG,eAAO,MAAM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MAAM,SAAS,QAAwF,CAAA;AAE9G,eAAO,MAAM,eAAe;;;;CAI3B,CAAA;AAED,eAAO,MAAM,yBAAyB,qCAQrC,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;;CAK9B,CAAA;AAED,eAAO,MAAM,yBAAyB,EAAE,YAmCvC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE;KAAG,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,MAAM;CAavD,CAAA;AAED,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;CAsBlC,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,sBAAsB,CAAA;AAE3D,eAAO,MAAM,UAAU,EAAkC,SAAS,EAAE,CAAA;AAEpE,yHAAyH;AACzH,eAAO,MAAM,8BAA8B,SAAU,CAAA;AAErD,eAAO,MAAM,gBAAgB,IAAI,CAAA;AAEjC,eAAO,MAAM,oBAAoB,MAAM,CAAA;AAEvC,eAAO,MAAM,cAAc,QAAQ,CAAA;AAEnC,eAAO,MAAM,MAAM;;;;;CAKlB,CAAA"}
|
package/lib/Defaults/index.js
CHANGED
|
@@ -87,6 +87,8 @@ export const MEDIA_PATH_MAP = {
|
|
|
87
87
|
document: '/mms/document',
|
|
88
88
|
audio: '/mms/audio',
|
|
89
89
|
sticker: '/mms/image',
|
|
90
|
+
'sticker-pack': '/mms/sticker-pack',
|
|
91
|
+
'thumbnail-sticker-pack': '/mms/sticker-pack',
|
|
90
92
|
'thumbnail-link': '/mms/image',
|
|
91
93
|
'product-catalog-image': '/product/image',
|
|
92
94
|
'md-app-state': '',
|
|
@@ -102,6 +104,8 @@ export const MEDIA_HKDF_KEY_MAPPING = {
|
|
|
102
104
|
product: 'Image',
|
|
103
105
|
ptt: 'Audio',
|
|
104
106
|
sticker: 'Image',
|
|
107
|
+
'sticker-pack': 'Sticker Pack',
|
|
108
|
+
'thumbnail-sticker-pack': 'Sticker Pack Thumbnail',
|
|
105
109
|
video: 'Video',
|
|
106
110
|
'thumbnail-document': 'Document Thumbnail',
|
|
107
111
|
'thumbnail-image': 'Image Thumbnail',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Defaults/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,MAAM,MAAM,iBAAiB,CAAA;AAEpC,MAAM,OAAO,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,CAAA;AAErC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAEjD,MAAM,CAAC,MAAM,cAAc,GAAG,0BAA0B,CAAA;AACxD,MAAM,CAAC,MAAM,iBAAiB,GAAG,kCAAkC,CAAA;AACnE,MAAM,CAAC,MAAM,iBAAiB,GAAG,kCAAkC,CAAA;AACnE,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAA;AACxC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAA;AACpC,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAA;AAE5C,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAC5D,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAC3D,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AACnE,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,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AK,EAAE,OAAO;IACd,oBAAoB,EAAE,oBAAoB;IAC1C,iBAAiB,EAAE,iBAAiB;IACpC,iBAAiB,EAAE,iBAAiB;IACpC,gBAAgB,EAAE,gBAAgB;IAClC,aAAa,EAAE,SAAS;IACxB,cAAc,EAAE,WAAW;IAC3B,uBAAuB,EAAE,EAAE;IAC3B,kBAAkB,EAAE,oBAAoB;IACxC,GAAG,EAAE,OAAO;IACZ,iBAAiB,EAAE,OAAO;CAC1B,CAAA;AAID,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAgB,CAAA;AAEpE,yHAAyH;AACzH,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAO,CAAA;AAErD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAA;AAEjC,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAA;AAEvC,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAA,CAAC,aAAa;AAEjD,MAAM,CAAC,MAAM,MAAM,GAAG;IACrB,MAAM,EAAE,EAAE,GAAG,IAAI;IACjB,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;IACpB,GAAG,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IACxB,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;CAC7B,CAAA"}
|
package/lib/Socket/business.d.ts
CHANGED
|
@@ -32,7 +32,44 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
32
32
|
issuePrivacyTokens: (jids: string[], timestamp?: number) => Promise<any>;
|
|
33
33
|
assertSessions: (jids: string[], force?: boolean) => Promise<boolean>;
|
|
34
34
|
relayMessage: (jid: string, message: import("../index.js").proto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../index.js").MessageRelayOptions) => Promise<string>;
|
|
35
|
+
sendChannelStatus: (jid: string, content: import("../index.js").AnyMessageContent, options?: import("./channelStatus.js").ChannelStatusOptions) => Promise<import("./channelStatus.js").ChannelStatusSent>;
|
|
35
36
|
sendGroupStatus: (jid: string, content: import("../index.js").AnyMessageContent, options?: {}) => Promise<import("../index.js").WAMessage>;
|
|
37
|
+
sendStickerPack: (jid: string, pack: import("../index.js").StickerPack) => Promise<import("../index.js").StickerPackResult>;
|
|
38
|
+
checkUsername: (username: string, includeSuggestions?: boolean, sessionId?: string) => Promise<import("../index.js").UsernameCheckResult>;
|
|
39
|
+
checkUsernameMulti: (usernames: string[]) => Promise<unknown>;
|
|
40
|
+
setUsername: (username: string, options?: import("../index.js").SetUsernameOptions) => Promise<unknown>;
|
|
41
|
+
deleteUsername: () => Promise<unknown>;
|
|
42
|
+
getMyUsername: () => Promise<string | null>;
|
|
43
|
+
getUsernameRecommendations: (source?: import("../index.js").UsernameSource | null) => Promise<unknown>;
|
|
44
|
+
setUsernamePin: (pin: string | null) => Promise<unknown>;
|
|
45
|
+
findUserByUsername: (username: string, pin?: string) => Promise<import("../index.js").UsernameUser | null>;
|
|
46
|
+
fetchContactUsernames: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[]>;
|
|
47
|
+
setUsernameQueryIds: (ids: Partial<import("./username.js").UsernameQueryIds>) => {
|
|
48
|
+
CHECK: string;
|
|
49
|
+
CHECK_MULTI: string;
|
|
50
|
+
SET: string;
|
|
51
|
+
GET: string;
|
|
52
|
+
GET_RECOMMENDATIONS: string;
|
|
53
|
+
PIN_SET: string;
|
|
54
|
+
};
|
|
55
|
+
USERNAME_QUERY_IDS: {
|
|
56
|
+
CHECK: string;
|
|
57
|
+
CHECK_MULTI: string;
|
|
58
|
+
SET: string;
|
|
59
|
+
GET: string;
|
|
60
|
+
GET_RECOMMENDATIONS: string;
|
|
61
|
+
PIN_SET: string;
|
|
62
|
+
};
|
|
63
|
+
USERNAME_CHECK_RESULT: {
|
|
64
|
+
readonly SUCCESS: "SUCCESS";
|
|
65
|
+
readonly INVALID: "INVALID";
|
|
66
|
+
};
|
|
67
|
+
USERNAME_SOURCE: {
|
|
68
|
+
readonly FB: "FB";
|
|
69
|
+
readonly IG: "IG";
|
|
70
|
+
readonly USER_INPUT: "USER_INPUT";
|
|
71
|
+
readonly SUGGESTION: "SUGGESTION";
|
|
72
|
+
};
|
|
36
73
|
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../index.js").MessageReceiptType) => Promise<void>;
|
|
37
74
|
sendReceipts: (keys: import("../index.js").WAMessageKey[], type: import("../index.js").MessageReceiptType) => Promise<void>;
|
|
38
75
|
readMessages: (keys: import("../index.js").WAMessageKey[]) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"business.d.ts","sourceRoot":"","sources":["../../src/Socket/business.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC5G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AAUnE,OAAO,EAAE,KAAK,UAAU,EAAqC,MAAM,aAAa,CAAA;AAIhF,eAAO,MAAM,kBAAkB,GAAI,QAAQ,YAAY;;+BA8Od,MAAM,eAAe,MAAM;yCAjGjB,iBAAiB;;;;2BAmD/B,MAAM;;;4BAkIL,aAAa;gCAwCT,MAAM,EAAE;;;+BA9ET,MAAM,UAAU,aAAa;kCAxR1B,0BAA0B;8BA2E9B,aAAa;2BAoChB,MAAM
|
|
1
|
+
{"version":3,"file":"business.d.ts","sourceRoot":"","sources":["../../src/Socket/business.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC5G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AAUnE,OAAO,EAAE,KAAK,UAAU,EAAqC,MAAM,aAAa,CAAA;AAIhF,eAAO,MAAM,kBAAkB,GAAI,QAAQ,YAAY;;+BA8Od,MAAM,eAAe,MAAM;yCAjGjB,iBAAiB;;;;2BAmD/B,MAAM;;;4BAkIL,aAAa;gCAwCT,MAAM,EAAE;;;+BA9ET,MAAM,UAAU,aAAa;kCAxR1B,0BAA0B;8BA2E9B,aAAa;2BAoChB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsS6+nB,CAAC;;;;;;;;;0DAhXtgoB,GAAG,0BAChB,GAAH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8WF,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { proto } from '../../WAProto/index.js';
|
|
2
|
+
import type { ChannelStatus } from '../Types/ChannelStatus.js';
|
|
3
|
+
import type { AnyMessageContent } from '../Types/index.js';
|
|
4
|
+
import type { MediaGenerationOptions, WAMediaUploadFunction } from '../Types/Message.js';
|
|
5
|
+
import { type BinaryNode } from '../WABinary/index.js';
|
|
6
|
+
export type ChannelStatusOptions = Pick<MediaGenerationOptions, 'backgroundColor' | 'font'>;
|
|
7
|
+
export type ChannelStatusDeps = {
|
|
8
|
+
sendNode: (node: BinaryNode) => Promise<unknown>;
|
|
9
|
+
waUploadToServer: WAMediaUploadFunction;
|
|
10
|
+
userJid?: string;
|
|
11
|
+
};
|
|
12
|
+
/** What sendChannelStatus returns: the stanza id and the message that went out. */
|
|
13
|
+
export type ChannelStatusSent = {
|
|
14
|
+
id: string;
|
|
15
|
+
channelJid: string;
|
|
16
|
+
message: proto.IMessage;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Decode a channel status from its incoming `<status>` stanza.
|
|
20
|
+
*
|
|
21
|
+
* Wire shape, captured live 2026-11-09 from Techword 401
|
|
22
|
+
* (120363331321673219@newsletter):
|
|
23
|
+
*
|
|
24
|
+
* <status from="120363331321673219@newsletter" type="text"
|
|
25
|
+
* id="3EB079CA1FB41899DF027B" t="1794223368" server_id="136">
|
|
26
|
+
* <plaintext>proto.Message bytes</plaintext>
|
|
27
|
+
* </status>
|
|
28
|
+
*
|
|
29
|
+
* The plaintext payload is a standard proto.Message — a text status is an
|
|
30
|
+
* extendedTextMessage (field 6) whose field 1 is the text, field 8 the
|
|
31
|
+
* backgroundArgb and field 9 the font; field 35 is messageContextInfo.
|
|
32
|
+
* Non-newsletter `<status>` stanzas are ignored here: Baileys already
|
|
33
|
+
* handles personal statuses through the message stream.
|
|
34
|
+
*/
|
|
35
|
+
export declare const decodeChannelStatus: (node: BinaryNode) => ChannelStatus | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Post a channel status — the temporary (24h) update a channel admin posts
|
|
38
|
+
* from the channel, shown in followers' Status tray. It is NOT a channel
|
|
39
|
+
* message (that is sendMessage to the @newsletter JID) and NOT a personal
|
|
40
|
+
* status (that is sendMessage to status@broadcast).
|
|
41
|
+
*
|
|
42
|
+
* Wire shape, proven live 2026-11-09: a top-level `<status>` stanza to the
|
|
43
|
+
* channel JID, mirroring the ones received, with a `<plaintext>` child
|
|
44
|
+
* holding the plain proto.Message bytes (same encoding as a newsletter
|
|
45
|
+
* message). The server acks it (no error) when the sender is an admin or
|
|
46
|
+
* owner of the channel, and answers error 401 when they are not — that is
|
|
47
|
+
* what happened posting to Techword 401 from an account that is not its
|
|
48
|
+
* admin. Accepts the same content shapes as sendMessage: { text } for a
|
|
49
|
+
* text status, { image, caption } etc. for media. Options support
|
|
50
|
+
* backgroundColor for text statuses and font for text.
|
|
51
|
+
*/
|
|
52
|
+
export declare const sendChannelStatus: (jid: string, content: AnyMessageContent, deps: ChannelStatusDeps, options?: ChannelStatusOptions) => Promise<ChannelStatusSent>;
|
|
53
|
+
//# sourceMappingURL=channelStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channelStatus.d.ts","sourceRoot":"","sources":["../../src/Socket/channelStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAGxF,OAAO,EAAE,KAAK,UAAU,EAAsB,MAAM,sBAAsB,CAAA;AAE1E,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,sBAAsB,EAAE,iBAAiB,GAAG,MAAM,CAAC,CAAA;AAE3F,MAAM,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAChD,gBAAgB,EAAE,qBAAqB,CAAA;IACvC,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,mFAAmF;AACnF,MAAM,MAAM,iBAAiB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAA;CACvB,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,UAAU,KAAG,aAAa,GAAG,SAsCtE,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,GAC7B,KAAK,MAAM,EACX,SAAS,iBAAiB,EAC1B,MAAM,iBAAiB,EACvB,UAAS,oBAAyB,KAChC,OAAO,CAAC,iBAAiB,CAqB3B,CAAA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { proto } from '../../WAProto/index.js';
|
|
2
|
+
import { generateMessageIDV2 } from '../Utils/generics.js';
|
|
3
|
+
import { generateWAMessageContent } from '../Utils/index.js';
|
|
4
|
+
import { getBinaryNodeChild } from '../WABinary/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Decode a channel status from its incoming `<status>` stanza.
|
|
7
|
+
*
|
|
8
|
+
* Wire shape, captured live 2026-11-09 from Techword 401
|
|
9
|
+
* (120363331321673219@newsletter):
|
|
10
|
+
*
|
|
11
|
+
* <status from="120363331321673219@newsletter" type="text"
|
|
12
|
+
* id="3EB079CA1FB41899DF027B" t="1794223368" server_id="136">
|
|
13
|
+
* <plaintext>proto.Message bytes</plaintext>
|
|
14
|
+
* </status>
|
|
15
|
+
*
|
|
16
|
+
* The plaintext payload is a standard proto.Message — a text status is an
|
|
17
|
+
* extendedTextMessage (field 6) whose field 1 is the text, field 8 the
|
|
18
|
+
* backgroundArgb and field 9 the font; field 35 is messageContextInfo.
|
|
19
|
+
* Non-newsletter `<status>` stanzas are ignored here: Baileys already
|
|
20
|
+
* handles personal statuses through the message stream.
|
|
21
|
+
*/
|
|
22
|
+
export const decodeChannelStatus = (node) => {
|
|
23
|
+
const from = node.attrs.from;
|
|
24
|
+
if (!from?.endsWith('@newsletter')) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const plaintextNode = getBinaryNodeChild(node, 'plaintext');
|
|
28
|
+
if (!plaintextNode?.content) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
const contentBuf = typeof plaintextNode.content === 'string'
|
|
32
|
+
? Buffer.from(plaintextNode.content, 'binary')
|
|
33
|
+
: Buffer.from(plaintextNode.content);
|
|
34
|
+
let message;
|
|
35
|
+
try {
|
|
36
|
+
// no toJSON(): it turns the font enum into its name ('SYSTEM' for 0)
|
|
37
|
+
message = proto.Message.decode(contentBuf);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const extendedText = message.extendedTextMessage;
|
|
43
|
+
return {
|
|
44
|
+
id: node.attrs.id || '',
|
|
45
|
+
channelJid: from,
|
|
46
|
+
type: node.attrs.type || 'text',
|
|
47
|
+
serverId: node.attrs.server_id,
|
|
48
|
+
messageTimestamp: +(node.attrs.t || 0),
|
|
49
|
+
offline: !!node.attrs.offline,
|
|
50
|
+
text: extendedText?.text || message.conversation || undefined,
|
|
51
|
+
backgroundArgb: extendedText?.backgroundArgb ?? undefined,
|
|
52
|
+
font: extendedText?.font ?? undefined,
|
|
53
|
+
message
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Post a channel status — the temporary (24h) update a channel admin posts
|
|
58
|
+
* from the channel, shown in followers' Status tray. It is NOT a channel
|
|
59
|
+
* message (that is sendMessage to the @newsletter JID) and NOT a personal
|
|
60
|
+
* status (that is sendMessage to status@broadcast).
|
|
61
|
+
*
|
|
62
|
+
* Wire shape, proven live 2026-11-09: a top-level `<status>` stanza to the
|
|
63
|
+
* channel JID, mirroring the ones received, with a `<plaintext>` child
|
|
64
|
+
* holding the plain proto.Message bytes (same encoding as a newsletter
|
|
65
|
+
* message). The server acks it (no error) when the sender is an admin or
|
|
66
|
+
* owner of the channel, and answers error 401 when they are not — that is
|
|
67
|
+
* what happened posting to Techword 401 from an account that is not its
|
|
68
|
+
* admin. Accepts the same content shapes as sendMessage: { text } for a
|
|
69
|
+
* text status, { image, caption } etc. for media. Options support
|
|
70
|
+
* backgroundColor for text statuses and font for text.
|
|
71
|
+
*/
|
|
72
|
+
export const sendChannelStatus = async (jid, content, deps, options = {}) => {
|
|
73
|
+
const { sendNode, waUploadToServer, userJid } = deps;
|
|
74
|
+
// generateWAMessageContent builds/uploads the inner message (handles
|
|
75
|
+
// media upload, thumbnails, etc. same as a normal send)
|
|
76
|
+
const inner = await generateWAMessageContent(content, { ...options, upload: waUploadToServer });
|
|
77
|
+
const id = generateMessageIDV2(userJid);
|
|
78
|
+
const bytes = proto.Message.encode(inner).finish();
|
|
79
|
+
await sendNode({
|
|
80
|
+
tag: 'status',
|
|
81
|
+
attrs: {
|
|
82
|
+
to: jid,
|
|
83
|
+
id,
|
|
84
|
+
type: 'text'
|
|
85
|
+
},
|
|
86
|
+
content: [{ tag: 'plaintext', attrs: {}, content: bytes }]
|
|
87
|
+
});
|
|
88
|
+
return { id, channelJid: jid, message: inner };
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=channelStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channelStatus.js","sourceRoot":"","sources":["../../src/Socket/channelStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAI9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EAAmB,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAiB1E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAgB,EAA6B,EAAE;IAClF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAA;IAC5B,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QACpC,OAAO,SAAS,CAAA;IACjB,CAAC;IAED,MAAM,aAAa,GAAG,kBAAkB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;IAC3D,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,CAAC;QAC7B,OAAO,SAAS,CAAA;IACjB,CAAC;IAED,MAAM,UAAU,GACf,OAAO,aAAa,CAAC,OAAO,KAAK,QAAQ;QACxC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC9C,CAA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AAA;IAE/F,MAAM,EAAE,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAA;IACvC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAA;IAElD,MAAM,QAAQ,CAAC;QACd,GAAG,EAAE,QAAQ;QACb,KAAK,EAAE;YACN,EAAE,EAAE,GAAG;YACP,EAAE;YACF,IAAI,EAAE,MAAM;SACZ;QACD,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;KAC1D,CAAC,CAAA;IAEF,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;AAC/C,CAAC,CAAA"}
|
|
@@ -87,7 +87,44 @@ export declare const makeCommunitiesSocket: (config: SocketConfig) => {
|
|
|
87
87
|
issuePrivacyTokens: (jids: string[], timestamp?: number) => Promise<any>;
|
|
88
88
|
assertSessions: (jids: string[], force?: boolean) => Promise<boolean>;
|
|
89
89
|
relayMessage: (jid: string, message: proto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../Types/index.js").MessageRelayOptions) => Promise<string>;
|
|
90
|
+
sendChannelStatus: (jid: string, content: import("../Types/index.js").AnyMessageContent, options?: import("./channelStatus.js").ChannelStatusOptions) => Promise<import("./channelStatus.js").ChannelStatusSent>;
|
|
90
91
|
sendGroupStatus: (jid: string, content: import("../Types/index.js").AnyMessageContent, options?: {}) => Promise<import("../Types/index.js").WAMessage>;
|
|
92
|
+
sendStickerPack: (jid: string, pack: import("../Types/index.js").StickerPack) => Promise<import("../Types/index.js").StickerPackResult>;
|
|
93
|
+
checkUsername: (username: string, includeSuggestions?: boolean, sessionId?: string) => Promise<import("../Types/index.js").UsernameCheckResult>;
|
|
94
|
+
checkUsernameMulti: (usernames: string[]) => Promise<unknown>;
|
|
95
|
+
setUsername: (username: string, options?: import("../Types/index.js").SetUsernameOptions) => Promise<unknown>;
|
|
96
|
+
deleteUsername: () => Promise<unknown>;
|
|
97
|
+
getMyUsername: () => Promise<string | null>;
|
|
98
|
+
getUsernameRecommendations: (source?: import("../Types/index.js").UsernameSource | null) => Promise<unknown>;
|
|
99
|
+
setUsernamePin: (pin: string | null) => Promise<unknown>;
|
|
100
|
+
findUserByUsername: (username: string, pin?: string) => Promise<import("../Types/index.js").UsernameUser | null>;
|
|
101
|
+
fetchContactUsernames: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[]>;
|
|
102
|
+
setUsernameQueryIds: (ids: Partial<import("./username.js").UsernameQueryIds>) => {
|
|
103
|
+
CHECK: string;
|
|
104
|
+
CHECK_MULTI: string;
|
|
105
|
+
SET: string;
|
|
106
|
+
GET: string;
|
|
107
|
+
GET_RECOMMENDATIONS: string;
|
|
108
|
+
PIN_SET: string;
|
|
109
|
+
};
|
|
110
|
+
USERNAME_QUERY_IDS: {
|
|
111
|
+
CHECK: string;
|
|
112
|
+
CHECK_MULTI: string;
|
|
113
|
+
SET: string;
|
|
114
|
+
GET: string;
|
|
115
|
+
GET_RECOMMENDATIONS: string;
|
|
116
|
+
PIN_SET: string;
|
|
117
|
+
};
|
|
118
|
+
USERNAME_CHECK_RESULT: {
|
|
119
|
+
readonly SUCCESS: "SUCCESS";
|
|
120
|
+
readonly INVALID: "INVALID";
|
|
121
|
+
};
|
|
122
|
+
USERNAME_SOURCE: {
|
|
123
|
+
readonly FB: "FB";
|
|
124
|
+
readonly IG: "IG";
|
|
125
|
+
readonly USER_INPUT: "USER_INPUT";
|
|
126
|
+
readonly SUGGESTION: "SUGGESTION";
|
|
127
|
+
};
|
|
91
128
|
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types/index.js").MessageReceiptType) => Promise<void>;
|
|
92
129
|
sendReceipts: (keys: WAMessageKey[], type: import("../Types/index.js").MessageReceiptType) => Promise<void>;
|
|
93
130
|
readMessages: (keys: WAMessageKey[]) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"communities.d.ts","sourceRoot":"","sources":["../../src/Socket/communities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EACN,KAAK,aAAa,EAElB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,YAAY,EAEjB,MAAM,UAAU,CAAA;AAGjB,OAAO,EACN,KAAK,UAAU,EAMf,MAAM,aAAa,CAAA;AAGpB,eAAO,MAAM,qBAAqB,GAAI,QAAQ,YAAY;6BAenB,MAAM;+BA8EV,MAAM,QAAQ,MAAM;oCAqCf,MAAM,gBAAgB,MAAM,EAAE,sBAAsB,MAAM;yBAoBrE,MAAM;kCASG,MAAM,WAAW,MAAM;mCAStB,MAAM,sBAAsB,MAAM;qCAehC,MAAM,sBAAsB,MAAM;sCASjC,MAAM;;;;;;;;;;;4CAsCA,MAAM;;;8CAWJ,MAAM,gBAAgB,MAAM,EAAE,UAAU,SAAS,GAAG,QAAQ;;;;uCAwBnE,MAAM,gBAAgB,MAAM,EAAE,UAAU,iBAAiB;;;;;sCAiB1D,MAAM,gBAAgB,MAAM;+BAenC,MAAM;iCAKJ,MAAM;kCAKL,MAAM;IAM1C;;;;;OAKG;4CAC2C,MAAM,cAAc,MAAM;IAOxE;;;;OAIG;;mCAsDkC,MAAM;oCAIL,MAAM,uBAAuB,MAAM;kCAOnE,MAAM,WACF,cAAc,GAAG,kBAAkB,GAAG,QAAQ,GAAG,UAAU;kCAIjC,MAAM,QAAQ,WAAW,GAAG,gBAAgB;qCAGzC,MAAM,QAAQ,IAAI,GAAG,KAAK
|
|
1
|
+
{"version":3,"file":"communities.d.ts","sourceRoot":"","sources":["../../src/Socket/communities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,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AAA;AAED,eAAO,MAAM,wBAAwB,GAAI,QAAQ,UAAU,kBA2C1D,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proto } from '../../WAProto/index.js';
|
|
2
|
-
import type { AnyMessageContent,
|
|
3
|
-
import type { WAMediaUploadFunction } from '../Types/Message.js';
|
|
2
|
+
import type { AnyMessageContent, WAMessage } from '../Types/index.js';
|
|
3
|
+
import type { MediaGenerationOptions, WAMediaUploadFunction } from '../Types/Message.js';
|
|
4
4
|
export type GroupStatusDeps = {
|
|
5
5
|
relayMessage: (jid: string, message: proto.IMessage, opts: {
|
|
6
6
|
messageId: string;
|
|
@@ -8,7 +8,7 @@ export type GroupStatusDeps = {
|
|
|
8
8
|
waUploadToServer: WAMediaUploadFunction;
|
|
9
9
|
userJid?: string;
|
|
10
10
|
};
|
|
11
|
-
export type GroupStatusOptions = Pick<
|
|
11
|
+
export type GroupStatusOptions = Pick<MediaGenerationOptions, 'backgroundColor' | 'font'>;
|
|
12
12
|
/**
|
|
13
13
|
* Post a group-status update using WhatsApp's groupStatusMessageV2 wrapper.
|
|
14
14
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groupStatus.d.ts","sourceRoot":"","sources":["../../src/Socket/groupStatus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"groupStatus.d.ts","sourceRoot":"","sources":["../../src/Socket/groupStatus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,KAAK,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAGxF,MAAM,MAAM,eAAe,GAAG;IAC7B,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACrG,gBAAgB,EAAE,qBAAqB,CAAA;IACvC,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,sBAAsB,EAAE,iBAAiB,GAAG,MAAM,CAAC,CAAA;AAEzF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC3B,KAAK,MAAM,EACX,SAAS,iBAAiB,EAC1B,MAAM,eAAe,EACrB,UAAS,kBAAuB,KAC9B,OAAO,CAAC,SAAS,CA6BnB,CAAA"}
|
|
@@ -11,8 +11,8 @@ export const sendGroupStatus = async (jid, content, deps, options = {}) => {
|
|
|
11
11
|
const { relayMessage, waUploadToServer, userJid } = deps;
|
|
12
12
|
// Build/upload the inner message exactly as a normal Baileys message.
|
|
13
13
|
const inner = await generateWAMessageContent(content, {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
...options,
|
|
15
|
+
upload: waUploadToServer
|
|
16
16
|
});
|
|
17
17
|
const messageSecret = crypto.randomBytes(32);
|
|
18
18
|
// WhatsApp expects the same secret on both the outer message and the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groupStatus.js","sourceRoot":"","sources":["../../src/Socket/groupStatus.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"groupStatus.js","sourceRoot":"","sources":["../../src/Socket/groupStatus.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAG9C,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAA;AAU1F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EACnC,GAAW,EACX,OAA0B,EAC1B,IAAqB,EACrB,UAA8B,EAAE,EACX,EAAE;IACvB,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IAExD,sEAAsE;IACtE,MAAM,KAAK,GAAG,MAAM,wBAAwB,CAAC,OAAO,EAAE;QACrD,GAAG,OAAO;QACV,MAAM,EAAE,gBAAgB;KACxB,CAAC,CAAA;IACF,MAAM,aAAa,GAAG,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;IAE5C,qEAAqE;IACrE,0EAA0E;IAC1E,gEAAgE;IAChE,MAAM,OAAO,GAAG,4BAA4B,CAC3C,GAAG,EACH;QACC,kBAAkB,EAAE,EAAE,aAAa,EAAE;QACrC,oBAAoB,EAAE;YACrB,OAAO,EAAE;gBACR,GAAG,KAAK;gBACR,kBAAkB,EAAE,EAAE,aAAa,EAAE;aACrC;SACD;KACD,EACD,EAAE,OAAO,EAAS,CAClB,CAAA;IAED,MAAM,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,OAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,EAAG,EAAE,CAAC,CAAA;IACzE,OAAO,OAAO,CAAA;AACf,CAAC,CAAA"}
|
package/lib/Socket/index.d.ts
CHANGED
|
@@ -74,7 +74,44 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
|
74
74
|
issuePrivacyTokens: (jids: string[], timestamp?: number) => Promise<any>;
|
|
75
75
|
assertSessions: (jids: string[], force?: boolean) => Promise<boolean>;
|
|
76
76
|
relayMessage: (jid: string, message: import("../index.js").proto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../index.js").MessageRelayOptions) => Promise<string>;
|
|
77
|
+
sendChannelStatus: (jid: string, content: import("../index.js").AnyMessageContent, options?: import("./channelStatus.js").ChannelStatusOptions) => Promise<import("./channelStatus.js").ChannelStatusSent>;
|
|
77
78
|
sendGroupStatus: (jid: string, content: import("../index.js").AnyMessageContent, options?: {}) => Promise<import("../index.js").WAMessage>;
|
|
79
|
+
sendStickerPack: (jid: string, pack: import("../index.js").StickerPack) => Promise<import("../index.js").StickerPackResult>;
|
|
80
|
+
checkUsername: (username: string, includeSuggestions?: boolean, sessionId?: string) => Promise<import("../index.js").UsernameCheckResult>;
|
|
81
|
+
checkUsernameMulti: (usernames: string[]) => Promise<unknown>;
|
|
82
|
+
setUsername: (username: string, options?: import("../index.js").SetUsernameOptions) => Promise<unknown>;
|
|
83
|
+
deleteUsername: () => Promise<unknown>;
|
|
84
|
+
getMyUsername: () => Promise<string | null>;
|
|
85
|
+
getUsernameRecommendations: (source?: import("../index.js").UsernameSource | null) => Promise<unknown>;
|
|
86
|
+
setUsernamePin: (pin: string | null) => Promise<unknown>;
|
|
87
|
+
findUserByUsername: (username: string, pin?: string) => Promise<import("../index.js").UsernameUser | null>;
|
|
88
|
+
fetchContactUsernames: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[]>;
|
|
89
|
+
setUsernameQueryIds: (ids: Partial<import("./username.js").UsernameQueryIds>) => {
|
|
90
|
+
CHECK: string;
|
|
91
|
+
CHECK_MULTI: string;
|
|
92
|
+
SET: string;
|
|
93
|
+
GET: string;
|
|
94
|
+
GET_RECOMMENDATIONS: string;
|
|
95
|
+
PIN_SET: string;
|
|
96
|
+
};
|
|
97
|
+
USERNAME_QUERY_IDS: {
|
|
98
|
+
CHECK: string;
|
|
99
|
+
CHECK_MULTI: string;
|
|
100
|
+
SET: string;
|
|
101
|
+
GET: string;
|
|
102
|
+
GET_RECOMMENDATIONS: string;
|
|
103
|
+
PIN_SET: string;
|
|
104
|
+
};
|
|
105
|
+
USERNAME_CHECK_RESULT: {
|
|
106
|
+
readonly SUCCESS: "SUCCESS";
|
|
107
|
+
readonly INVALID: "INVALID";
|
|
108
|
+
};
|
|
109
|
+
USERNAME_SOURCE: {
|
|
110
|
+
readonly FB: "FB";
|
|
111
|
+
readonly IG: "IG";
|
|
112
|
+
readonly USER_INPUT: "USER_INPUT";
|
|
113
|
+
readonly SUGGESTION: "SUGGESTION";
|
|
114
|
+
};
|
|
78
115
|
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../index.js").MessageReceiptType) => Promise<void>;
|
|
79
116
|
sendReceipts: (keys: import("../index.js").WAMessageKey[], type: import("../index.js").MessageReceiptType) => Promise<void>;
|
|
80
117
|
readMessages: (keys: import("../index.js").WAMessageKey[]) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Socket/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAItD,QAAA,MAAM,YAAY,GAAI,QAAQ,sBAAsB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Socket/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAItD,QAAA,MAAM,YAAY,GAAI,QAAQ,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAUg43B,CAAC;;;;;;;;;0DAArr1B,GAAG,0BAA0B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAH/xC,CAAA;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -18,7 +18,44 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
|
|
|
18
18
|
issuePrivacyTokens: (jids: string[], timestamp?: number) => Promise<any>;
|
|
19
19
|
assertSessions: (jids: string[], force?: boolean) => Promise<boolean>;
|
|
20
20
|
relayMessage: (jid: string, message: proto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: MessageRelayOptions) => Promise<string>;
|
|
21
|
+
sendChannelStatus: (jid: string, content: import("../Types/index.js").AnyMessageContent, options?: import("./channelStatus.js").ChannelStatusOptions) => Promise<import("./channelStatus.js").ChannelStatusSent>;
|
|
21
22
|
sendGroupStatus: (jid: string, content: import("../Types/index.js").AnyMessageContent, options?: {}) => Promise<WAMessage>;
|
|
23
|
+
sendStickerPack: (jid: string, pack: import("../Types/index.js").StickerPack) => Promise<import("../Types/index.js").StickerPackResult>;
|
|
24
|
+
checkUsername: (username: string, includeSuggestions?: boolean, sessionId?: string) => Promise<import("../Types/index.js").UsernameCheckResult>;
|
|
25
|
+
checkUsernameMulti: (usernames: string[]) => Promise<unknown>;
|
|
26
|
+
setUsername: (username: string, options?: import("../Types/index.js").SetUsernameOptions) => Promise<unknown>;
|
|
27
|
+
deleteUsername: () => Promise<unknown>;
|
|
28
|
+
getMyUsername: () => Promise<string | null>;
|
|
29
|
+
getUsernameRecommendations: (source?: import("../Types/index.js").UsernameSource | null) => Promise<unknown>;
|
|
30
|
+
setUsernamePin: (pin: string | null) => Promise<unknown>;
|
|
31
|
+
findUserByUsername: (username: string, pin?: string) => Promise<import("../Types/index.js").UsernameUser | null>;
|
|
32
|
+
fetchContactUsernames: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[]>;
|
|
33
|
+
setUsernameQueryIds: (ids: Partial<import("./username.js").UsernameQueryIds>) => {
|
|
34
|
+
CHECK: string;
|
|
35
|
+
CHECK_MULTI: string;
|
|
36
|
+
SET: string;
|
|
37
|
+
GET: string;
|
|
38
|
+
GET_RECOMMENDATIONS: string;
|
|
39
|
+
PIN_SET: string;
|
|
40
|
+
};
|
|
41
|
+
USERNAME_QUERY_IDS: {
|
|
42
|
+
CHECK: string;
|
|
43
|
+
CHECK_MULTI: string;
|
|
44
|
+
SET: string;
|
|
45
|
+
GET: string;
|
|
46
|
+
GET_RECOMMENDATIONS: string;
|
|
47
|
+
PIN_SET: string;
|
|
48
|
+
};
|
|
49
|
+
USERNAME_CHECK_RESULT: {
|
|
50
|
+
readonly SUCCESS: "SUCCESS";
|
|
51
|
+
readonly INVALID: "INVALID";
|
|
52
|
+
};
|
|
53
|
+
USERNAME_SOURCE: {
|
|
54
|
+
readonly FB: "FB";
|
|
55
|
+
readonly IG: "IG";
|
|
56
|
+
readonly USER_INPUT: "USER_INPUT";
|
|
57
|
+
readonly SUGGESTION: "SUGGESTION";
|
|
58
|
+
};
|
|
22
59
|
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: MessageReceiptType) => Promise<void>;
|
|
23
60
|
sendReceipts: (keys: WAMessageKey[], type: MessageReceiptType) => Promise<void>;
|
|
24
61
|
readMessages: (keys: WAMessageKey[]) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages-recv.d.ts","sourceRoot":"","sources":["../../src/Socket/messages-recv.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAQ9C,OAAO,KAAK,EAEX,kBAAkB,EAClB,mBAAmB,EAEnB,qBAAqB,EACrB,YAAY,EAEZ,SAAS,EACT,YAAY,EAEZ,MAAM,UAAU,CAAA;AA4CjB,OAAO,EAEN,KAAK,UAAU,EAef,KAAK,aAAa,EAElB,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"messages-recv.d.ts","sourceRoot":"","sources":["../../src/Socket/messages-recv.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAQ9C,OAAO,KAAK,EAEX,kBAAkB,EAClB,mBAAmB,EAEnB,qBAAqB,EACrB,YAAY,EAEZ,SAAS,EACT,YAAY,EAEZ,MAAM,UAAU,CAAA;AA4CjB,OAAO,EAEN,KAAK,UAAU,EAef,KAAK,aAAa,EAElB,MAAM,aAAa,CAAA;AAwBpB,eAAO,MAAM,sBAAsB,GAAI,QAAQ,YAAY;2BAobtB,UAAU,cAAc,MAAM;6BA4B5B,UAAU;yBAtBd,MAAM,YAAY,MAAM;iCAnYlD,MAAM,gBACC,YAAY,sBACN,MAAM,GAAG,IAAI,KAC/B,OAAO,CAAC,MAAM,CAAC;2CAoBL,YAAY,YACd,OAAO,CAAC,SAAS,CAAC,KAC1B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA2vB4C,CAAC;;;;;;;;;0DAl3B1E,GAAG,0BACD,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqkEN,CAAA"}
|
|
@@ -11,6 +11,7 @@ import { makeOfflineNodeProcessor } from '../Utils/offline-node-processor.js';
|
|
|
11
11
|
import { buildAckStanza } from '../Utils/stanza-ack.js';
|
|
12
12
|
import { buildMergedTcTokenIndexWrite, isTcTokenExpired, readTcTokenIndex, resolveIssuanceJid, resolveTcTokenJid, storeTcTokensFromIqResult, TC_TOKEN_INDEX_KEY } from '../Utils/tc-token-utils.js';
|
|
13
13
|
import { areJidsSameUser, binaryNodeToString, getAllBinaryNodeChildren, getBinaryNodeChild, getBinaryNodeChildBuffer, getBinaryNodeChildren, getBinaryNodeChildString, getBinaryNodeChildUInt, isJidGroup, isJidNewsletter, isJidStatusBroadcast, isLidUser, isPnUser, jidDecode, jidNormalizedUser, S_WHATSAPP_NET } from '../WABinary/index.js';
|
|
14
|
+
import { decodeChannelStatus } from './channelStatus.js';
|
|
14
15
|
import { extractGroupMetadata } from './groups.js';
|
|
15
16
|
import { makeMessagesSocket } from './messages-send.js';
|
|
16
17
|
const ENFORCEMENT_TYPE_VALUES = new Set(Object.values(ReachoutTimelockEnforcementType));
|
|
@@ -1612,6 +1613,21 @@ export const makeMessagesRecvSocket = (config) => {
|
|
|
1612
1613
|
ws.on('CB:message', async (node) => {
|
|
1613
1614
|
await processNode('message', node, 'processing message', handleMessage);
|
|
1614
1615
|
});
|
|
1616
|
+
// Channel statuses arrive as top-level <status> stanzas from @newsletter JIDs,
|
|
1617
|
+
// not through the ordinary message stream.
|
|
1618
|
+
ws.on('CB:status', (node) => {
|
|
1619
|
+
try {
|
|
1620
|
+
const status = decodeChannelStatus(node);
|
|
1621
|
+
if (status) {
|
|
1622
|
+
ev.buffer();
|
|
1623
|
+
ev.emit('newsletter.status', status);
|
|
1624
|
+
ev.flush();
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
catch (error) {
|
|
1628
|
+
onUnexpectedError(error instanceof Error ? error : new Error(String(error)), 'handling channel status');
|
|
1629
|
+
}
|
|
1630
|
+
});
|
|
1615
1631
|
ws.on('CB:call', async (node) => {
|
|
1616
1632
|
await processNode('call', node, 'handling call', handleCall);
|
|
1617
1633
|
});
|