working array with gold
This commit is contained in:
parent
63a1d40cf0
commit
23eb991913
33
app.js
33
app.js
@ -18,6 +18,7 @@ const bot_football = require('./data/bot/requests/football')
|
||||
const bot_joke = require('./data/bot/requests/joke')
|
||||
const bot_faq_subscription = require('./data/bot/faq/subscriptions')
|
||||
const bot_subStatus = require('./data/bot/requests/updateSubStatus')
|
||||
const bot_faq_whatAppToUse = require('./data/bot/faq/whatAppToUse')
|
||||
|
||||
const token = process.env.BOT_TOKEN;
|
||||
const name = process.env.BOT_NAME;
|
||||
@ -70,6 +71,9 @@ bot.on('message', (msg) => {
|
||||
// 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)
|
||||
|
||||
// FAQ susbcription prices
|
||||
bot_faq_subscription.prices(bot, msg, logger)
|
||||
|
||||
@ -283,28 +287,7 @@ Do not clear data, otherwise you will have to enter your sub details into the ap
|
||||
}
|
||||
}
|
||||
|
||||
const whatAppShouldIUse = "- what app should i use?";
|
||||
if (msg.text && msg.text.toString().toLowerCase() === whatAppShouldIUse) {
|
||||
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Asked what app to use");
|
||||
bot.sendMessage(msg.chat.id, "What Subscription do you have?", {
|
||||
"reply_markup": {
|
||||
"keyboard": [
|
||||
["- VIP"],
|
||||
["- Premium Plus"],
|
||||
["- Old Premium"],
|
||||
["- Gold"],
|
||||
["- Bronze"],
|
||||
["- New Premium"],
|
||||
["- KDB"],
|
||||
["- Technoid"],
|
||||
["- Bluemoon"],
|
||||
["- SOL"],
|
||||
["- Gambler"],
|
||||
["- Home"]
|
||||
]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const vip = "- vip"
|
||||
const premiumPlus = "- premium plus"
|
||||
@ -313,11 +296,7 @@ Do not clear data, otherwise you will have to enter your sub details into the ap
|
||||
bot.sendMessage(msg.chat.id, "You can use -\nXCIPTV Blue\nSky Q Yellow\nSMARTERS Green\n\nAll can be downloaded from our FileLinked")
|
||||
}
|
||||
|
||||
const gold = "- gold"
|
||||
if (msg.text && msg.text.toString().toLowerCase() === gold) {
|
||||
bot.sendMessage(msg.chat.id, "You can use -\nXCIPTV Red\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")
|
||||
|
46
data/bot/faq/whatAppToUse.js
Normal file
46
data/bot/faq/whatAppToUse.js
Normal file
@ -0,0 +1,46 @@
|
||||
const fs = require('fs')
|
||||
const subs = JSON.parse(fs.readFileSync('./data/group/subs.json', 'utf8'))
|
||||
|
||||
var subArray = []
|
||||
subs.forEach(element => {
|
||||
if (element.COST != "X") {
|
||||
let arr = ["- " + element.SUB]
|
||||
subArray.push(arr)
|
||||
}
|
||||
});
|
||||
subArray.push(["- Home"])
|
||||
|
||||
module.exports = {
|
||||
main: (bot, msg, logger) => {
|
||||
const whatAppShouldIUse = "- what app should i use?";
|
||||
if (msg.text && msg.text.toString().toLowerCase() === whatAppShouldIUse) {
|
||||
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Asked what app to use");
|
||||
bot.sendMessage(msg.chat.id, "What Subscription do you have?", {
|
||||
"reply_markup": {
|
||||
"keyboard": subArray
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
gold: (bot, msg, logger) => {
|
||||
//if (msg.text && msg.text.toString().toLowerCase() === subArray.indexOf(msg.text && msg.text.toString().toLowerCase())) {
|
||||
|
||||
const gold = "- gold"
|
||||
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 => {
|
||||
if (element.SUB === checkSub) {
|
||||
element.APPS.forEach(element => {
|
||||
let catString = element
|
||||
string += '\n' + catString;
|
||||
})
|
||||
console.log(string)
|
||||
}
|
||||
}
|
||||
);
|
||||
bot.sendMessage(msg.chat.id, "You can use -" + string + "\n\nAll can be downloaded from our FileLinked")
|
||||
}
|
||||
}
|
||||
}
|
@ -1 +1,54 @@
|
||||
[{"SUB":"Premium Plus","COST":30,"STATUS":1},{"SUB":"VIP","COST":25,"STATUS":1},{"SUB":"Old Premium","COST":17,"STATUS":1},{"SUB":"Bluemoon","COST":15,"STATUS":1},{"SUB":"KDB","COST":14,"STATUS":1},{"SUB":"Gold","COST":13,"STATUS":1},{"SUB":"Technoid","COST":13,"STATUS":1},{"SUB":"Bronze","COST":10,"STATUS":1},{"SUB":"SOL","COST":10,"STATUS":1},{"SUB":"New Premium (tvob)","COST":"X","STATUS":1},{"SUB":"Gambler","COST":"X","STATUS":1},{"SUB":"All of em","COST":"X","STATUS":"X"}]
|
||||
[{
|
||||
"SUB": "Premium Plus",
|
||||
"COST": 30,
|
||||
"STATUS": 1
|
||||
}, {
|
||||
"SUB": "VIP",
|
||||
"COST": 25,
|
||||
"STATUS": 1
|
||||
}, {
|
||||
"SUB": "Old Premium",
|
||||
"COST": 17,
|
||||
"STATUS": 1
|
||||
}, {
|
||||
"SUB": "Bluemoon",
|
||||
"COST": 15,
|
||||
"STATUS": 1
|
||||
}, {
|
||||
"SUB": "KDB",
|
||||
"COST": 14,
|
||||
"STATUS": 1
|
||||
}, {
|
||||
"SUB": "Gold",
|
||||
"COST": 13,
|
||||
"STATUS": 1,
|
||||
"APPS": [
|
||||
"XCIPTV Red",
|
||||
"Sky Q Yellow",
|
||||
"SMARTERS Green"
|
||||
]
|
||||
}, {
|
||||
"SUB": "Technoid",
|
||||
"COST": 13,
|
||||
"STATUS": 1
|
||||
}, {
|
||||
"SUB": "Bronze",
|
||||
"COST": 10,
|
||||
"STATUS": 1
|
||||
}, {
|
||||
"SUB": "SOL",
|
||||
"COST": 10,
|
||||
"STATUS": 1
|
||||
}, {
|
||||
"SUB": "New Premium (tvob)",
|
||||
"COST": "X",
|
||||
"STATUS": 1
|
||||
}, {
|
||||
"SUB": "Gambler",
|
||||
"COST": "X",
|
||||
"STATUS": 1
|
||||
}, {
|
||||
"SUB": "All of em",
|
||||
"COST": "X",
|
||||
"STATUS": "X"
|
||||
}]
|
Loading…
x
Reference in New Issue
Block a user