whatsapp-web.js 1.27.0 → 1.28.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
@@ -1158,7 +1158,10 @@ declare namespace WAWebJS {
1158
1158
  /** Sticker author, if sendMediaAsSticker is true */
1159
1159
  stickerAuthor?: string
1160
1160
  /** Sticker categories, if sendMediaAsSticker is true */
1161
- stickerCategories?: string[]
1161
+ stickerCategories?: string[],
1162
+ /** Should the bot send a quoted message without the quoted message if it fails to get the quote?
1163
+ * @default false (disabled) */
1164
+ ignoreQuoteErrors?: boolean
1162
1165
  }
1163
1166
 
1164
1167
  /** Options for editing a message */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whatsapp-web.js",
3
- "version": "1.27.0",
3
+ "version": "1.28.0",
4
4
  "description": "Library for interacting with the WhatsApp Web API ",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",
@@ -98,7 +98,7 @@ class GroupChat extends Chat {
98
98
  419: 'The participant can\'t be added because the group is full'
99
99
  };
100
100
 
101
- await window.Store.GroupQueryAndUpdate(groupWid);
101
+ await window.Store.GroupQueryAndUpdate({ id: groupId });
102
102
  const groupMetadata = group.groupMetadata;
103
103
  const groupParticipants = groupMetadata?.participants;
104
104
 
@@ -55,7 +55,6 @@ exports.ExposeStore = () => {
55
55
  window.Store.MediaTypes = window.require('WAWebMmsMediaTypes');
56
56
  window.Store.MediaUpload = window.require('WAWebMediaMmsV4Upload');
57
57
  window.Store.MsgKey = window.require('WAWebMsgKey');
58
- window.Store.NumberInfo = window.require('WAPhoneUtils');
59
58
  window.Store.OpaqueData = window.require('WAWebMediaOpaqueData');
60
59
  window.Store.QueryProduct = window.require('WAWebBizProductCatalogBridge');
61
60
  window.Store.QueryOrder = window.require('WAWebBizOrderBridge');
@@ -102,6 +101,11 @@ exports.ExposeStore = () => {
102
101
  if (window.compareWwebVersions(window.Debug.VERSION, '>=', '2.3000.1014111620'))
103
102
  window.Store.AddonReactionTable = window.require('WAWebAddonReactionTableMode').reactionTableMode;
104
103
 
104
+ window.Store.NumberInfo = {
105
+ ...window.require('WAPhoneUtils'),
106
+ ...window.require('WAPhoneFindCC')
107
+ };
108
+
105
109
  window.Store.ForwardUtils = {
106
110
  ...window.require('WAWebForwardMessagesToChat')
107
111
  };
@@ -46,20 +46,24 @@ exports.LoadUtils = () => {
46
46
  if (options.quotedMessageId) {
47
47
  let quotedMessage = await window.Store.Msg.getMessagesById([options.quotedMessageId]);
48
48
 
49
- if (quotedMessage['messages'].length != 1) {
50
- throw new Error('Could not get the quoted message.');
51
- }
52
-
53
- quotedMessage = quotedMessage['messages'][0];
49
+ if (quotedMessage['messages'].length == 1) {
50
+ quotedMessage = quotedMessage['messages'][0];
54
51
 
55
- // TODO remove .canReply() once all clients are updated to >= v2.2241.6
56
- const canReply = window.Store.ReplyUtils ?
57
- window.Store.ReplyUtils.canReplyMsg(quotedMessage.unsafe()) :
58
- quotedMessage.canReply();
52
+ // TODO remove .canReply() once all clients are updated to >= v2.2241.6
53
+ const canReply = window.Store.ReplyUtils ?
54
+ window.Store.ReplyUtils.canReplyMsg(quotedMessage.unsafe()) :
55
+ quotedMessage.canReply();
59
56
 
60
- if (canReply) {
61
- quotedMsgOptions = quotedMessage.msgContextInfo(chat);
57
+ if (canReply) {
58
+ quotedMsgOptions = quotedMessage.msgContextInfo(chat);
59
+ }
60
+ }else{
61
+ if(!options.ignoreQuoteErrors) {
62
+ throw new Error('Could not get the quoted message.');
63
+ }
62
64
  }
65
+
66
+ delete options.ignoreQuoteErrors;
63
67
  delete options.quotedMessageId;
64
68
  }
65
69
 
@@ -921,7 +925,7 @@ exports.LoadUtils = () => {
921
925
  let response;
922
926
  let result = [];
923
927
 
924
- await window.Store.GroupQueryAndUpdate(groupWid);
928
+ await window.Store.GroupQueryAndUpdate({ id: groupId });
925
929
 
926
930
  if (!requesterIds?.length) {
927
931
  membershipRequests = group.groupMetadata.membershipApprovalRequests._models.map(({ id }) => id);