whatsapp-web.js 1.23.0 → 1.23.1-alpha.0

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/index.d.ts CHANGED
@@ -143,6 +143,27 @@ declare namespace WAWebJS {
143
143
  * @param displayName New display name
144
144
  */
145
145
  setDisplayName(displayName: string): Promise<boolean>
146
+
147
+ /**
148
+ * Changes the autoload Audio
149
+ * @param flag true/false on or off
150
+ */
151
+ setAutoDownloadAudio(flag: boolean): Promise<void>
152
+ /**
153
+ * Changes the autoload Documents
154
+ * @param flag true/false on or off
155
+ */
156
+ setAutoDownloadDocuments(flag: boolean): Promise<void>
157
+ /**
158
+ * Changes the autoload Photos
159
+ * @param flag true/false on or off
160
+ */
161
+ setAutoDownloadPhotos(flag: boolean): Promise<void>
162
+ /**
163
+ * Changes the autoload Videos
164
+ * @param flag true/false on or off
165
+ */
166
+ setAutoDownloadVideos(flag: boolean): Promise<void>
146
167
 
147
168
  /** Changes and returns the archive state of the Chat */
148
169
  unarchiveChat(chatId: string): Promise<boolean>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whatsapp-web.js",
3
- "version": "1.23.0",
3
+ "version": "1.23.1-alpha.0",
4
4
  "description": "Library for interacting with the WhatsApp Web API ",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",
package/src/Client.js CHANGED
@@ -1047,8 +1047,8 @@ class Client extends EventEmitter {
1047
1047
  if(!window.Store.Conn.canSetMyPushname()) return false;
1048
1048
 
1049
1049
  if(window.Store.MDBackend) {
1050
- // TODO
1051
- return false;
1050
+ await window.Store.Settings.setPushname(displayName);
1051
+ return true;
1052
1052
  } else {
1053
1053
  const res = await window.Store.Wap.setPushname(displayName);
1054
1054
  return !res.status || res.status === 200;
@@ -1597,6 +1597,67 @@ class Client extends EventEmitter {
1597
1597
  return await window.WWebJS.membershipRequestAction(groupId, 'Reject', requesterIds, sleep);
1598
1598
  }, groupId, options);
1599
1599
  }
1600
+
1601
+
1602
+ /**
1603
+ * Setting autoload download audio
1604
+ * @param {boolean} flag true/false
1605
+ */
1606
+ async setAutoDownloadAudio(flag) {
1607
+ await this.pupPage.evaluate(async flag => {
1608
+ const autoDownload = window.Store.Settings.getAutoDownloadAudio();
1609
+ if (autoDownload === flag) {
1610
+ return flag;
1611
+ }
1612
+ await window.Store.Settings.setAutoDownloadAudio(flag);
1613
+ return flag;
1614
+ }, flag);
1615
+ }
1616
+
1617
+ /**
1618
+ * Setting autoload download documents
1619
+ * @param {boolean} flag true/false
1620
+ */
1621
+ async setAutoDownloadDocuments(flag) {
1622
+ await this.pupPage.evaluate(async flag => {
1623
+ const autoDownload = window.Store.Settings.getAutoDownloadDocuments();
1624
+ if (autoDownload === flag) {
1625
+ return flag;
1626
+ }
1627
+ await window.Store.Settings.setAutoDownloadDocuments(flag);
1628
+ return flag;
1629
+ }, flag);
1630
+ }
1631
+
1632
+ /**
1633
+ * Setting autoload download photos
1634
+ * @param {boolean} flag true/false
1635
+ */
1636
+ async setAutoDownloadPhotos(flag) {
1637
+ await this.pupPage.evaluate(async flag => {
1638
+ const autoDownload = window.Store.Settings.getAutoDownloadPhotos();
1639
+ if (autoDownload === flag) {
1640
+ return flag;
1641
+ }
1642
+ await window.Store.Settings.setAutoDownloadPhotos(flag);
1643
+ return flag;
1644
+ }, flag);
1645
+ }
1646
+
1647
+ /**
1648
+ * Setting autoload download videos
1649
+ * @param {boolean} flag true/false
1650
+ */
1651
+ async setAutoDownloadVideos(flag) {
1652
+ await this.pupPage.evaluate(async flag => {
1653
+ const autoDownload = window.Store.Settings.getAutoDownloadVideos();
1654
+ if (autoDownload === flag) {
1655
+ return flag;
1656
+ }
1657
+ await window.Store.Settings.setAutoDownloadVideos(flag);
1658
+ return flag;
1659
+ }, flag);
1660
+ }
1600
1661
  }
1601
1662
 
1602
1663
  module.exports = Client;
@@ -58,6 +58,10 @@ exports.ExposeStore = (moduleRaidStr) => {
58
58
  window.Store.LidUtils = window.mR.findModule('getCurrentLid')[0];
59
59
  window.Store.WidToJid = window.mR.findModule('widToUserJid')[0];
60
60
  window.Store.JidToWid = window.mR.findModule('userJidToUserWid')[0];
61
+ window.Store.Settings = {
62
+ ...window.mR.findModule('ChatlistPanelState')[0],
63
+ setPushname: window.mR.findModule((m) => m.setPushname && !m.ChatlistPanelState)[0].setPushname
64
+ };
61
65
 
62
66
  /* eslint-disable no-undef, no-cond-assign */
63
67
  window.Store.QueryExist = ((m = window.mR.findModule('queryExists')[0]) ? m.queryExists : window.mR.findModule('queryExist')[0].queryWidExists);