From 900c598c15c64e61c5a81fae3a33ea2893a10df8 Mon Sep 17 00:00:00 2001 From: "karl.hudgell" Date: Sun, 28 Jun 2020 21:43:40 +0100 Subject: [PATCH] working app switch --- app.js | 30 ++----------------- data/bot/faq/whatAppToUse.js | 7 +---- data/group/subs.json | 57 +++++++++++++++++++++++++++++------- 3 files changed, 50 insertions(+), 44 deletions(-) diff --git a/app.js b/app.js index 594fe18..e893075 100644 --- a/app.js +++ b/app.js @@ -70,9 +70,9 @@ bot.on('message', (msg) => { bot_questions.subStatus(bot, msg, logger) // listen for "set sub X to X" bot_subStatus.setSubStatus(bot, msg, logger) - + bot_faq_whatAppToUse.main(bot, msg, logger) - bot_faq_whatAppToUse.gold(bot, msg, logger) + bot_faq_whatAppToUse.appSwitch(bot, msg, logger) // FAQ susbcription prices bot_faq_subscription.prices(bot, msg, logger) @@ -287,32 +287,6 @@ Do not clear data, otherwise you will have to enter your sub details into the ap } } - - - const vip = "- vip" - const premiumPlus = "- premium plus" - const oldPremium = "- old premium" - if (msg.text && msg.text.toString().toLowerCase() === vip || msg.text && msg.text.toString().toLowerCase() === premiumPlus || msg.text && msg.text.toString().toLowerCase() === oldPremium) { - bot.sendMessage(msg.chat.id, "You can use -\nXCIPTV Blue\nSky Q Yellow\nSMARTERS Green\n\nAll can be downloaded from our FileLinked") - } - - - const bronze = "- bronze" - if (msg.text && msg.text.toString().toLowerCase() === bronze) { - bot.sendMessage(msg.chat.id, "You can use -\nXCIPTV Red\nSMARTERS Green\n\nAll can be downloaded from our FileLinked") - } - - const newPremium = "- new premium" - const kdb = "- kdb" - const technoid = "- technoid" - const bluemoon = "- bluemoon" - const sol = "- sol" - const gambler = "- gambler" - if ((msg.text && msg.text.toString().toLowerCase() === newPremium) || (msg.text && msg.text.toString().toLowerCase() === kdb) || (msg.text && msg.text.toString().toLowerCase() === gambler) || (msg.text && msg.text.toString().toLowerCase() === technoid) || (msg.text && msg.text.toString().toLowerCase() === bluemoon) || (msg.text && msg.text.toString().toLowerCase() === sol)) { - bot.sendMessage(msg.chat.id, "You can use -\nSMARTERS Green\n\nAll can be downloaded from our FileLinked") - } - - }), bot.onText(/^(\/start|\/help|- Home)$/, (msg) => { logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Started a Chat with me"); diff --git a/data/bot/faq/whatAppToUse.js b/data/bot/faq/whatAppToUse.js index 2fa9132..beeb52b 100644 --- a/data/bot/faq/whatAppToUse.js +++ b/data/bot/faq/whatAppToUse.js @@ -22,12 +22,8 @@ module.exports = { }) } }, - gold: (bot, msg, logger) => { - //if (msg.text && msg.text.toString().toLowerCase() === subArray.indexOf(msg.text && msg.text.toString().toLowerCase())) { - - const gold = "- gold" + appSwitch: (bot, msg, logger) => { let string = "" - // if (msg.text && msg.text.toString().toLowerCase() === gold) { if (subArray.indexOf(msg.text && msg.text.toString().toLowerCase())) { var checkSub = msg.text.substring(2) subs.forEach(element => { @@ -36,7 +32,6 @@ module.exports = { let catString = element string += '\n' + catString; }) - console.log(string) } } ); diff --git a/data/group/subs.json b/data/group/subs.json index 96488e0..aa9e98a 100644 --- a/data/group/subs.json +++ b/data/group/subs.json @@ -1,23 +1,44 @@ [{ "SUB": "Premium Plus", "COST": 30, - "STATUS": 1 + "STATUS": 1, + "APPS": [ + "XCIPTV Blue", + "Sky Q Yellow", + "SMARTERS Green" + ] }, { "SUB": "VIP", "COST": 25, - "STATUS": 1 + "STATUS": 1, + "APPS": [ + "XCIPTV Blue", + "Sky Q Yellow", + "SMARTERS Green" + ] }, { "SUB": "Old Premium", "COST": 17, - "STATUS": 1 + "STATUS": 1, + "APPS": [ + "XCIPTV Blue", + "Sky Q Yellow", + "SMARTERS Green" + ] }, { "SUB": "Bluemoon", "COST": 15, - "STATUS": 1 + "STATUS": 1, + "APPS": [ + "SMARTERS Green" + ] }, { "SUB": "KDB", "COST": 14, - "STATUS": 1 + "STATUS": 1, + "APPS": [ + "SMARTERS Green" + ] }, { "SUB": "Gold", "COST": 13, @@ -30,23 +51,39 @@ }, { "SUB": "Technoid", "COST": 13, - "STATUS": 1 + "STATUS": 1, + "APPS": [ + "SMARTERS Green" + ] }, { "SUB": "Bronze", "COST": 10, - "STATUS": 1 + "STATUS": 1, + "APPS": [ + "XCIPTV Red", + "SMARTERS Green" + ] }, { "SUB": "SOL", "COST": 10, - "STATUS": 1 + "STATUS": 1, + "APPS": [ + "SMARTERS Green" + ] }, { "SUB": "New Premium (tvob)", "COST": "X", - "STATUS": 1 + "STATUS": 1, + "APPS": [ + "SMARTERS Green" + ] }, { "SUB": "Gambler", "COST": "X", - "STATUS": 1 + "STATUS": 1, + "APPS": [ + "SMARTERS Green" + ] }, { "SUB": "All of em", "COST": "X",