diff --git a/docs/Base.html b/docs/Base.html
index 50d0054..959ce40 100644
--- a/docs/Base.html
+++ b/docs/Base.html
@@ -4,7 +4,7 @@
|
parseVCards
@@ -2163,7 +2191,7 @@
diff --git a/docs/index.html b/docs/index.html
index fc956fb..fc3861c 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -3,7 +3,7 @@
- whatsapp-web.js 1.21.0 » Home
+ whatsapp-web.js 1.22.0 » Home
@@ -13,7 +13,7 @@
@@ -26,11 +26,11 @@
- 
+ 
whatsapp-web.js
A WhatsApp API client that connects through the WhatsApp Web browser app
It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocked.
@@ -553,6 +553,11 @@ limitations under the License.
+
+ Chat#changeLabels(labelIds)
+
+
+
Chat#clearMessages()
@@ -583,16 +588,16 @@ limitations under the License.
-
- Chat#id
-
-
-
+ -
+ Chat#pinned
+
+ -
+
-
Chat#sendMessage(content[, options])
@@ -757,6 +762,11 @@ limitations under the License.
-
+ -
+ Client#addOrRemoveLabels(labelIds, chatIds)
+
+ -
+
-
Client#archiveChat()
@@ -867,6 +877,11 @@ limitations under the License.
-
+ -
+ Client#event:message_edit
+
+ -
+
-
Client#event:message_reaction
@@ -1364,12 +1379,12 @@ limitations under the License.
-
-
- Events.MESSAGE_REACTION
+ Events.MESSAGE_EDIT
-
-
- Events.MESSAGE_RECEIVED
+ Events.MESSAGE_REACTION
-
@@ -1378,6 +1393,11 @@ limitations under the License.
-
-
+
+
+
+
+
+
@@ -3560,7 +3622,7 @@ limitations under the License.
diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html
index fdab601..5eae552 100644
--- a/docs/structures_Base.js.html
+++ b/docs/structures_Base.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/Base.js
+ whatsapp-web.js 1.22.0 » Source: structures/Base.js
@@ -15,7 +15,7 @@
@@ -60,7 +60,7 @@ module.exports = Base;
diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html
index 449b79a..e21b1f6 100644
--- a/docs/structures_BusinessContact.js.html
+++ b/docs/structures_BusinessContact.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/BusinessContact.js
+ whatsapp-web.js 1.22.0 » Source: structures/BusinessContact.js
@@ -15,7 +15,7 @@
@@ -59,7 +59,7 @@ module.exports = BusinessContact;
diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html
index 4df1480..77107b5 100644
--- a/docs/structures_Buttons.js.html
+++ b/docs/structures_Buttons.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/Buttons.js
+ whatsapp-web.js 1.22.0 » Source: structures/Buttons.js
@@ -15,7 +15,7 @@
@@ -120,7 +120,7 @@ module.exports = Buttons;
diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html
index 003433a..bfef610 100644
--- a/docs/structures_Call.js.html
+++ b/docs/structures_Call.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/Call.js
+ whatsapp-web.js 1.22.0 » Source: structures/Call.js
@@ -15,7 +15,7 @@
@@ -114,7 +114,7 @@ module.exports = Call;
diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html
index f4c265b..b49a26d 100644
--- a/docs/structures_Chat.js.html
+++ b/docs/structures_Chat.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/Chat.js
+ whatsapp-web.js 1.22.0 » Source: structures/Chat.js
@@ -15,7 +15,7 @@
@@ -218,7 +218,7 @@ class Chat extends Base {
if (m.isNotification) {
return false; // dont include notification messages
}
- if (searchOptions && searchOptions.fromMe && m.id.fromMe !== searchOptions.fromMe) {
+ if (searchOptions && searchOptions.fromMe !== undefined && m.id.fromMe !== searchOptions.fromMe) {
return false;
}
return true;
@@ -292,6 +292,15 @@ class Chat extends Base {
async getLabels() {
return this.client.getChatLabels(this.id._serialized);
}
+
+ /**
+ * Add or remove labels to this Chat
+ * @param {Array<number|string>} labelIds
+ * @returns {Promise<void>}
+ */
+ async changeLabels(labelIds) {
+ return this.client.addOrRemoveLabels(labelIds, [this.id._serialized]);
+ }
}
module.exports = Chat;
@@ -305,7 +314,7 @@ module.exports = Chat;
diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html
index 1c4a02b..c911106 100644
--- a/docs/structures_ClientInfo.js.html
+++ b/docs/structures_ClientInfo.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/ClientInfo.js
+ whatsapp-web.js 1.22.0 » Source: structures/ClientInfo.js
@@ -15,7 +15,7 @@
@@ -109,7 +109,7 @@ module.exports = ClientInfo;
diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html
index 9345e2e..8a0f9b6 100644
--- a/docs/structures_Contact.js.html
+++ b/docs/structures_Contact.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/Contact.js
+ whatsapp-web.js 1.22.0 » Source: structures/Contact.js
@@ -15,7 +15,7 @@
@@ -187,9 +187,10 @@ class Contact extends Base {
await this.client.pupPage.evaluate(async (contactId) => {
const contact = window.Store.Contact.get(contactId);
- await window.Store.BlockContact.blockContact(contact);
+ await window.Store.BlockContact.blockContact({contact});
}, this.id._serialized);
+ this.isBlocked = true;
return true;
}
@@ -205,6 +206,7 @@ class Contact extends Base {
await window.Store.BlockContact.unblockContact(contact);
}, this.id._serialized);
+ this.isBlocked = false;
return true;
}
@@ -245,7 +247,7 @@ module.exports = Contact;
diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html
index a4b7a05..379cfe5 100644
--- a/docs/structures_GroupChat.js.html
+++ b/docs/structures_GroupChat.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/GroupChat.js
+ whatsapp-web.js 1.22.0 » Source: structures/GroupChat.js
@@ -15,7 +15,7 @@
@@ -184,8 +184,9 @@ class GroupChat extends Chat {
const success = await this.client.pupPage.evaluate(async (chatId, description) => {
const chatWid = window.Store.WidFactory.createWid(chatId);
let descId = window.Store.GroupMetadata.get(chatWid).descId;
+ let newId = await window.Store.MsgKey.newId();
try {
- await window.Store.GroupUtils.setGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId);
+ await window.Store.GroupUtils.setGroupDescription(chatWid, description, newId, descId);
return true;
} catch (err) {
if(err.name === 'ServerStatusCodeError') return false;
@@ -309,7 +310,8 @@ class GroupChat extends Chat {
}
-module.exports = GroupChat;
+module.exports = GroupChat;
+
@@ -319,7 +321,7 @@ module.exports = GroupChat;
diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html
index d6f358c..12b22d2 100644
--- a/docs/structures_GroupNotification.js.html
+++ b/docs/structures_GroupNotification.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/GroupNotification.js
+ whatsapp-web.js 1.22.0 » Source: structures/GroupNotification.js
@@ -15,7 +15,7 @@
@@ -143,7 +143,7 @@ module.exports = GroupNotification;
diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html
index c445dda..bd7bcd3 100644
--- a/docs/structures_Label.js.html
+++ b/docs/structures_Label.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/Label.js
+ whatsapp-web.js 1.22.0 » Source: structures/Label.js
@@ -15,7 +15,7 @@
@@ -88,7 +88,7 @@ module.exports = Label;
diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html
index 3a0fe0f..5cf4cfa 100644
--- a/docs/structures_List.js.html
+++ b/docs/structures_List.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/List.js
+ whatsapp-web.js 1.22.0 » Source: structures/List.js
@@ -15,7 +15,7 @@
@@ -118,7 +118,7 @@ module.exports = List;
diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html
index f42ed8b..6bb5a58 100644
--- a/docs/structures_Location.js.html
+++ b/docs/structures_Location.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/Location.js
+ whatsapp-web.js 1.22.0 » Source: structures/Location.js
@@ -15,7 +15,7 @@
@@ -71,7 +71,7 @@ module.exports = Location;
diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html
index 1e2da20..b2e23a0 100644
--- a/docs/structures_Message.js.html
+++ b/docs/structures_Message.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/Message.js
+ whatsapp-web.js 1.22.0 » Source: structures/Message.js
@@ -15,7 +15,7 @@
@@ -38,6 +38,7 @@ const Order = require('./Order');
const Payment = require('./Payment');
const Reaction = require('./Reaction');
const {MessageTypes} = require('../util/Constants');
+const {Contact} = require('./Contact');
/**
* Represents a Message on WhatsApp
@@ -198,8 +199,8 @@ class Message extends Base {
inviteCodeExp: data.inviteCodeExp,
groupId: data.inviteGrp,
groupName: data.inviteGrpName,
- fromId: data.from._serialized,
- toId: data.to._serialized
+ fromId: data.from?._serialized ? data.from._serialized : data.from,
+ toId: data.to?._serialized ? data.to._serialized : data.to
} : undefined;
/**
@@ -255,6 +256,16 @@ class Message extends Base {
this.productId = data.productId;
}
+ /** Last edit time */
+ if (data.latestEditSenderTimestampMs) {
+ this.latestEditSenderTimestampMs = data.latestEditSenderTimestampMs;
+ }
+
+ /** Last edit message author */
+ if (data.latestEditMsgKey) {
+ this.latestEditMsgKey = data.latestEditMsgKey;
+ }
+
/**
* Links included in the message.
* @type {Array<{link: string, isSuspicious: boolean}>}
@@ -607,6 +618,42 @@ class Message extends Base {
return reaction;
});
}
+
+ /**
+ * Edits the current message.
+ * @param {string} content
+ * @param {MessageEditOptions} [options] - Options used when editing the message
+ * @returns {Promise<?Message>}
+ */
+ async edit(content, options = {}) {
+ if (options.mentions && options.mentions.some(possiblyContact => possiblyContact instanceof Contact)) {
+ options.mentions = options.mentions.map(a => a.id._serialized);
+ }
+ let internalOptions = {
+ linkPreview: options.linkPreview === false ? undefined : true,
+ mentionedJidList: Array.isArray(options.mentions) ? options.mentions : [],
+ extraOptions: options.extra
+ };
+
+ if (!this.fromMe) {
+ return null;
+ }
+ const messageEdit = await this.client.pupPage.evaluate(async (msgId, message, options) => {
+ let msg = window.Store.Msg.get(msgId);
+ if (!msg) return null;
+
+ let catEdit = (msg.type === 'chat' && window.Store.MsgActionChecks.canEditText(msg));
+ if (catEdit) {
+ const msgEdit = await window.WWebJS.editMessage(msg, message, options);
+ return msgEdit.serialize();
+ }
+ return null;
+ }, this.id._serialized, content, internalOptions);
+ if (messageEdit) {
+ return new Message(this.client, messageEdit);
+ }
+ return null;
+ }
}
module.exports = Message;
@@ -620,7 +667,7 @@ module.exports = Message;
diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html
index 52eee0f..a6f8452 100644
--- a/docs/structures_MessageMedia.js.html
+++ b/docs/structures_MessageMedia.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/MessageMedia.js
+ whatsapp-web.js 1.22.0 » Source: structures/MessageMedia.js
@@ -15,7 +15,7 @@
@@ -150,7 +150,7 @@ module.exports = MessageMedia;
diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html
index f897513..76885cd 100644
--- a/docs/structures_Order.js.html
+++ b/docs/structures_Order.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/Order.js
+ whatsapp-web.js 1.22.0 » Source: structures/Order.js
@@ -15,7 +15,7 @@
@@ -90,7 +90,7 @@ module.exports = Order;
diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html
index c587588..c2f7e95 100644
--- a/docs/structures_Payment.js.html
+++ b/docs/structures_Payment.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/Payment.js
+ whatsapp-web.js 1.22.0 » Source: structures/Payment.js
@@ -15,7 +15,7 @@
@@ -118,7 +118,7 @@ module.exports = Payment;
diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html
index 8ff1bf6..a9385a1 100644
--- a/docs/structures_PrivateChat.js.html
+++ b/docs/structures_PrivateChat.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/PrivateChat.js
+ whatsapp-web.js 1.22.0 » Source: structures/PrivateChat.js
@@ -15,7 +15,7 @@
@@ -51,7 +51,7 @@ module.exports = PrivateChat;
diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html
index c563483..03c09fd 100644
--- a/docs/structures_PrivateContact.js.html
+++ b/docs/structures_PrivateContact.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/PrivateContact.js
+ whatsapp-web.js 1.22.0 » Source: structures/PrivateContact.js
@@ -15,7 +15,7 @@
@@ -51,7 +51,7 @@ module.exports = PrivateContact;
diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html
index d262544..a811fdc 100644
--- a/docs/structures_Product.js.html
+++ b/docs/structures_Product.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/Product.js
+ whatsapp-web.js 1.22.0 » Source: structures/Product.js
@@ -15,7 +15,7 @@
@@ -106,7 +106,7 @@ module.exports = Product;
diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html
index d8237fe..ef50c7c 100644
--- a/docs/structures_ProductMetadata.js.html
+++ b/docs/structures_ProductMetadata.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/ProductMetadata.js
+ whatsapp-web.js 1.22.0 » Source: structures/ProductMetadata.js
@@ -15,7 +15,7 @@
@@ -63,7 +63,7 @@ module.exports = ProductMetadata;
diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html
index 57ff50e..ffb3aae 100644
--- a/docs/structures_Reaction.js.html
+++ b/docs/structures_Reaction.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: structures/Reaction.js
+ whatsapp-web.js 1.22.0 » Source: structures/Reaction.js
@@ -15,7 +15,7 @@
@@ -107,7 +107,7 @@ module.exports = Reaction;
diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html
index b5635ef..00babc2 100644
--- a/docs/util_Constants.js.html
+++ b/docs/util_Constants.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: util/Constants.js
+ whatsapp-web.js 1.22.0 » Source: util/Constants.js
@@ -15,7 +15,7 @@
@@ -38,7 +38,7 @@ exports.DefaultOptions = {
headless: true,
defaultViewport: null
},
- webVersion: '2.2322.15',
+ webVersion: '2.2333.11',
webVersionCache: {
type: 'local',
},
@@ -79,6 +79,7 @@ exports.Events = {
MESSAGE_REVOKED_EVERYONE: 'message_revoke_everyone',
MESSAGE_REVOKED_ME: 'message_revoke_me',
MESSAGE_ACK: 'message_ack',
+ MESSAGE_EDIT: 'message_edit',
UNREAD_COUNT: 'unread_count',
MESSAGE_REACTION: 'message_reaction',
MEDIA_UPLOADED: 'media_uploaded',
@@ -210,7 +211,7 @@ exports.MessageAck = {
diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html
index 56eea05..6834395 100644
--- a/docs/util_InterfaceController.js.html
+++ b/docs/util_InterfaceController.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: util/InterfaceController.js
+ whatsapp-web.js 1.22.0 » Source: util/InterfaceController.js
@@ -15,7 +15,7 @@
@@ -166,7 +166,7 @@ module.exports = InterfaceController;
diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html
index 417ed9e..a377c3e 100644
--- a/docs/util_Util.js.html
+++ b/docs/util_Util.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: util/Util.js
+ whatsapp-web.js 1.22.0 » Source: util/Util.js
@@ -15,7 +15,7 @@
@@ -225,7 +225,7 @@ module.exports = Util;
diff --git a/docs/webCache_LocalWebCache.js.html b/docs/webCache_LocalWebCache.js.html
index 1b2df2b..1f91989 100644
--- a/docs/webCache_LocalWebCache.js.html
+++ b/docs/webCache_LocalWebCache.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: webCache/LocalWebCache.js
+ whatsapp-web.js 1.22.0 » Source: webCache/LocalWebCache.js
@@ -15,7 +15,7 @@
@@ -81,7 +81,7 @@ module.exports = LocalWebCache;
diff --git a/docs/webCache_RemoteWebCache.js.html b/docs/webCache_RemoteWebCache.js.html
index e734e2c..e7555ac 100644
--- a/docs/webCache_RemoteWebCache.js.html
+++ b/docs/webCache_RemoteWebCache.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: webCache/RemoteWebCache.js
+ whatsapp-web.js 1.22.0 » Source: webCache/RemoteWebCache.js
@@ -15,7 +15,7 @@
@@ -78,7 +78,7 @@ module.exports = RemoteWebCache;
diff --git a/docs/webCache_WebCache.js.html b/docs/webCache_WebCache.js.html
index 60c5208..bc8d58d 100644
--- a/docs/webCache_WebCache.js.html
+++ b/docs/webCache_WebCache.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.21.0 » Source: webCache/WebCache.js
+ whatsapp-web.js 1.22.0 » Source: webCache/WebCache.js
@@ -15,7 +15,7 @@
@@ -52,7 +52,7 @@ module.exports = {
diff --git a/package.json b/package.json
index efb8e86..7bba253 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "whatsapp-web.js",
- "version": "2.0.0-alpha.0",
+ "version": "1.22.0",
"description": "Library for interacting with the WhatsApp Web API ",
"main": "./index.js",
"typings": "./index.d.ts",
|