From 6566ba30a0f89ddcc220a8b7fd5a71b2b9861639 Mon Sep 17 00:00:00 2001 From: Preeti Rawat Date: Sat, 25 Jul 2020 14:04:29 +0400 Subject: [PATCH] testing1 create companu_name --- whatsapp-web.js/package.json | 2 +- .../src/userInteraction/messages.js | 66 ++++++++++++++++++- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/whatsapp-web.js/package.json b/whatsapp-web.js/package.json index 3a32f85..b5f9c49 100644 --- a/whatsapp-web.js/package.json +++ b/whatsapp-web.js/package.json @@ -5,7 +5,7 @@ "main": "test.js", "scripts": { "test-web": "node website_test.js http://localhost:8004", - "test" : "mocha", + "test": "mocha", "start": "node index.js" }, "author": "", diff --git a/whatsapp-web.js/src/userInteraction/messages.js b/whatsapp-web.js/src/userInteraction/messages.js index e62c716..7692fdf 100644 --- a/whatsapp-web.js/src/userInteraction/messages.js +++ b/whatsapp-web.js/src/userInteraction/messages.js @@ -24,6 +24,69 @@ const commands = [ } }), + + new Command({ + //User command + command: 'wg help', + + //function to be executed + callback : (input) => { + + logic.onWG(); + //mesage to be sent to the user + let help_signal = [ + `Here are the following commands that can help you create your website`, + `if you want to create a website use *wg create * and write the name of your company`, + `if you already have a website us *wg website * to get access to the website`, + `when creating your website you will be asked to give details of your company. To add these details you will have to write *wg website * *wg website * etc`, + `If you want to check all the products that have already been created for your websit type *wg product all*`, + `If you want to create a new product type *wg product new*`, + `If you want to select a particular product for manipulating its data, give your product id as such: *wg product `, + `To get all information of the product you selected, type *wg product info*`, + `To change the product name, type *wg product name *`, + `To change the product cost, type *wg product cost * `, + `To change the product description, type *wg product desc *`, + `To change the image of the product, type *wg product image *`, + `When you are done making your website and want to see it ,type *wg website finished*`, + `If you want to delete a product, type *wg delete product* where id is the product id`, + `If you want to delete your whole website, type *wg delete website `, + `That is all! Hope you make a great website~` + ]; + + return help_signal; + } + }), + + new Command({ + //User command + + + command: 'wg create', + + //function to be executed + callback : (input) => + { + name_of_company = input.substring(9), + + logic.onWG(); + //mesage to be sent to the user + let create_company = [ + `welcome to building your own website!`, + `We would like you add the following details:`, + `First Name`, + `Last Name`, + `Company name`, + `Logo URL`, + `Banner URL`, + `Description`, + `Email`, + `For adding information use *wg website *` + ]; + + return create_company; + } + }), + ]; @@ -45,7 +108,8 @@ module.exports= onMessage = (message, client) => { if(command != null){ let input = {}; - if(command.requireInput){ + if(command.requireInput) + { input = command.getInput(); }