working what app should i use

This commit is contained in:
karl.hudgell 2020-06-28 22:31:20 +01:00
parent fd557e919d
commit f6be2fe889
2 changed files with 63 additions and 52 deletions

59
app.js
View File

@ -18,6 +18,8 @@ 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;
@ -69,6 +71,10 @@ 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.appSwitch(bot, msg, logger)
// FAQ susbcription prices
bot_faq_subscription.pricesImageList(bot, msg, logger)
@ -289,57 +295,6 @@ 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"
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 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")
}
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");
@ -380,7 +335,7 @@ bot.onText(/^- Applications$/, (msg) => {
return bot.sendMessage(msg.chat.id, "All of the room subs play on the green smarters player", {
"reply_markup": {
"keyboard": [
// ["- What app should I use?"],
["- What app should I use?"],
["- VPN (SurfShark)"],
["- FileLinked"],
["- Home"]

View File

@ -0,0 +1,56 @@
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
}
})
}
},
appSwitch: (bot, msg, logger) => {
let string = ""
if (subArray.some(v => msg.text.toString().includes(v))) {
var checkSub = msg.text.substring(2)
if (checkSub != "Home") {
subs.forEach(element => {
if (element.SUB === checkSub) {
element.APPS.forEach(element => {
let catString = element
string += '\n' + catString;
})
}
}
);
bot.sendMessage(msg.chat.id, "You can use -" + string + "\n\nAll can be downloaded from our FileLinked")
}}
// }
// 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;
// })
// }
// }
// );
// bot.sendMessage(msg.chat.id, "You can use -" + string + "\n\nAll can be downloaded from our FileLinked")
// }
}
}