|
client
@@ -330,7 +343,7 @@
diff --git a/docs/Order.html b/docs/Order.html
index 90414bf..ba94b62 100644
--- a/docs/Order.html
+++ b/docs/Order.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Class: Order
+ whatsapp-web.js 1.15.4 » Class: Order
@@ -15,7 +15,7 @@
@@ -102,7 +102,7 @@
diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html
index d1ec3a8..0c133cc 100644
--- a/docs/PrivateChat.html
+++ b/docs/PrivateChat.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Class: PrivateChat
+ whatsapp-web.js 1.15.4 » Class: PrivateChat
@@ -15,7 +15,7 @@
@@ -520,7 +520,7 @@
diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html
index 4c5e732..bfb5bbf 100644
--- a/docs/PrivateContact.html
+++ b/docs/PrivateContact.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Class: PrivateContact
+ whatsapp-web.js 1.15.4 » Class: PrivateContact
@@ -15,7 +15,7 @@
@@ -307,7 +307,7 @@
diff --git a/docs/Product.html b/docs/Product.html
index 288265c..d8847d7 100644
--- a/docs/Product.html
+++ b/docs/Product.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Class: Product
+ whatsapp-web.js 1.15.4 » Class: Product
@@ -15,7 +15,7 @@
@@ -127,7 +127,7 @@
diff --git a/docs/Util.html b/docs/Util.html
index bde8558..06fac76 100644
--- a/docs/Util.html
+++ b/docs/Util.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Class: Util
+ whatsapp-web.js 1.15.4 » Class: Util
@@ -15,7 +15,7 @@
@@ -240,7 +240,7 @@
diff --git a/docs/global.html b/docs/global.html
index 969a026..7e20759 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Globals
+ whatsapp-web.js 1.15.4 » Globals
@@ -15,7 +15,7 @@
@@ -1647,7 +1647,7 @@
diff --git a/docs/index.html b/docs/index.html
index 3217f10..ae60120 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Home
+ whatsapp-web.js 1.15.4 » Home
@@ -15,7 +15,7 @@
@@ -27,11 +27,11 @@
+
-
-
-
Message#location
@@ -2936,7 +2941,7 @@ client.initialize();
diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html
index d126d20..1734407 100644
--- a/docs/structures_Base.js.html
+++ b/docs/structures_Base.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/Base.js
+ whatsapp-web.js 1.15.4 » 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 b7484d6..0107e07 100644
--- a/docs/structures_BusinessContact.js.html
+++ b/docs/structures_BusinessContact.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/BusinessContact.js
+ whatsapp-web.js 1.15.4 » 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 d99863a..1cd7a29 100644
--- a/docs/structures_Buttons.js.html
+++ b/docs/structures_Buttons.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/Buttons.js
+ whatsapp-web.js 1.15.4 » Source: structures/Buttons.js
@@ -15,7 +15,7 @@
@@ -106,7 +106,7 @@ module.exports = Buttons;
diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html
index 8cfb518..d3e4b3b 100644
--- a/docs/structures_Call.js.html
+++ b/docs/structures_Call.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/Call.js
+ whatsapp-web.js 1.15.4 » Source: structures/Call.js
@@ -15,7 +15,7 @@
@@ -106,7 +106,7 @@ module.exports = Call;
diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html
index ece1a14..f02e790 100644
--- a/docs/structures_Chat.js.html
+++ b/docs/structures_Chat.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/Chat.js
+ whatsapp-web.js 1.15.4 » Source: structures/Chat.js
@@ -15,7 +15,7 @@
@@ -288,7 +288,7 @@ module.exports = Chat;
diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html
index e7549c6..152d87e 100644
--- a/docs/structures_ClientInfo.js.html
+++ b/docs/structures_ClientInfo.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/ClientInfo.js
+ whatsapp-web.js 1.15.4 » Source: structures/ClientInfo.js
@@ -15,7 +15,7 @@
@@ -108,7 +108,7 @@ module.exports = ClientInfo;
diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html
index 49d3e72..7b3f383 100644
--- a/docs/structures_Contact.js.html
+++ b/docs/structures_Contact.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/Contact.js
+ whatsapp-web.js 1.15.4 » Source: structures/Contact.js
@@ -15,7 +15,7 @@
@@ -236,7 +236,7 @@ module.exports = Contact;
diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html
index 4a6eca9..3b25141 100644
--- a/docs/structures_GroupChat.js.html
+++ b/docs/structures_GroupChat.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/GroupChat.js
+ whatsapp-web.js 1.15.4 » Source: structures/GroupChat.js
@@ -15,7 +15,7 @@
@@ -239,7 +239,7 @@ module.exports = GroupChat;
diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html
index 3ba22ef..7eae0cf 100644
--- a/docs/structures_GroupNotification.js.html
+++ b/docs/structures_GroupNotification.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/GroupNotification.js
+ whatsapp-web.js 1.15.4 » 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 554b6a8..b4e3a2a 100644
--- a/docs/structures_Label.js.html
+++ b/docs/structures_Label.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/Label.js
+ whatsapp-web.js 1.15.4 » 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 5987e93..7ec83c2 100644
--- a/docs/structures_List.js.html
+++ b/docs/structures_List.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/List.js
+ whatsapp-web.js 1.15.4 » Source: structures/List.js
@@ -15,7 +15,7 @@
@@ -88,7 +88,7 @@ class List {
*/
_format(sections){
if(!sections.length){throw '[LT02] List without sections';}
- if(sections.length > 1){throw '[LT05] Lists with more than one section are having problems';}
+ if(sections.length > 1 && sections.filter(s => typeof s.title == 'undefined').length > 1){throw '[LT05] You can\'t have more than one empty title.';}
return sections.map( (section) =>{
if(!section.rows.length){throw '[LT03] Section without rows';}
return {
@@ -107,7 +107,8 @@ class List {
}
-module.exports = List;
+module.exports = List;
+
@@ -117,7 +118,7 @@ module.exports = List;
diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html
index 17df91a..8f3baed 100644
--- a/docs/structures_Location.js.html
+++ b/docs/structures_Location.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/Location.js
+ whatsapp-web.js 1.15.4 » 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 d5233ef..01057f0 100644
--- a/docs/structures_Message.js.html
+++ b/docs/structures_Message.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/Message.js
+ whatsapp-web.js 1.15.4 » Source: structures/Message.js
@@ -15,7 +15,7 @@
@@ -210,6 +210,12 @@ class Message extends Base {
*/
this.token = data.token ? data.token : undefined;
+ /**
+ * Indicates whether the message is a Gif
+ * @type {boolean}
+ */
+ this.isGif = Boolean(data.isGif);
+
/** Title */
if (data.title) {
this.title = data.title;
@@ -513,7 +519,7 @@ module.exports = Message;
diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html
index 2c4cd14..ca61004 100644
--- a/docs/structures_MessageMedia.js.html
+++ b/docs/structures_MessageMedia.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/MessageMedia.js
+ whatsapp-web.js 1.15.4 » Source: structures/MessageMedia.js
@@ -15,7 +15,7 @@
@@ -81,29 +81,29 @@ class MessageMedia {
* Creates a MessageMedia instance from a URL
* @param {string} url
* @param {Object} [options]
- * @param {number} [options.unsafeMime=false]
+ * @param {boolean} [options.unsafeMime=false]
+ * @param {string} [options.filename]
* @param {object} [options.client]
* @param {object} [options.reqOptions]
* @param {number} [options.reqOptions.size=0]
* @returns {Promise<MessageMedia>}
*/
static async fromUrl(url, options = {}) {
- let mimetype;
+ const pUrl = new URL(url);
+ let mimetype = mime.getType(pUrl.pathname);
- if (!options.unsafeMime) {
- const pUrl = new URL(url);
- mimetype = mime.getType(pUrl.pathname);
-
- if (!mimetype)
- throw new Error('Unable to determine MIME type');
- }
+ if (!mimetype && !options.unsafeMime)
+ throw new Error('Unable to determine MIME type using URL. Set unsafeMime to true to download it anyway.');
async function fetchData (url, options) {
const reqOptions = Object.assign({ headers: { accept: 'image/* video/* text/* audio/*' } }, options);
const response = await fetch(url, reqOptions);
const mime = response.headers.get('Content-Type');
- let data = '';
+ const contentDisposition = response.headers.get('Content-Disposition');
+ const name = contentDisposition ? contentDisposition.match(/((?<=filename=")(.*)(?="))/) : null;
+
+ let data = '';
if (response.buffer) {
data = (await response.buffer()).toString('base64');
} else {
@@ -114,21 +114,25 @@ class MessageMedia {
data = btoa(data);
}
- return { data, mime };
+ return { data, mime, name };
}
const res = options.client
? (await options.client.pupPage.evaluate(fetchData, url, options.reqOptions))
: (await fetchData(url, options.reqOptions));
+ const filename = options.filename ||
+ (res.name ? res.name[0] : (pUrl.pathname.split('/').pop() || 'file'));
+
if (!mimetype)
mimetype = res.mime;
- return new MessageMedia(mimetype, res.data, null);
+ return new MessageMedia(mimetype, res.data, filename);
}
}
-module.exports = MessageMedia;
+module.exports = MessageMedia;
+
@@ -138,7 +142,7 @@ module.exports = MessageMedia;
diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html
index 3a72514..75524f3 100644
--- a/docs/structures_Order.js.html
+++ b/docs/structures_Order.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/Order.js
+ whatsapp-web.js 1.15.4 » 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 c4a7616..589f606 100644
--- a/docs/structures_Payment.js.html
+++ b/docs/structures_Payment.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/Payment.js
+ whatsapp-web.js 1.15.4 » Source: structures/Payment.js
@@ -15,7 +15,7 @@
@@ -71,7 +71,6 @@ class Payment extends Base {
/**
* The paymentStatus
- * @type {number}
*
* Possible Status
* 0:UNKNOWN_STATUS
@@ -86,6 +85,8 @@ class Payment extends Base {
* 9:CANCELLED
* 10:WAITING_FOR_PAYER
* 11:WAITING
+ *
+ * @type {number}
*/
this.paymentStatus = data.paymentStatus;
@@ -117,7 +118,7 @@ module.exports = Payment;
diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html
index 8a79dce..dea4e78 100644
--- a/docs/structures_PrivateChat.js.html
+++ b/docs/structures_PrivateChat.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/PrivateChat.js
+ whatsapp-web.js 1.15.4 » 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 80b0cb1..82e09c8 100644
--- a/docs/structures_PrivateContact.js.html
+++ b/docs/structures_PrivateContact.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/PrivateContact.js
+ whatsapp-web.js 1.15.4 » 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 72238be..469726f 100644
--- a/docs/structures_Product.js.html
+++ b/docs/structures_Product.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/Product.js
+ whatsapp-web.js 1.15.4 » 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 03c93ff..2f0ab6b 100644
--- a/docs/structures_ProductMetadata.js.html
+++ b/docs/structures_ProductMetadata.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: structures/ProductMetadata.js
+ whatsapp-web.js 1.15.4 » Source: structures/ProductMetadata.js
@@ -15,7 +15,7 @@
@@ -63,7 +63,7 @@ module.exports = ProductMetadata;
diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html
index c9a1d70..f6dd416 100644
--- a/docs/util_Constants.js.html
+++ b/docs/util_Constants.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: util/Constants.js
+ whatsapp-web.js 1.15.4 » Source: util/Constants.js
@@ -15,7 +15,7 @@
@@ -183,7 +183,7 @@ exports.MessageAck = {
diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html
index 9ede656..fbbe312 100644
--- a/docs/util_InterfaceController.js.html
+++ b/docs/util_InterfaceController.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: util/InterfaceController.js
+ whatsapp-web.js 1.15.4 » Source: util/InterfaceController.js
@@ -15,7 +15,7 @@
@@ -160,7 +160,7 @@ module.exports = InterfaceController;
diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html
index 5ed82b3..dae5c54 100644
--- a/docs/util_Util.js.html
+++ b/docs/util_Util.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.3 » Source: util/Util.js
+ whatsapp-web.js 1.15.4 » Source: util/Util.js
@@ -15,7 +15,7 @@
@@ -242,7 +242,7 @@ module.exports = Util;
diff --git a/package.json b/package.json
index 42439ab..117a118 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "whatsapp-web.js",
- "version": "1.15.3",
+ "version": "1.15.4",
"description": "Library for interacting with the WhatsApp Web API ",
"main": "./index.js",
"typings": "./index.d.ts",
|