whatsapp-api-js
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -81,3 +81,3 @@ const { Contacts } = require('./types/contacts'); | ||
* @param {String} message The default message in the QR code | ||
* @param {String} format The image format of the QR code (png or svn) | ||
* @param {String} format The image format of the QR code (png or svg) | ||
* @returns {Promise} The fetch promise | ||
@@ -84,0 +84,0 @@ */ |
{ | ||
"name": "whatsapp-api-js", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "A Whatsapp Official API helper for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -18,3 +18,3 @@ /** | ||
constructor(...contact) { | ||
if (!contact?.length) throw new Error("Contacts must have at least one contact"); | ||
if (!contact.length) throw new Error("Contacts must have at least one contact"); | ||
@@ -21,0 +21,0 @@ this.contacts = []; |
@@ -137,3 +137,3 @@ const Text = require("./text"); | ||
if (button.length > 20) throw new Error("Button content must be 20 characters or less"); | ||
if (!sections?.length || sections.length > 10) throw new Error("Action must have between 1 and 10 sections"); | ||
if (!sections.length || sections.length > 10) throw new Error("Action must have between 1 and 10 sections"); | ||
if (sections.length > 1) sections.forEach(s => { if (!s.title) throw new Error("Sections must have a title if more than 1 section is provided") }); | ||
@@ -164,3 +164,3 @@ | ||
if (title && title.length > 24) throw new Error("Section title must be 24 characters or less"); | ||
if (!rows?.length || rows.length > 10) throw new Error("Section must have between 1 and 10 rows"); | ||
if (!rows.length || rows.length > 10) throw new Error("Section must have between 1 and 10 rows"); | ||
@@ -221,3 +221,3 @@ if (title) this.title = title; | ||
constructor(...button) { | ||
if (!button?.length || button.length > 3) throw new Error("Reply buttons must have between 1 and 3 buttons"); | ||
if (!button.length || button.length > 3) throw new Error("Reply buttons must have between 1 and 3 buttons"); | ||
@@ -224,0 +224,0 @@ // Find if there are duplicates in button.id |
@@ -127,3 +127,3 @@ const Text = require("./text"); | ||
if (!["url", "quick_reply"].includes(sub_type)) throw new Error("ButtonComponent sub_type must be either 'url' or 'quick_reply'"); | ||
if (!parameters?.length) throw new Error("ButtonComponent must have at least 1 parameter"); | ||
if (!parameters.length) throw new Error("ButtonComponent must have at least 1 parameter"); | ||
if (parameters.length > 3) throw new Error("ButtonComponent can only have up to 3 parameters"); | ||
@@ -130,0 +130,0 @@ |
59645