working app switch

This commit is contained in:
karl.hudgell 2020-06-28 21:43:40 +01:00
parent 23eb991913
commit 900c598c15
3 changed files with 50 additions and 44 deletions

30
app.js
View File

@ -70,9 +70,9 @@ bot.on('message', (msg) => {
bot_questions.subStatus(bot, msg, logger) bot_questions.subStatus(bot, msg, logger)
// listen for "set sub X to X" // listen for "set sub X to X"
bot_subStatus.setSubStatus(bot, msg, logger) bot_subStatus.setSubStatus(bot, msg, logger)
bot_faq_whatAppToUse.main(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 // FAQ susbcription prices
bot_faq_subscription.prices(bot, msg, logger) 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) => { bot.onText(/^(\/start|\/help|- Home)$/, (msg) => {
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Started a Chat with me"); logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Started a Chat with me");

View File

@ -22,12 +22,8 @@ module.exports = {
}) })
} }
}, },
gold: (bot, msg, logger) => { appSwitch: (bot, msg, logger) => {
//if (msg.text && msg.text.toString().toLowerCase() === subArray.indexOf(msg.text && msg.text.toString().toLowerCase())) {
const gold = "- gold"
let string = "" let string = ""
// if (msg.text && msg.text.toString().toLowerCase() === gold) {
if (subArray.indexOf(msg.text && msg.text.toString().toLowerCase())) { if (subArray.indexOf(msg.text && msg.text.toString().toLowerCase())) {
var checkSub = msg.text.substring(2) var checkSub = msg.text.substring(2)
subs.forEach(element => { subs.forEach(element => {
@ -36,7 +32,6 @@ module.exports = {
let catString = element let catString = element
string += '\n' + catString; string += '\n' + catString;
}) })
console.log(string)
} }
} }
); );

View File

@ -1,23 +1,44 @@
[{ [{
"SUB": "Premium Plus", "SUB": "Premium Plus",
"COST": 30, "COST": 30,
"STATUS": 1 "STATUS": 1,
"APPS": [
"XCIPTV Blue",
"Sky Q Yellow",
"SMARTERS Green"
]
}, { }, {
"SUB": "VIP", "SUB": "VIP",
"COST": 25, "COST": 25,
"STATUS": 1 "STATUS": 1,
"APPS": [
"XCIPTV Blue",
"Sky Q Yellow",
"SMARTERS Green"
]
}, { }, {
"SUB": "Old Premium", "SUB": "Old Premium",
"COST": 17, "COST": 17,
"STATUS": 1 "STATUS": 1,
"APPS": [
"XCIPTV Blue",
"Sky Q Yellow",
"SMARTERS Green"
]
}, { }, {
"SUB": "Bluemoon", "SUB": "Bluemoon",
"COST": 15, "COST": 15,
"STATUS": 1 "STATUS": 1,
"APPS": [
"SMARTERS Green"
]
}, { }, {
"SUB": "KDB", "SUB": "KDB",
"COST": 14, "COST": 14,
"STATUS": 1 "STATUS": 1,
"APPS": [
"SMARTERS Green"
]
}, { }, {
"SUB": "Gold", "SUB": "Gold",
"COST": 13, "COST": 13,
@ -30,23 +51,39 @@
}, { }, {
"SUB": "Technoid", "SUB": "Technoid",
"COST": 13, "COST": 13,
"STATUS": 1 "STATUS": 1,
"APPS": [
"SMARTERS Green"
]
}, { }, {
"SUB": "Bronze", "SUB": "Bronze",
"COST": 10, "COST": 10,
"STATUS": 1 "STATUS": 1,
"APPS": [
"XCIPTV Red",
"SMARTERS Green"
]
}, { }, {
"SUB": "SOL", "SUB": "SOL",
"COST": 10, "COST": 10,
"STATUS": 1 "STATUS": 1,
"APPS": [
"SMARTERS Green"
]
}, { }, {
"SUB": "New Premium (tvob)", "SUB": "New Premium (tvob)",
"COST": "X", "COST": "X",
"STATUS": 1 "STATUS": 1,
"APPS": [
"SMARTERS Green"
]
}, { }, {
"SUB": "Gambler", "SUB": "Gambler",
"COST": "X", "COST": "X",
"STATUS": 1 "STATUS": 1,
"APPS": [
"SMARTERS Green"
]
}, { }, {
"SUB": "All of em", "SUB": "All of em",
"COST": "X", "COST": "X",