@queenanya/baileys 7.1.3 → 7.1.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.
Files changed (39) hide show
  1. package/README.md +56 -14
  2. package/lib/Defaults/index.js +5 -4
  3. package/lib/Socket/business.d.ts +31 -3
  4. package/lib/Socket/chats.d.ts +7 -0
  5. package/lib/Socket/chats.js +25 -0
  6. package/lib/Socket/groups.d.ts +15 -2
  7. package/lib/Socket/groups.js +11 -1
  8. package/lib/Socket/index.d.ts +31 -3
  9. package/lib/Socket/messages-recv.d.ts +32 -4
  10. package/lib/Socket/messages-recv.js +67 -4
  11. package/lib/Socket/messages-send.d.ts +29 -1
  12. package/lib/Socket/messages-send.js +61 -9
  13. package/lib/Socket/newsletter.d.ts +140 -0
  14. package/lib/Socket/newsletter.js +249 -0
  15. package/lib/Socket/registration.d.ts +31 -3
  16. package/lib/Socket/socket.js +2 -1
  17. package/lib/Types/Chat.d.ts +3 -0
  18. package/lib/Types/Events.d.ts +27 -0
  19. package/lib/Types/Label.d.ts +11 -0
  20. package/lib/Types/Message.d.ts +25 -3
  21. package/lib/Types/Newsletter.d.ts +79 -0
  22. package/lib/Types/Newsletter.js +18 -0
  23. package/lib/Types/Socket.d.ts +2 -0
  24. package/lib/Types/index.d.ts +2 -0
  25. package/lib/Types/index.js +1 -0
  26. package/lib/Utils/chat-utils.js +16 -0
  27. package/lib/Utils/decode-wa-message.js +46 -18
  28. package/lib/Utils/generics.d.ts +12 -0
  29. package/lib/Utils/generics.js +26 -6
  30. package/lib/Utils/messages-media.d.ts +10 -1
  31. package/lib/Utils/messages-media.js +53 -4
  32. package/lib/Utils/messages.js +51 -11
  33. package/lib/Utils/process-message.js +13 -8
  34. package/lib/Utils/signal.js +0 -5
  35. package/lib/WABinary/encode.d.ts +1 -2
  36. package/lib/WABinary/encode.js +3 -7
  37. package/lib/WABinary/jid-utils.d.ts +3 -1
  38. package/lib/WABinary/jid-utils.js +4 -1
  39. package/package.json +10 -8
package/README.md CHANGED
@@ -1,11 +1,17 @@
1
- # Baileys - Typescript/Javascript WhatsApp Web API
1
+ # Note:
2
+ **QueenAnya/Baileys is another version of Baileys that was originally created by Adhiraj Singh. ShizoWeb is Maintained and Up-to-dated with all lestest feature [Thanks for Visiting Here]**
3
+
4
+ ## Maintainer Of QueenAnya/Baileys
5
+ ** • Team PikaBotz. **
6
+
7
+ # QueenAnya/Baileys - Typescript/Javascript WhatsApp Web API
2
8
 
3
9
  ### Important Note
4
10
 
5
11
  This library was originally a project for **CS-2362 at Ashoka University** and is in no way affiliated with or endorsed by WhatsApp. Use at your own discretion. Do not spam people with this. We discourage any stalkerware, bulk or automated messaging usage.
6
12
 
7
13
  #### Liability and License Notice
8
- Baileys and its maintainers cannot be held liable for misuse of this application, as stated in the [MIT license](https://github.com/WhiskeySockets/Baileys/blob/master/LICENSE).
14
+ Baileys and its maintainers cannot be held liable for misuse of this application, as stated in the [MIT license](https://github.com/queenanya/Baileys/blob/master/LICENSE).
9
15
  The maintainers of Baileys do not in any way condone the use of this application in practices that violate the Terms of Service of WhatsApp. The maintainers of this application call upon the personal responsibility of its users to use this application in a fair way, as it is intended to be used.
10
16
  ##
11
17
 
@@ -33,17 +39,17 @@ To run the example script, download or clone the repo and then type the followin
33
39
 
34
40
  Use the stable version:
35
41
  ```
36
- yarn add @whiskeysockets/baileys
42
+ yarn add @queenanya/baileys
37
43
  ```
38
44
 
39
45
  Use the edge version (no guarantee of stability, but latest fixes + features)
40
46
  ```
41
- yarn add github:WhiskeySockets/Baileys
47
+ yarn add github:QueenAnya/Baileys
42
48
  ```
43
49
 
44
50
  Then import your code using:
45
51
  ``` ts
46
- import makeWASocket from '@whiskeysockets/baileys'
52
+ import makeWASocket from '@queenanya/baileys'
47
53
  ```
48
54
 
49
55
  ## Unit Tests
@@ -55,7 +61,7 @@ TODO
55
61
  WhatsApp provides a multi-device API that allows Baileys to be authenticated as a second WhatsApp client by scanning a QR code with WhatsApp on your phone.
56
62
 
57
63
  ``` ts
58
- import makeWASocket, { DisconnectReason } from '@whiskeysockets/baileys'
64
+ import makeWASocket, { DisconnectReason } from '@queenanya/baileys'
59
65
  import { Boom } from '@hapi/boom'
60
66
 
61
67
  async function connectToWhatsApp () {
@@ -193,7 +199,7 @@ You obviously don't want to keep scanning the QR code every time you want to con
193
199
 
194
200
  So, you can load the credentials to log back in:
195
201
  ``` ts
196
- import makeWASocket, { BufferJSON, useMultiFileAuthState } from '@whiskeysockets/baileys'
202
+ import makeWASocket, { BufferJSON, useMultiFileAuthState } from '@queenanya/baileys'
197
203
  import * as fs from 'fs'
198
204
 
199
205
  // utility function to help save the auth state in a single folder
@@ -308,7 +314,7 @@ Baileys does not come with a defacto storage for chats, contacts, or messages. H
308
314
  It can be used as follows:
309
315
 
310
316
  ``` ts
311
- import makeWASocket, { makeInMemoryStore } from '@whiskeysockets/baileys'
317
+ import makeWASocket, { makeInMemoryStore } from '@queenanya/baileys'
312
318
  // the store maintains the data of the WA connection in memory
313
319
  // can be written out to a file & read from it
314
320
  const store = makeInMemoryStore({ })
@@ -324,13 +330,13 @@ const sock = makeWASocket({ })
324
330
  // the store can listen from a new socket once the current socket outlives its lifetime
325
331
  store.bind(sock.ev)
326
332
 
327
- sock.ev.on('chats.upsert', () => {
333
+ sock.ev.on('chats.set', () => {
328
334
  // can use "store.chats" however you want, even after the socket dies out
329
335
  // "chats" => a KeyedDB instance
330
336
  console.log('got chats', store.chats.all())
331
337
  })
332
338
 
333
- sock.ev.on('contacts.upsert', () => {
339
+ sock.ev.on('contacts.set', () => {
334
340
  console.log('got contacts', Object.values(store.contacts))
335
341
  })
336
342
 
@@ -347,7 +353,7 @@ The store also provides some simple functions such as `loadMessages` that utiliz
347
353
  ### Non-Media Messages
348
354
 
349
355
  ``` ts
350
- import { MessageType, MessageOptions, Mimetype } from '@whiskeysockets/baileys'
356
+ import { MessageType, MessageOptions, Mimetype } from '@queenanya/baileys'
351
357
 
352
358
  const id = 'abcd@s.whatsapp.net' // the WhatsApp ID
353
359
  // send a simple text!
@@ -406,7 +412,7 @@ Sending media (video, stickers, images) is easier & more efficient than ever.
406
412
  - When specifying a media url, Baileys never loads the entire buffer into memory; it even encrypts the media as a readable stream.
407
413
 
408
414
  ``` ts
409
- import { MessageType, MessageOptions, Mimetype } from '@whiskeysockets/baileys'
415
+ import { MessageType, MessageOptions, Mimetype } from '@queenanya/baileys'
410
416
  // Sending gifs
411
417
  await sock.sendMessage(
412
418
  id,
@@ -456,7 +462,7 @@ await sock.sendMessage(
456
462
  Do not enter this field if you want to automatically generate a thumb
457
463
  */
458
464
  mimetype: Mimetype.pdf, /* (for media messages) specify the type of media (optional for all media types except documents),
459
- import {Mimetype} from '@whiskeysockets/baileys'
465
+ import {Mimetype} from '@queenanya/baileys'
460
466
  */
461
467
  fileName: 'somefile.pdf', // (for media messages) file name for the media
462
468
  /* will send audio messages as voice notes, if set to true */
@@ -515,7 +521,7 @@ The presence expires after about 10 seconds.
515
521
  If you want to save the media you received
516
522
  ``` ts
517
523
  import { writeFile } from 'fs/promises'
518
- import { downloadMediaMessage } from '@whiskeysockets/baileys'
524
+ import { downloadMediaMessage } from '@queenanya/baileys'
519
525
 
520
526
  sock.ev.on('messages.upsert', async ({ messages }) => {
521
527
  const m = messages[0]
@@ -802,6 +808,42 @@ Of course, replace ``` xyz ``` with an actual ID.
802
808
  console.log(response)
803
809
  ```
804
810
 
811
+
812
+ ## Channel
813
+ - To get newsletter info from code
814
+ ```ts
815
+ // https://whatsapp.com/channel/key
816
+ const key = '123wedss972279'
817
+ const result = await sock.getNewsletterInfo(key)
818
+ console.log(result)
819
+ ```
820
+ - To create newsletter
821
+ ```ts
822
+ const result = await sock.createNewsLetter('Name newsletter', 'Description news letter', { url: 'url profile pictur' })
823
+ console.log(result)
824
+ ```
825
+ - To get subscribed newsletters
826
+ ```ts
827
+
828
+ const result = await sock.getSubscribedNewsletters()
829
+ console.log(result)
830
+ ```
831
+ - To toggle mute newsletters
832
+ ```ts
833
+ const result = await sock.toggleMuteNewsletter(jid, true) // true to mute, false to unmute
834
+ console.log(result)
835
+ ```
836
+ - To follow newsletter
837
+ ```ts
838
+ const result = await sock.followNewsletter(jid)
839
+ console.log(result)
840
+ ```
841
+ - To unfollow newsletter
842
+ ```ts
843
+ const result = await sock.unFollowNewsletter(jid)
844
+ console.log(result)
845
+ ```
846
+
805
847
  ## Privacy
806
848
  - To get the privacy settings
807
849
  ``` ts
@@ -48,18 +48,19 @@ exports.PROCESSABLE_HISTORY_TYPES = [
48
48
  ];
49
49
  exports.DEFAULT_CONNECTION_CONFIG = {
50
50
  version: baileys_version_json_1.version,
51
- browser: Utils_1.Browsers.ubuntu('Chrome'),
51
+ browser: Utils_1.Browsers.ubuntu('Firefox'),
52
52
  waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat',
53
53
  connectTimeoutMs: 20000,
54
54
  keepAliveIntervalMs: 30000,
55
55
  logger: logger_1.default.child({ class: 'baileys' }),
56
- printQRInTerminal: false,
56
+ printQRInTerminal: true,
57
57
  emitOwnEvents: true,
58
- defaultQueryTimeoutMs: 60000,
58
+ defaultQueryTimeoutMs: undefined,
59
59
  customUploadHosts: [],
60
60
  retryRequestDelayMs: 250,
61
61
  maxMsgRetryCount: 5,
62
62
  fireInitQueries: true,
63
+ ignoreMsgLoading: false,
63
64
  auth: undefined,
64
65
  markOnlineOnConnect: true,
65
66
  syncFullHistory: false,
@@ -68,7 +69,7 @@ exports.DEFAULT_CONNECTION_CONFIG = {
68
69
  shouldIgnoreJid: () => false,
69
70
  linkPreviewImageThumbnailWidth: 192,
70
71
  transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 },
71
- generateHighQualityLinkPreview: false,
72
+ generateHighQualityLinkPreview: true,
72
73
  options: {},
73
74
  appStateMacVerification: {
74
75
  patch: false,
@@ -23,11 +23,11 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
23
23
  assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
24
24
  relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
25
25
  sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
26
- sendReceipts: (keys: import("../Types").WAProto.IMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
26
+ sendReceipts: (keys: import("../Types").WAMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
27
27
  getButtonArgs: (message: import("../Types").WAProto.IMessage) => {
28
28
  [key: string]: string;
29
29
  };
30
- readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>;
30
+ readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
31
31
  refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
32
32
  waUploadToServer: import("../Types").WAMediaUploadFunction;
33
33
  fetchPrivacySettings: (force?: boolean) => Promise<{
@@ -35,6 +35,27 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
35
35
  }>;
36
36
  updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
37
37
  sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>;
38
+ subscribeNewsletterUpdates: (jid: string) => Promise<{
39
+ duration: string;
40
+ }>;
41
+ newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
42
+ newsletterUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
43
+ newsletterUpdateName: (jid: string, name: string) => Promise<void>;
44
+ newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
45
+ newsletterRemovePicture: (jid: string) => Promise<void>;
46
+ newsletterUnfollow: (jid: string) => Promise<void>;
47
+ newsletterFollow: (jid: string) => Promise<void>;
48
+ newsletterUnmute: (jid: string) => Promise<void>;
49
+ newsletterMute: (jid: string) => Promise<void>;
50
+ newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
51
+ newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>;
52
+ newsletterAdminCount: (jid: string) => Promise<number>;
53
+ newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
54
+ newsletterDemote: (jid: string, user: string) => Promise<void>;
55
+ newsletterDelete: (jid: string) => Promise<void>;
56
+ newsletterReactMessage: (jid: string, server_id: string, code?: string | undefined) => Promise<void>;
57
+ newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
58
+ newsletterFetchUpdates: (jid: string, count: number, after?: number | undefined, since?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
38
59
  groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
39
60
  groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
40
61
  groupLeave: (id: string) => Promise<void>;
@@ -55,7 +76,8 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
55
76
  groupInviteCode: (jid: string) => Promise<string | undefined>;
56
77
  groupRevokeInvite: (jid: string) => Promise<string | undefined>;
57
78
  groupAcceptInvite: (code: string) => Promise<string | undefined>;
58
- groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
79
+ groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
80
+ groupAcceptInviteV4: (key: string | import("../Types").WAMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
59
81
  groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
60
82
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
61
83
  groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
@@ -77,6 +99,11 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
77
99
  jid: string;
78
100
  }[]>;
79
101
  fetchBlocklist: () => Promise<string[]>;
102
+ fetchDisappearingDuration: (...jids: string[]) => Promise<{
103
+ user: string;
104
+ duration: number;
105
+ setAt: Date;
106
+ }[]>;
80
107
  fetchStatus: (jid: string) => Promise<{
81
108
  status: string | undefined;
82
109
  setAt: Date;
@@ -98,6 +125,7 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
98
125
  resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
99
126
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
100
127
  cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
128
+ addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>;
101
129
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
102
130
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
103
131
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
@@ -3,6 +3,7 @@ import { Boom } from '@hapi/boom';
3
3
  import { proto } from '../../WAProto';
4
4
  import { ChatModification, MessageUpsertType, SocketConfig, WABusinessProfile, WAMediaUpload, WAPatchCreate, WAPresence, WAPrivacyCallValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types';
5
5
  import { BinaryNode } from '../WABinary';
6
+ import { LabelActionBody } from '../Types/Label';
6
7
  export declare const makeChatsSocket: (config: SocketConfig) => {
7
8
  processingMutex: {
8
9
  mutex<T>(code: () => T | Promise<T>): Promise<T>;
@@ -20,6 +21,11 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
20
21
  jid: string;
21
22
  }[]>;
22
23
  fetchBlocklist: () => Promise<string[]>;
24
+ fetchDisappearingDuration: (...jids: string[]) => Promise<{
25
+ user: string;
26
+ duration: number;
27
+ setAt: Date;
28
+ }[]>;
23
29
  fetchStatus: (jid: string) => Promise<{
24
30
  status: string | undefined;
25
31
  setAt: Date;
@@ -41,6 +47,7 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
41
47
  resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
42
48
  chatModify: (mod: ChatModification, jid: string) => Promise<void>;
43
49
  cleanDirtyBits: (type: 'account_sync' | 'groups', fromTimestamp?: number | string) => Promise<void>;
50
+ addLabel: (jid: string, labels: LabelActionBody) => Promise<void>;
44
51
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
45
52
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
46
53
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
@@ -173,6 +173,19 @@ const makeChatsSocket = (config) => {
173
173
  };
174
174
  }
175
175
  };
176
+ /** Fetching The Disappearing Duration of a specific chats by their jids*/
177
+ const fetchDisappearingDuration = async (...jids) => {
178
+ const list = jids.map((jid) => ({ tag: 'user', attrs: { jid } }));
179
+ const results = await interactiveQuery(list, { tag: 'disappearing_mode', attrs: {} });
180
+ return results.map(item => {
181
+ const result = (0, WABinary_1.getBinaryNodeChild)(item, 'disappearing_mode');
182
+ return {
183
+ user: item.attrs.jid,
184
+ duration: parseInt(result === null || result === void 0 ? void 0 : result.attrs.duration),
185
+ setAt: new Date(+((result === null || result === void 0 ? void 0 : result.attrs.t) || 0) * 1000)
186
+ };
187
+ });
188
+ };
176
189
  /** update the profile picture for yourself or a group */
177
190
  const updateProfilePicture = async (jid, content) => {
178
191
  const { img } = await (0, Utils_1.generateProfilePicture)(content);
@@ -648,6 +661,16 @@ const makeChatsSocket = (config) => {
648
661
  }
649
662
  }, jid);
650
663
  };
664
+ /**
665
+ * Adds label
666
+ */
667
+ const addLabel = (jid, labels) => {
668
+ return chatModify({
669
+ addLabel: {
670
+ ...labels
671
+ }
672
+ }, jid);
673
+ };
651
674
  /**
652
675
  * Adds label for the chats
653
676
  */
@@ -815,6 +838,7 @@ const makeChatsSocket = (config) => {
815
838
  profilePictureUrl,
816
839
  onWhatsApp,
817
840
  fetchBlocklist,
841
+ fetchDisappearingDuration,
818
842
  fetchStatus,
819
843
  updateProfilePicture,
820
844
  removeProfilePicture,
@@ -833,6 +857,7 @@ const makeChatsSocket = (config) => {
833
857
  resyncAppState,
834
858
  chatModify,
835
859
  cleanDirtyBits,
860
+ addLabel,
836
861
  addChatLabel,
837
862
  removeChatLabel,
838
863
  addMessageLabel,
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { proto } from '../../WAProto';
3
- import { GroupMetadata, ParticipantAction, SocketConfig } from '../Types';
3
+ import { GroupMetadata, ParticipantAction, SocketConfig, WAMessageKey } from '../Types';
4
4
  import { BinaryNode } from '../WABinary';
5
5
  export declare const makeGroupsSocket: (config: SocketConfig) => {
6
6
  groupMetadata: (jid: string) => Promise<GroupMetadata>;
@@ -23,12 +23,19 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
23
23
  groupInviteCode: (jid: string) => Promise<string | undefined>;
24
24
  groupRevokeInvite: (jid: string) => Promise<string | undefined>;
25
25
  groupAcceptInvite: (code: string) => Promise<string | undefined>;
26
+ /**
27
+ * revoke a v4 invite for someone
28
+ * @param groupJid group jid
29
+ * @param invitedJid jid of person you invited
30
+ * @returns true if successful
31
+ */
32
+ groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
26
33
  /**
27
34
  * accept a GroupInviteMessage
28
35
  * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
29
36
  * @param inviteMessage the message to accept
30
37
  */
31
- groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
38
+ groupAcceptInviteV4: (key: string | WAMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
32
39
  groupGetInviteInfo: (code: string) => Promise<GroupMetadata>;
33
40
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
34
41
  groupSettingUpdate: (jid: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked') => Promise<void>;
@@ -53,6 +60,11 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
53
60
  jid: string;
54
61
  }[]>;
55
62
  fetchBlocklist: () => Promise<string[]>;
63
+ fetchDisappearingDuration: (...jids: string[]) => Promise<{
64
+ user: string;
65
+ duration: number;
66
+ setAt: Date;
67
+ }[]>;
56
68
  fetchStatus: (jid: string) => Promise<{
57
69
  status: string | undefined;
58
70
  setAt: Date;
@@ -74,6 +86,7 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
74
86
  resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
75
87
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
76
88
  cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
89
+ addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>;
77
90
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
78
91
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
79
92
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
@@ -187,6 +187,16 @@ const makeGroupsSocket = (config) => {
187
187
  const result = (0, WABinary_1.getBinaryNodeChild)(results, 'group');
188
188
  return result === null || result === void 0 ? void 0 : result.attrs.jid;
189
189
  },
190
+ /**
191
+ * revoke a v4 invite for someone
192
+ * @param groupJid group jid
193
+ * @param invitedJid jid of person you invited
194
+ * @returns true if successful
195
+ */
196
+ groupRevokeInviteV4: async (groupJid, invitedJid) => {
197
+ const result = await groupQuery(groupJid, 'set', [{ tag: 'revoke', attrs: {}, content: [{ tag: 'participant', attrs: { jid: invitedJid } }] }]);
198
+ return !!result;
199
+ },
190
200
  /**
191
201
  * accept a GroupInviteMessage
192
202
  * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
@@ -225,7 +235,7 @@ const makeGroupsSocket = (config) => {
225
235
  await upsertMessage({
226
236
  key: {
227
237
  remoteJid: inviteMessage.groupJid,
228
- id: (0, Utils_1.generateMessageIDV2)((_a = sock.user) === null || _a === void 0 ? void 0 : _a.id),
238
+ id: (0, Utils_1.generateMessageIDV3)((_a = sock.user) === null || _a === void 0 ? void 0 : _a.id),
229
239
  fromMe: false,
230
240
  participant: key.remoteJid,
231
241
  },
@@ -24,11 +24,11 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
24
24
  assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
25
25
  relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
26
26
  sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
27
- sendReceipts: (keys: import("../Types").WAProto.IMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
27
+ sendReceipts: (keys: import("../Types").WAMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
28
28
  getButtonArgs: (message: import("../Types").WAProto.IMessage) => {
29
29
  [key: string]: string;
30
30
  };
31
- readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>;
31
+ readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
32
32
  refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
33
33
  waUploadToServer: import("../Types").WAMediaUploadFunction;
34
34
  fetchPrivacySettings: (force?: boolean) => Promise<{
@@ -36,6 +36,27 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
36
36
  }>;
37
37
  updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
38
38
  sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>;
39
+ subscribeNewsletterUpdates: (jid: string) => Promise<{
40
+ duration: string;
41
+ }>;
42
+ newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
43
+ newsletterUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
44
+ newsletterUpdateName: (jid: string, name: string) => Promise<void>;
45
+ newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
46
+ newsletterRemovePicture: (jid: string) => Promise<void>;
47
+ newsletterUnfollow: (jid: string) => Promise<void>;
48
+ newsletterFollow: (jid: string) => Promise<void>;
49
+ newsletterUnmute: (jid: string) => Promise<void>;
50
+ newsletterMute: (jid: string) => Promise<void>;
51
+ newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
52
+ newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>;
53
+ newsletterAdminCount: (jid: string) => Promise<number>;
54
+ newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
55
+ newsletterDemote: (jid: string, user: string) => Promise<void>;
56
+ newsletterDelete: (jid: string) => Promise<void>;
57
+ newsletterReactMessage: (jid: string, server_id: string, code?: string | undefined) => Promise<void>;
58
+ newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
59
+ newsletterFetchUpdates: (jid: string, count: number, after?: number | undefined, since?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
39
60
  groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
40
61
  groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
41
62
  groupLeave: (id: string) => Promise<void>;
@@ -56,7 +77,8 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
56
77
  groupInviteCode: (jid: string) => Promise<string | undefined>;
57
78
  groupRevokeInvite: (jid: string) => Promise<string | undefined>;
58
79
  groupAcceptInvite: (code: string) => Promise<string | undefined>;
59
- groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
80
+ groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
81
+ groupAcceptInviteV4: (key: string | import("../Types").WAMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
60
82
  groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
61
83
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
62
84
  groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
@@ -78,6 +100,11 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
78
100
  jid: string;
79
101
  }[]>;
80
102
  fetchBlocklist: () => Promise<string[]>;
103
+ fetchDisappearingDuration: (...jids: string[]) => Promise<{
104
+ user: string;
105
+ duration: number;
106
+ setAt: Date;
107
+ }[]>;
81
108
  fetchStatus: (jid: string) => Promise<{
82
109
  status: string | undefined;
83
110
  setAt: Date;
@@ -99,6 +126,7 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
99
126
  resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
100
127
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
101
128
  cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
129
+ addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>;
102
130
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
103
131
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
104
132
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { Boom } from '@hapi/boom';
3
3
  import { proto } from '../../WAProto';
4
- import { MessageReceiptType, MessageRelayOptions, SocketConfig } from '../Types';
4
+ import { MessageReceiptType, MessageRelayOptions, SocketConfig, WAMessageKey } from '../Types';
5
5
  import { BinaryNode } from '../WABinary';
6
6
  export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
7
7
  sendMessageAck: ({ tag, attrs, content }: BinaryNode) => Promise<void>;
@@ -11,11 +11,11 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
11
11
  assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
12
12
  relayMessage: (jid: string, message: proto.IMessage, { messageId: msgId, participant, additionalAttributes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: MessageRelayOptions) => Promise<string>;
13
13
  sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: MessageReceiptType) => Promise<void>;
14
- sendReceipts: (keys: proto.IMessageKey[], type: MessageReceiptType) => Promise<void>;
14
+ sendReceipts: (keys: WAMessageKey[], type: MessageReceiptType) => Promise<void>;
15
15
  getButtonArgs: (message: proto.IMessage) => {
16
16
  [key: string]: string;
17
17
  };
18
- readMessages: (keys: proto.IMessageKey[]) => Promise<void>;
18
+ readMessages: (keys: WAMessageKey[]) => Promise<void>;
19
19
  refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
20
20
  waUploadToServer: import("../Types").WAMediaUploadFunction;
21
21
  fetchPrivacySettings: (force?: boolean) => Promise<{
@@ -23,6 +23,27 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
23
23
  }>;
24
24
  updateMediaMessage: (message: proto.IWebMessageInfo) => Promise<proto.IWebMessageInfo>;
25
25
  sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<proto.WebMessageInfo | undefined>;
26
+ subscribeNewsletterUpdates: (jid: string) => Promise<{
27
+ duration: string;
28
+ }>;
29
+ newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
30
+ newsletterUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
31
+ newsletterUpdateName: (jid: string, name: string) => Promise<void>;
32
+ newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
33
+ newsletterRemovePicture: (jid: string) => Promise<void>;
34
+ newsletterUnfollow: (jid: string) => Promise<void>;
35
+ newsletterFollow: (jid: string) => Promise<void>;
36
+ newsletterUnmute: (jid: string) => Promise<void>;
37
+ newsletterMute: (jid: string) => Promise<void>;
38
+ newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
39
+ newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>;
40
+ newsletterAdminCount: (jid: string) => Promise<number>;
41
+ newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
42
+ newsletterDemote: (jid: string, user: string) => Promise<void>;
43
+ newsletterDelete: (jid: string) => Promise<void>;
44
+ newsletterReactMessage: (jid: string, server_id: string, code?: string | undefined) => Promise<void>;
45
+ newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
46
+ newsletterFetchUpdates: (jid: string, count: number, after?: number | undefined, since?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
26
47
  groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
27
48
  groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
28
49
  groupLeave: (id: string) => Promise<void>;
@@ -43,7 +64,8 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
43
64
  groupInviteCode: (jid: string) => Promise<string | undefined>;
44
65
  groupRevokeInvite: (jid: string) => Promise<string | undefined>;
45
66
  groupAcceptInvite: (code: string) => Promise<string | undefined>;
46
- groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
67
+ groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
68
+ groupAcceptInviteV4: (key: string | WAMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
47
69
  groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
48
70
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
49
71
  groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
@@ -65,6 +87,11 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
65
87
  jid: string;
66
88
  }[]>;
67
89
  fetchBlocklist: () => Promise<string[]>;
90
+ fetchDisappearingDuration: (...jids: string[]) => Promise<{
91
+ user: string;
92
+ duration: number;
93
+ setAt: Date;
94
+ }[]>;
68
95
  fetchStatus: (jid: string) => Promise<{
69
96
  status: string | undefined;
70
97
  setAt: Date;
@@ -86,6 +113,7 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
86
113
  resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
87
114
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
88
115
  cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
116
+ addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>;
89
117
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
90
118
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
91
119
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;