From 9e358e1c24180f2c899344a566c3d5f15c82c189 Mon Sep 17 00:00:00 2001 From: Preeti Rawat Date: Sun, 26 Jul 2020 17:29:59 +0400 Subject: [PATCH] condition added condition-1 --- whatsapp-web.js/src/businessLogic/logic.js | 137 ++++++++++++----- .../src/userInteraction/messages.js | 144 +++++++++++++----- 2 files changed, 201 insertions(+), 80 deletions(-) diff --git a/whatsapp-web.js/src/businessLogic/logic.js b/whatsapp-web.js/src/businessLogic/logic.js index 0bdd958..5e665e5 100644 --- a/whatsapp-web.js/src/businessLogic/logic.js +++ b/whatsapp-web.js/src/businessLogic/logic.js @@ -51,61 +51,122 @@ module.exports.comp = (input) => let create_company = [ `welcome to building your own website!`, `We would like you add the following details:`, - `wg website firstname `, - `wg website lastname `, - `wg website companyname `, - `wg website logourl `, - `Banner URL`, - `Description`, - `Email` + `wg website firstname **`, + `wg website lastname **`, + `wg website companyname **`, + `wg website logo **`, + `wg website banner **`, + `wg website description **`, + `wg website email **`, + `For adding information use *wg website *`, + ]; - + Website.companyName = input; + if(Website.companyName == null) + { + create_company = [`you have not input your company name. Please try again.`]; + } return create_company; } -module.exports.fn = (input) => -{ - let fName = [ - `first name has been added` - ]; - - return fName; +module.exports.fn = (fdata) => +{ + + + + let info = [`your first name is:` + fdata + ]; + + + + if(Website.companyName == null) + { + info = [`you have not input your company name. Please try again.`] + } + else + { + Website.firstname = fdata; + console.log('this is data ' +Website.firstname); + + } + + return info; } -module.exports.ln = (input) => + +module.exports.ln = (ldata) => { + - - let lName = [ - `last name has been added` + let info = + [`your last name is: ` + ldata ]; - - return lName; + if(Website.companyName == null) + { + info = [`company name has not been used`]; + } + else if(Website.firstname == null) + { + info = [`you have not insert first name.`]; + } + else + { + Website.lastname = ldata; + console.log('lname added'); + } + + return info; } -module.exports.cn = (input) => +module.exports.cn = (cdata) => { + + let info = [`your company name is: ` + cdata + ]; + + if(Website.firstname == null) + { + info = [`you have not insert first name.`]; + } + else if(Website.lastname == null) + { + info = [`you have not insert last name.`]; + } + else(Website.companyName != cdata) + { + Website.companyName = cdata; + info = [`your company name has been changed to` +cdata]; + console.log('this is data ' +Website.companyName); + } - let cName = [ - `company name has been added` - ]; - - return cName; - + return info; } -module.exports.logo = (input) => -{ +module.exports.logourl = (ldata) => +{ - - let lo = [ - `logo has been added` - ]; - - return lo; - -} + let info = [`the data that you added are as follow:`, + `company Name: ` + ldata + ]; + if(Website.companyName == null) + { + info = [`you have not input your company name. Please try again.`] + } + else if(Website.firstname == null) + { + info = [`you have not insert first name.`]; + } + else if(Website.lastname == null) + { + info = [`you have not insert last name.`]; + } + else + { + Website.logoUrl = ldata + } + return info; +} \ No newline at end of file diff --git a/whatsapp-web.js/src/userInteraction/messages.js b/whatsapp-web.js/src/userInteraction/messages.js index 3cb0ccd..abd9914 100644 --- a/whatsapp-web.js/src/userInteraction/messages.js +++ b/whatsapp-web.js/src/userInteraction/messages.js @@ -60,90 +60,150 @@ const commands = [ } }), - - - new Command({ + new Command({ //User command - command: 'wg website firstname ', + + command: 'wg website firstname ', //function to be executed callback : (input) => - { + { logic.onWG(); + + //cdata = input['company']; + fdata = input['firstName']; + + + info = logic.fn(fdata); + return info; - inputting = input['f_name']; - fname = logic.fn(); - return fname; + } + }), + + // new Command({ + // //User command + // command: 'wg website firstname ', + + // //function to be executed + // callback : (input) => + // { + + // logic.onWG(); + + // inputting = input['f_name']; + // fname = logic.fn(input); + // return fname; + + // } + // }), + new Command({ + //User command + + command: 'wg website lastname ', + + //function to be executed + callback : (input) => + { + + logic.onWG(); + + //cdata = input['company']; + ldata = input['lastname']; + + + info = logic.ln(ldata); + return info; } }), new Command({ //User command - command: 'wg website lastname ', - + command: 'wg website companyname ', + //function to be executed callback : (input) => - { + { logic.onWG(); - - - - inputting = input['l_name']; - - lname = logic.ln(); - return lname; - + + //cdata = input['company']; + cdata = input['cname']; + + + info = logic.cn(cdata); + return info; } }), new Command({ //User command - command: 'wg website companyname ', - + command: 'wg website logo ', + //function to be executed callback : (input) => - { + { logic.onWG(); - - - - inputting = input['c_name']; - - cname = logic.cn(); - return cname; - + + //cdata = input['company']; + logoU = input['url']; + + + info = logic.logourl(logoU); + return info; } }), - new Command({ - //User command - command: 'wg website logourl ', + // new Command({ + // //User command + // command: 'wg website logo ', - //function to be executed - callback : (input) => - { + // //function to be executed + // callback : (input) => + // { - logic.onWG(); + // logic.onWG(); - inputting = input['logo_name']; + // inputting = input['logo_name']; - logoURL = logic.logo(); - return logoURL; + // logoURL = logic.logo(input); + // return logoURL; - } - }), + // } + // }), + + // new Command({ + // //User command + + // command: 'wg website ', + + // //function to be executed + // callback : (input) => + // { + + // logic.onWG(); + + // //cdata = input['company']; + // fdata = input['firstName']; + // ldata = input['lastname']; + // cdata = input['Cname']; + + + // info = logic.comdetails(fdata, ldata, cdata); + // return info; + + // } + // }), ];