@pney/whatsapp-web 1.34.4 → 1.34.6-2

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/example.js CHANGED
@@ -523,6 +523,13 @@ client.on('message', async msg => {
523
523
  // NOTE: this action will take effect after you restart the client.
524
524
  const backgroundSync = await client.setBackgroundSync(true);
525
525
  console.log(backgroundSync);
526
+ } else if (msg.body === '!postStatus') {
527
+ await client.sendMessage('status@broadcast', 'Hello there!');
528
+ // send with a different style
529
+ await client.sendMessage('status@broadcast', 'Hello again! Looks different?', {
530
+ fontStyle: 1,
531
+ backgroundColor: '#0b3296'
532
+ });
526
533
  }
527
534
  });
528
535
 
package/index.d.ts CHANGED
@@ -113,9 +113,15 @@ declare namespace WAWebJS {
113
113
 
114
114
  /** Get all current Labels */
115
115
  getLabels(): Promise<Label[]>
116
-
116
+
117
117
  /** Get all current Broadcasts */
118
118
  getBroadcasts(): Promise<Broadcast[]>
119
+
120
+ /** Get broadcast instance by current user ID */
121
+ getBroadcastById(contactId: string): Promise<Broadcast>
122
+
123
+ /** Revoke current own status messages */
124
+ revokeStatusMessage(messageId: string): Promise<void>
119
125
 
120
126
  /** Change labels in chats */
121
127
  addOrRemoveLabels(labelIds: Array<number|string>, chatIds: Array<string>): Promise<void>
@@ -316,12 +322,7 @@ declare namespace WAWebJS {
316
322
  on(event: 'auth_failure', listener: (message: string) => void): this
317
323
 
318
324
  /** Emitted when authentication is successful */
319
- on(event: 'authenticated', listener: (
320
- /**
321
- * Object containing session information, when using LegacySessionAuth. Can be used to restore the session
322
- */
323
- session?: ClientSession
324
- ) => void): this
325
+ on(event: 'authenticated', listener: () => void): this
325
326
 
326
327
  /**
327
328
  * Emitted when the battery percentage for the attached device changes
@@ -556,6 +557,9 @@ declare namespace WAWebJS {
556
557
  /** Timeout for authentication selector in puppeteer
557
558
  * @default 0 */
558
559
  authTimeoutMs?: number,
560
+ /** function to be evaluated On New Document
561
+ * @default undefined */
562
+ evalOnNewDoc?: Function,
559
563
  /** Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/ */
560
564
  puppeteer?: puppeteer.PuppeteerNodeLaunchOptions & puppeteer.ConnectOptions
561
565
  /** Determines how to save and restore sessions. Will use LegacySessionAuth if options.session is set. Otherwise, NoAuth will be used. */
@@ -566,15 +570,7 @@ declare namespace WAWebJS {
566
570
  webVersionCache?: WebCacheOptions,
567
571
  /** How many times should the qrcode be refreshed before giving up
568
572
  * @default 0 (disabled) */
569
- qrMaxRetries?: number,
570
- /**
571
- * @deprecated This option should be set directly on the LegacySessionAuth
572
- */
573
- restartOnAuthFail?: boolean
574
- /**
575
- * @deprecated Only here for backwards-compatibility. You should move to using LocalAuth, or set the authStrategy to LegacySessionAuth explicitly.
576
- */
577
- session?: ClientSession
573
+ qrMaxRetries?: number
578
574
  /** If another whatsapp web session is detected (another browser), take over the session in the current browser
579
575
  * @default false */
580
576
  takeoverOnConflict?: boolean,
@@ -691,27 +687,6 @@ declare namespace WAWebJS {
691
687
  extract: (options: { session: string, path: string }) => Promise<any> | any,
692
688
  }
693
689
 
694
- /**
695
- * Legacy session auth strategy
696
- * Not compatible with multi-device accounts.
697
- */
698
- export class LegacySessionAuth extends AuthStrategy {
699
- constructor(options?: {
700
- session?: ClientSession,
701
- restartOnAuthFail?: boolean,
702
- })
703
- }
704
-
705
- /**
706
- * Represents a WhatsApp client session
707
- */
708
- export interface ClientSession {
709
- WABrowserId: string,
710
- WASecretBundle: string,
711
- WAToken1: string,
712
- WAToken2: string,
713
- }
714
-
715
690
  /**
716
691
  * @deprecated
717
692
  */
@@ -867,6 +842,8 @@ declare namespace WAWebJS {
867
842
  AUTHENTICATED = 'authenticated',
868
843
  AUTHENTICATION_FAILURE = 'auth_failure',
869
844
  READY = 'ready',
845
+ CHAT_REMOVED = 'chat_removed',
846
+ CHAT_ARCHIVED = 'chat_archived',
870
847
  MESSAGE_RECEIVED = 'message',
871
848
  MESSAGE_CIPHERTEXT = 'message_ciphertext',
872
849
  MESSAGE_CREATE = 'message_create',
@@ -874,6 +851,8 @@ declare namespace WAWebJS {
874
851
  MESSAGE_REVOKED_ME = 'message_revoke_me',
875
852
  MESSAGE_ACK = 'message_ack',
876
853
  MESSAGE_EDIT = 'message_edit',
854
+ UNREAD_COUNT = 'unread_count',
855
+ MESSAGE_REACTION = 'message_reaction',
877
856
  MEDIA_UPLOADED = 'media_uploaded',
878
857
  CONTACT_CHANGED = 'contact_changed',
879
858
  GROUP_JOIN = 'group_join',
@@ -884,6 +863,7 @@ declare namespace WAWebJS {
884
863
  QR_RECEIVED = 'qr',
885
864
  CODE_RECEIVED = 'code',
886
865
  LOADING_SCREEN = 'loading_screen',
866
+ CALL = 'call',
887
867
  DISCONNECTED = 'disconnected',
888
868
  STATE_CHANGED = 'change_state',
889
869
  BATTERY_CHANGED = 'change_battery',
@@ -1569,6 +1549,8 @@ declare namespace WAWebJS {
1569
1549
  /** Gets the Contact's common groups with you. Returns empty array if you don't have any common group. */
1570
1550
  getCommonGroups: () => Promise<ChatId[]>
1571
1551
 
1552
+ /** Gets the Contact's current status broadcast. */
1553
+ getBroadcast: () => Promise<Broadcast>
1572
1554
  }
1573
1555
 
1574
1556
  export interface ContactId {
@@ -1701,6 +1683,8 @@ declare namespace WAWebJS {
1701
1683
  lastMessage: Message,
1702
1684
  /** Indicates if the Chat is pinned */
1703
1685
  pinned: boolean,
1686
+ /** Indicates if the Chat is locked */
1687
+ isLocked: boolean,
1704
1688
 
1705
1689
  /** Archives this chat */
1706
1690
  archive: () => Promise<void>,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pney/whatsapp-web",
3
- "version": "1.34.4",
3
+ "version": "1.34.6-2",
4
4
  "description": "Library for interacting with the WhatsApp Web API ",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",
@@ -29,7 +29,6 @@
29
29
  },
30
30
  "homepage": "https://wwebjs.dev/",
31
31
  "dependencies": {
32
- "@pedroslopez/moduleraid": "^5.0.2",
33
32
  "fluent-ffmpeg": "2.1.3",
34
33
  "mime": "^3.0.0",
35
34
  "node-fetch": "^2.6.9",