diff --git a/docs/._index.html b/docs/._index.html
new file mode 100644
index 0000000..ccd54df
Binary files /dev/null and b/docs/._index.html differ
diff --git a/docs/Base.html b/docs/Base.html
index 64e1129..f3b22fc 100644
--- a/docs/Base.html
+++ b/docs/Base.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Class: Base
+ whatsapp-web.js 1.0.0 » Class: Base
@@ -15,7 +15,7 @@
@@ -50,7 +50,7 @@
diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html
index 732cef2..f7770ee 100644
--- a/docs/BusinessContact.html
+++ b/docs/BusinessContact.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Class: BusinessContact
+ whatsapp-web.js 1.0.0 » Class: BusinessContact
@@ -15,7 +15,7 @@
@@ -48,27 +48,61 @@
isBusiness
+ isEnterprise
+
+
+ isGroup
+
+
+
+
+
+
@@ -108,6 +142,41 @@
Inherited from
Contact#isEnterprise
+ isGroup
+ unknown
+ Indicates if the contact is a group contact
+
+ - Inherited from
+ - Contact#isGroup
+
+ isMe
+ unknown
+ Indicates if the contact is the current user's contact
+
+ - Inherited from
+ - Contact#isMe
+
+
+ Indicates if the number is saved in the current phone's contacts
+
+ - Inherited from
+ - Contact#isMyContact
+
+ isUser
+ unknown
+ Indicates if the contact is a user contact
+
+ - Inherited from
+ - Contact#isUser
+
+
+ Indicates if the number is registered on WhatsApp
+
+ - Inherited from
+ - Contact#isWAContact
+
name
unknown
The contact's name, as saved by the current user
@@ -115,6 +184,13 @@
Inherited from
Contact#name
+ number
+ unknown
+ Contact's phone number
+
+ - Inherited from
+ - Contact#number
+
pushname
unknown
The name that the contact has configured to be shown publically
@@ -130,6 +206,18 @@
Contact#shortName
+ Method
+
+ async
+ getProfilePicUrl() → Promise containing string
+ Returns the contact's profile picture URL, if privacy settings allow it
+
+ - Inherited from
+ - Contact#getProfilePicUrl
+ - Returns
+
+
+
@@ -139,7 +227,7 @@
diff --git a/docs/Chat.html b/docs/Chat.html
index 6f52a4f..dd4ec3d 100644
--- a/docs/Chat.html
+++ b/docs/Chat.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Class: Chat
+ whatsapp-web.js 1.0.0 » Class: Chat
@@ -15,7 +15,7 @@
@@ -149,7 +149,7 @@
content
- (string or MessageMedia)
+ (string, MessageMedia, or Location)
|
@@ -190,7 +190,7 @@
diff --git a/docs/Client.html b/docs/Client.html
index 1152e69..58fa630 100644
--- a/docs/Client.html
+++ b/docs/Client.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Class: Client
+ whatsapp-web.js 1.0.0 » Class: Client
@@ -15,7 +15,7 @@
@@ -26,7 +26,7 @@
|
- (string or MessageMedia)
+ (string, MessageMedia, or Location)
|
@@ -340,6 +343,40 @@
+ async
+ setStatus(status)
+ Sets the current user's status message
+
+ Parameter
+
+
+
+ | Name |
+ Type |
+ Optional |
+ Description |
+
+
+
+
+ |
+ status
+ |
+
+ string
+ |
+
+
+ |
+
+ New status message
+ |
+
+
+
+
+
+
Events
@@ -410,6 +447,35 @@
disconnected
Emitted when the client has been disconnected
+
+ Parameter
+
+
+
+ | Name |
+ Type |
+ Optional |
+ Description |
+
+
+
+
+ |
+ reason
+ |
+
+ WAState
+ |
+
+
+ |
+
+ state that caused the disconnect
+ |
+
+
+
+
message
@@ -607,7 +673,7 @@
diff --git a/docs/Client.js.html b/docs/Client.js.html
index 1091be5..d0557b4 100644
--- a/docs/Client.js.html
+++ b/docs/Client.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Source: Client.js
+ whatsapp-web.js 1.0.0 » Source: Client.js
@@ -15,7 +15,7 @@
@@ -44,6 +44,7 @@ const ContactFactory = require('./factories/ContactFactory');
const ClientInfo = require('./structures/ClientInfo');
const Message = require('./structures/Message');
const MessageMedia = require('./structures/MessageMedia');
+const Location = require('./structures/Location');
/**
* Starting point for interacting with the WhatsApp Web API
@@ -236,8 +237,9 @@ class Client extends EventEmitter {
/**
* Emitted when the client has been disconnected
* @event Client#disconnected
+ * @param {WAState} reason state that caused the disconnect
*/
- this.emit(Events.DISCONNECTED);
+ this.emit(Events.DISCONNECTED, state);
this.destroy();
}
});
@@ -270,14 +272,15 @@ class Client extends EventEmitter {
/**
* Send a message to a specific chatId
* @param {string} chatId
- * @param {string|MessageMedia} content
+ * @param {string|MessageMedia|Location} content
* @param {object} options
* @returns {Promise<Message>} Message that was just sent
*/
async sendMessage(chatId, content, options={}) {
let internalOptions = {
caption: options.caption,
- quotedMessageId: options.quotedMessageId
+ quotedMessageId: options.quotedMessageId,
+ mentionedJidList: Array.isArray(options.mentions) ? options.mentions.map(contact => contact.id._serialized) : []
};
if(content instanceof MessageMedia) {
@@ -286,6 +289,9 @@ class Client extends EventEmitter {
} else if(options.media instanceof MessageMedia) {
internalOptions.media = options.media;
internalOptions.caption = content;
+ } else if(content instanceof Location) {
+ internalOptions.location = content;
+ content = '';
}
const newMessage = await this.pupPage.evaluate(async (chatId, message, options) => {
@@ -358,6 +364,16 @@ class Client extends EventEmitter {
return chatId._serialized;
}
+ /**
+ * Sets the current user's status message
+ * @param {string} status New status message
+ */
+ async setStatus(status) {
+ await this.pupPage.evaluate(async status => {
+ return await window.Store.Wap.sendSetStatus(status);
+ }, status);
+ }
+
}
module.exports = Client;
@@ -371,7 +387,7 @@ module.exports = Client;
diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html
index f456f2f..070ecfa 100644
--- a/docs/ClientInfo.html
+++ b/docs/ClientInfo.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Class: ClientInfo
+ whatsapp-web.js 1.0.0 » Class: ClientInfo
@@ -15,7 +15,7 @@
@@ -187,7 +187,7 @@
diff --git a/docs/Contact.html b/docs/Contact.html
index 3b84c59..ddbd3ee 100644
--- a/docs/Contact.html
+++ b/docs/Contact.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Class: Contact
+ whatsapp-web.js 1.0.0 » Class: Contact
@@ -15,7 +15,7 @@
@@ -45,20 +45,38 @@
isBusiness
-
-
-
+
+
@@ -95,11 +129,41 @@
Indicates if the contact is an enterprise contact
+ isGroup
+ boolean
+ Indicates if the contact is a group contact
+
+
+ isMe
+ boolean
+ Indicates if the contact is the current user's contact
+
+
+
+ Indicates if the number is saved in the current phone's contacts
+
+
+ isUser
+ boolean
+ Indicates if the contact is a user contact
+
+
+
+ Indicates if the number is registered on WhatsApp
+
+
name
nullable string
The contact's name, as saved by the current user
+ number
+ string
+ Contact's phone number
+
+
pushname
string
The name that the contact has configured to be shown publically
@@ -111,6 +175,18 @@
+ Method
+
+ async
+ getProfilePicUrl() → Promise containing string
+ Returns the contact's profile picture URL, if privacy settings allow it
+
+ - Returns
+ -
+
Promise containing string
+
+
+
@@ -120,7 +196,7 @@
diff --git a/docs/GroupChat.html b/docs/GroupChat.html
index 3423bb1..e37fb2c 100644
--- a/docs/GroupChat.html
+++ b/docs/GroupChat.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Class: GroupChat
+ whatsapp-web.js 1.0.0 » Class: GroupChat
@@ -15,7 +15,7 @@
@@ -555,7 +555,7 @@
diff --git a/docs/Location.html b/docs/Location.html
new file mode 100644
index 0000000..35872ac
--- /dev/null
+++ b/docs/Location.html
@@ -0,0 +1,164 @@
+
+
+
+
+
+
+ whatsapp-web.js 1.0.0 » Class: Location
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ new Location(latitude, longitude, description)
+
+ Parameters
+
+
+
+ | Name |
+ Type |
+ Optional |
+ Description |
+
+
+
+
+ |
+ latitude
+ |
+
+
+ |
+
+
+ |
+
+ |
+
+
+ |
+ longitude
+ |
+
+
+ |
+
+
+ |
+
+ |
+
+
+ |
+ description
+ |
+
+
+ |
+
+
+ |
+
+ Value can be null.
+ |
+
+
+
+
+
+
+
+
+ Properties
+
+ description
+ nullable string
+ Name for the location
+
+
+ latitude
+ number
+ Location latitude
+
+
+ longitude
+ number
+ Location longitude
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/Message.html b/docs/Message.html
index 7ca656a..e0fdf94 100644
--- a/docs/Message.html
+++ b/docs/Message.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Class: Message
+ whatsapp-web.js 1.0.0 » Class: Message
@@ -15,7 +15,7 @@
@@ -26,7 +26,7 @@
|
- (string or MessageMedia)
+ (string, MessageMedia, or Location)
|
@@ -305,7 +333,7 @@
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html
index da3a986..00c061d 100644
--- a/docs/MessageMedia.html
+++ b/docs/MessageMedia.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Class: MessageMedia
+ whatsapp-web.js 1.0.0 » Class: MessageMedia
@@ -15,7 +15,7 @@
@@ -152,7 +152,7 @@
diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html
index b86c308..e66230e 100644
--- a/docs/PrivateChat.html
+++ b/docs/PrivateChat.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Class: PrivateChat
+ whatsapp-web.js 1.0.0 » Class: PrivateChat
@@ -15,7 +15,7 @@
@@ -203,7 +203,7 @@
diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html
index f7b8162..07f50ea 100644
--- a/docs/PrivateContact.html
+++ b/docs/PrivateContact.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Class: PrivateContact
+ whatsapp-web.js 1.0.0 » Class: PrivateContact
@@ -15,7 +15,7 @@
@@ -45,20 +45,38 @@
isBusiness
-
-
-
+
+
@@ -101,6 +135,41 @@
Inherited from
Contact#isEnterprise
+ isGroup
+ unknown
+ Indicates if the contact is a group contact
+
+ - Inherited from
+ - Contact#isGroup
+
+ isMe
+ unknown
+ Indicates if the contact is the current user's contact
+
+ - Inherited from
+ - Contact#isMe
+
+
+ Indicates if the number is saved in the current phone's contacts
+
+ - Inherited from
+ - Contact#isMyContact
+
+ isUser
+ unknown
+ Indicates if the contact is a user contact
+
+ - Inherited from
+ - Contact#isUser
+
+
+ Indicates if the number is registered on WhatsApp
+
+ - Inherited from
+ - Contact#isWAContact
+
name
unknown
The contact's name, as saved by the current user
@@ -108,6 +177,13 @@
Inherited from
Contact#name
+ number
+ unknown
+ Contact's phone number
+
+ - Inherited from
+ - Contact#number
+
pushname
unknown
The name that the contact has configured to be shown publically
@@ -123,6 +199,18 @@
Contact#shortName
+ Method
+
+ async
+ getProfilePicUrl() → Promise containing string
+ Returns the contact's profile picture URL, if privacy settings allow it
+
+ - Inherited from
+ - Contact#getProfilePicUrl
+ - Returns
+
+
+
@@ -132,7 +220,7 @@
diff --git a/docs/Util.html b/docs/Util.html
index 7548a3d..5ee11e4 100644
--- a/docs/Util.html
+++ b/docs/Util.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Class: Util
+ whatsapp-web.js 1.0.0 » Class: Util
@@ -15,7 +15,7 @@
@@ -50,7 +50,7 @@
diff --git a/docs/global.html b/docs/global.html
index 03ac865..91f25fc 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Globals
+ whatsapp-web.js 1.0.0 » Globals
@@ -15,7 +15,7 @@
@@ -366,6 +366,71 @@
|
|
+
+ |
+ LOCATION
+ |
+
+
+ |
+
+
+ |
+
+ |
+
+
+ |
+ CONTACT_CARD
+ |
+
+
+ |
+
+
+ |
+
+ |
+
+
+ |
+ CONTACT_CARD_MULTI
+ |
+
+
+ |
+
+
+ |
+
+ |
+
+
+ |
+ REVOKED
+ |
+
+
+ |
+
+
+ |
+
+ |
+
+
+ |
+ UNKNOWN
+ |
+
+
+ |
+
+
+ |
+
+ |
+
@@ -618,7 +683,7 @@
diff --git a/docs/index.html b/docs/index.html
index 99e51a6..d4cb18b 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Home
+ whatsapp-web.js 1.0.0 » Home
@@ -15,7 +15,7 @@
@@ -27,11 +27,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.
@@ -100,7 +100,11 @@ client.initialize();
| Send location |
- pending |
+ ✅ |
+
+
+ | Receive location |
+ ✅ |
| Message replies |
@@ -110,6 +114,10 @@ client.initialize();
Join groups by invite |
✅ |
+
+ | Get invite for group |
+ ✅ |
+
| Modify group info (subject, description) |
✅ |
@@ -128,12 +136,20 @@ client.initialize();
| Mention users |
- pending |
+ ✅ |
| Get contact info |
✅ |
+
+ | Get profile pictures |
+ ✅ |
+
+
+ | Set user status message |
+ ✅ |
+
Something missing? Make an issue and let us know!
@@ -186,22 +202,56 @@ client.initialize();
+
+ BusinessContact#getProfilePicUrl()
+
+
+
BusinessContact#id
+
+ BusinessContact#isBusiness
+
+
+
+
-
-
+
-
+
@@ -486,6 +542,11 @@ client.initialize();
+
+ Contact#getProfilePicUrl()
+
+
+
Contact#id
@@ -496,29 +557,59 @@ client.initialize();
-
-
-
+
+
-
+
Message
@@ -763,15 +893,15 @@ client.initialize();
-
-
-
+
-
+
+
-
Message#isForwarded
-
+ -
+ Message#location
+
+ -
+
+ -
+ Message#mentionedIds
+
+ -
+
-
Message#reply(content, chatId, options)
@@ -887,12 +1032,17 @@ client.initialize();
-
-
- MessageTypes.DOCUMENT
+ MessageTypes.CONTACT_CARD
-
-
- MessageTypes.IMAGE
+ MessageTypes.CONTACT_CARD_MULTI
+
+ -
+
+ -
+ MessageTypes.DOCUMENT
-
@@ -901,24 +1051,44 @@ client.initialize();
+
-
-
+
+
-
-
-
PrivateContact#shortName
@@ -1188,7 +1393,7 @@ client.initialize();
diff --git a/docs/scripts/jsdoc-toc.js b/docs/scripts/jsdoc-toc.js
index f0c6e20..3ad0a65 100644
--- a/docs/scripts/jsdoc-toc.js
+++ b/docs/scripts/jsdoc-toc.js
@@ -6,7 +6,7 @@
treeNode.tree({
autoEscape: false,
closedIcon: '⇢',
- data: [{"label":"Globals","id":"global","children":[]},{"label":"Base","id":"Base","children":[]},{"label":"BusinessContact","id":"BusinessContact","children":[]},{"label":"Chat","id":"Chat","children":[]},{"label":"Client","id":"Client","children":[]},{"label":"ClientInfo","id":"ClientInfo","children":[]},{"label":"Contact","id":"Contact","children":[]},{"label":"GroupChat","id":"GroupChat","children":[]},{"label":"Message","id":"Message","children":[]},{"label":"MessageMedia","id":"MessageMedia","children":[]},{"label":"PrivateChat","id":"PrivateChat","children":[]},{"label":"PrivateContact","id":"PrivateContact","children":[]},{"label":"Util","id":"Util","children":[]}],
+ data: [{"label":"Globals","id":"global","children":[]},{"label":"Base","id":"Base","children":[]},{"label":"BusinessContact","id":"BusinessContact","children":[]},{"label":"Chat","id":"Chat","children":[]},{"label":"Client","id":"Client","children":[]},{"label":"ClientInfo","id":"ClientInfo","children":[]},{"label":"Contact","id":"Contact","children":[]},{"label":"GroupChat","id":"GroupChat","children":[]},{"label":"Location","id":"Location","children":[]},{"label":"Message","id":"Message","children":[]},{"label":"MessageMedia","id":"MessageMedia","children":[]},{"label":"PrivateChat","id":"PrivateChat","children":[]},{"label":"PrivateContact","id":"PrivateContact","children":[]},{"label":"Util","id":"Util","children":[]}],
openedIcon: ' ⇣',
saveState: false,
useContextMenu: false
diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html
index 6deb428..2c6ced4 100644
--- a/docs/structures_Base.js.html
+++ b/docs/structures_Base.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Source: structures/Base.js
+ whatsapp-web.js 1.0.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 5b8f553..b9b986b 100644
--- a/docs/structures_BusinessContact.js.html
+++ b/docs/structures_BusinessContact.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Source: structures/BusinessContact.js
+ whatsapp-web.js 1.0.0 » Source: structures/BusinessContact.js
@@ -15,7 +15,7 @@
@@ -59,7 +59,7 @@ module.exports = BusinessContact;
diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html
index dbf73cd..37e07ad 100644
--- a/docs/structures_Chat.js.html
+++ b/docs/structures_Chat.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Source: structures/Chat.js
+ whatsapp-web.js 1.0.0 » Source: structures/Chat.js
@@ -15,7 +15,7 @@
@@ -86,7 +86,7 @@ class Chat extends Base {
/**
* Send a message to this chat
- * @param {string|MessageMedia} content
+ * @param {string|MessageMedia|Location} content
* @param {object} options
* @returns {Promise<Message>} Message that was just sent
*/
@@ -105,7 +105,7 @@ module.exports = Chat;
diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html
index fcf1bfa..f8a998f 100644
--- a/docs/structures_ClientInfo.js.html
+++ b/docs/structures_ClientInfo.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Source: structures/ClientInfo.js
+ whatsapp-web.js 1.0.0 » Source: structures/ClientInfo.js
@@ -15,7 +15,7 @@
@@ -89,7 +89,7 @@ module.exports = ClientInfo;
diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html
index c64deab..9276151 100644
--- a/docs/structures_Contact.js.html
+++ b/docs/structures_Contact.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Source: structures/Contact.js
+ whatsapp-web.js 1.0.0 » Source: structures/Contact.js
@@ -15,7 +15,7 @@
@@ -51,6 +51,12 @@ class Contact extends Base {
*/
this.id = data.id;
+ /**
+ * Contact's phone number
+ * @type {string}
+ */
+ this.number = data.userid;
+
/**
* Indicates if the contact is a business contact
* @type {boolean}
@@ -90,8 +96,50 @@ class Contact extends Base {
this.verifiedLevel = data.verifiedLevel;
this.verifiedName = data.verifiedName;
+ /**
+ * Indicates if the contact is the current user's contact
+ * @type {boolean}
+ */
+ this.isMe = data.isMe;
+
+ /**
+ * Indicates if the contact is a user contact
+ * @type {boolean}
+ */
+ this.isUser = data.isUser;
+
+ /**
+ * Indicates if the contact is a group contact
+ * @type {boolean}
+ */
+ this.isGroup = data.isGroup;
+
+ /**
+ * Indicates if the number is registered on WhatsApp
+ * @type {boolean}
+ */
+ this.isWAContact = data.isWAContact;
+
+ /**
+ * Indicates if the number is saved in the current phone's contacts
+ * @type {boolean}
+ */
+ this.isMyContact = data.isMyContact;
+
return super._patch(data);
}
+
+ /**
+ * Returns the contact's profile picture URL, if privacy settings allow it
+ * @returns {Promise<string>}
+ */
+ async getProfilePicUrl() {
+ const profilePic = await this.client.pupPage.evaluate((contactId) => {
+ return window.Store.Wap.profilePicFind(contactId);
+ }, this.id._serialized);
+
+ return profilePic ? profilePic.eurl : undefined;
+ }
}
@@ -105,7 +153,7 @@ module.exports = Contact;
diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html
index 0dad25f..7e588b5 100644
--- a/docs/structures_GroupChat.js.html
+++ b/docs/structures_GroupChat.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Source: structures/GroupChat.js
+ whatsapp-web.js 1.0.0 » Source: structures/GroupChat.js
@@ -15,7 +15,7 @@
@@ -209,7 +209,7 @@ module.exports = GroupChat;
diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html
new file mode 100644
index 0000000..7e4b15d
--- /dev/null
+++ b/docs/structures_Location.js.html
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+ whatsapp-web.js 1.0.0 » Source: structures/Location.js
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'use strict';
+
+/**
+ * Location information
+ */
+class Location {
+ /**
+ * @param {number} latitude
+ * @param {number} longitude
+ * @param {?string} description
+ */
+ constructor(latitude, longitude, description) {
+ /**
+ * Location latitude
+ * @type {number}
+ */
+ this.latitude = latitude;
+
+ /**
+ * Location longitude
+ * @type {number}
+ */
+ this.longitude = longitude;
+
+ /**
+ * Name for the location
+ * @type {?string}
+ */
+ this.description = description;
+ }
+}
+
+module.exports = Location;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html
index 5889929..388b723 100644
--- a/docs/structures_Message.js.html
+++ b/docs/structures_Message.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Source: structures/Message.js
+ whatsapp-web.js 1.0.0 » Source: structures/Message.js
@@ -15,7 +15,7 @@
@@ -33,6 +33,8 @@
const Base = require('./Base');
const MessageMedia = require('./MessageMedia');
+const Location = require('./Location');
+const { MessageTypes } = require('../util/Constants');
/**
* Represents a Message on WhatsApp
@@ -121,6 +123,22 @@ class Message extends Base {
*/
this.hasQuotedMsg = data.quotedMsg ? true : false;
+ /**
+ * Location information contained in the message, if the message is type "location"
+ * @type {Location}
+ */
+ this.location = data.type === MessageTypes.LOCATION ? new Location(data.lat, data.lng, data.loc) : undefined;
+
+ /**
+ * Indicates the mentions in the message body.
+ * @type {Array<string>}
+ */
+ this.mentionedIds = [];
+
+ if (data.mentionedJidList) {
+ this.mentionedIds = data.mentionedJidList;
+ }
+
return super._patch(data);
}
@@ -141,7 +159,15 @@ class Message extends Base {
* @returns {Promise<Contact>}
*/
getContact() {
- return this.client.getContactById(this._getChatId());
+ return this.client.getContactById(this.author || this.from);
+ }
+
+ /**
+ * Returns the Contacts mentioned in this message
+ * @returns {Promise<Array<Contact>>}
+ */
+ async getMentions() {
+ return await Promise.all(this.mentionedIds.map(async m => await this.client.getContactById(m)));
}
/**
@@ -164,7 +190,7 @@ class Message extends Base {
* through the specified Chat. If not, it will send the message
* in the same Chat as the original message was sent.
*
- * @param {string|MessageMedia} content
+ * @param {string|MessageMedia|Location} content
* @param {?string} chatId
* @param {object} options
* @returns {Promise<Message>}
@@ -209,7 +235,8 @@ class Message extends Base {
}
}
-module.exports = Message;
+module.exports = Message;
+
@@ -219,7 +246,7 @@ module.exports = Message;
diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html
index 691f4ed..5cbd128 100644
--- a/docs/structures_MessageMedia.js.html
+++ b/docs/structures_MessageMedia.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Source: structures/MessageMedia.js
+ whatsapp-web.js 1.0.0 » Source: structures/MessageMedia.js
@@ -15,7 +15,7 @@
@@ -69,7 +69,7 @@ module.exports = MessageMedia;
diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html
index d557dd6..ff96991 100644
--- a/docs/structures_PrivateChat.js.html
+++ b/docs/structures_PrivateChat.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Source: structures/PrivateChat.js
+ whatsapp-web.js 1.0.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 0c6a657..1e60329 100644
--- a/docs/structures_PrivateContact.js.html
+++ b/docs/structures_PrivateContact.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Source: structures/PrivateContact.js
+ whatsapp-web.js 1.0.0 » Source: structures/PrivateContact.js
@@ -15,7 +15,7 @@
@@ -51,7 +51,7 @@ module.exports = PrivateContact;
diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html
index 499b7f2..b5c6f58 100644
--- a/docs/util_Constants.js.html
+++ b/docs/util_Constants.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Source: util/Constants.js
+ whatsapp-web.js 1.0.0 » Source: util/Constants.js
@@ -15,7 +15,7 @@
@@ -82,7 +82,12 @@ exports.MessageTypes = {
IMAGE: 'image',
VIDEO: 'video',
DOCUMENT: 'document',
- STICKER: 'sticker'
+ STICKER: 'sticker',
+ LOCATION: 'location',
+ CONTACT_CARD: 'vcard',
+ CONTACT_CARD_MULTI: 'multi_vcard',
+ REVOKED: 'revoked',
+ UNKNOWN: 'unknown'
};
/**
@@ -124,7 +129,7 @@ exports.WAState = {
diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html
index 7a5555d..6d70d39 100644
--- a/docs/util_Util.js.html
+++ b/docs/util_Util.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 0.3.2-post » Source: util/Util.js
+ whatsapp-web.js 1.0.0 » Source: util/Util.js
@@ -15,7 +15,7 @@
@@ -73,7 +73,7 @@ module.exports = Util;
diff --git a/package.json b/package.json
index d94a0ba..d642dc1 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "whatsapp-web.js",
- "version": "0.3.2-post",
+ "version": "1.0.0",
"description": "Library for interacting with the WhatsApp Web API ",
"main": "./index.js",
"scripts": {
diff --git a/src/structures/Chat.js b/src/structures/Chat.js
index 834fb5b..dd12d10 100644
--- a/src/structures/Chat.js
+++ b/src/structures/Chat.js
@@ -55,7 +55,7 @@ class Chat extends Base {
/**
* Send a message to this chat
- * @param {string|MessageMedia} content
+ * @param {string|MessageMedia|Location} content
* @param {object} options
* @returns {Promise} Message that was just sent
*/
diff --git a/src/structures/Message.js b/src/structures/Message.js
index 73d4926..573b5ab 100644
--- a/src/structures/Message.js
+++ b/src/structures/Message.js
@@ -159,7 +159,7 @@ class Message extends Base {
* through the specified Chat. If not, it will send the message
* in the same Chat as the original message was sent.
*
- * @param {string|MessageMedia} content
+ * @param {string|MessageMedia|Location} content
* @param {?string} chatId
* @param {object} options
* @returns {Promise}