subs working

This commit is contained in:
karl.hudgell 2020-06-26 22:25:18 +01:00
parent c88fa06f75
commit a3023e1c0b
3 changed files with 54 additions and 21 deletions

3
app.js
View File

@ -71,7 +71,7 @@ bot.on('message', (msg) => {
bot_subStatus.setSubStatus(bot, msg, logger)
// FAQ susbcription prices
bot_faq_subscription.prices(bot, msg, logger)
bot_faq_subscription.pricesImageList(bot, msg, logger)
const howToSignUp = "- how to get a subscription?";
if (msg.text && msg.text.toString().toLowerCase() === howToSignUp) {
@ -395,6 +395,7 @@ bot.onText(/^- Subscriptions$/, (msg) => {
bot.sendMessage(msg.chat.id, "Subscription FAQ", {
"reply_markup": {
"keyboard": [
["- Subscription Options"],
["- How to get a subscription?"],
["- Subscription URLs", "- Can I stream on multiple devices?"],
["- Updates Group"],

View File

@ -2,27 +2,17 @@ const fs = require('fs')
const subs = JSON.parse(fs.readFileSync('./data/group/subs.json', 'utf8'))
module.exports = {
prices: (bot, msg, logger) => {
const subPrice = "- subscription prices";
pricesImageList: (bot, msg, logger) => {
const subPrice = "- subscription options";
if (msg.text && msg.text.toString().toLowerCase() === subPrice) {
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Got subscription Prices");
bot.sendMessage(msg.chat.id,
`-
${subs[0].SUB} ----£${subs[0].COST}\n
${subs[1].SUB} -----------------------£${subs[1].COST}\n
${subs[2].SUB} -----£${subs[2].COST}\n
${subs[3].SUB} ---------£${subs[3].COST}\n
${subs[4].SUB} --------------------£${subs[4].COST}\n
${subs[5].SUB} ------------------£${subs[5].COST}\n
${subs[6].SUB} -----------£${subs[6].COST}\n
${subs[7].SUB} --------------£${subs[7].COST}\n
${subs[8].SUB} ---------------------£${subs[8].COST}
`)
.then(() => {
return bot.sendMessage(msg.chat.id, "All of these prices are for 12 Month subscription subs").then(() => {
return bot.sendMessage(msg.chat.id, "Keep an eye out though because we offer special deals on different subs from time to time.")
})
})
for (var i = 0, len = subs.length; i < len; i++) {
if (subs[i].IMAGE != "X") {
bot.sendPhoto(msg.chat.id, subs[i].IMAGE)
}
}
bot.sendMessage(msg.chat.id, "All of these prices are for 12 Month subscription subs")
}
}
}

View File

@ -1 +1,43 @@
[{"SUB":"Insanity","COST":0,"STATUS":1},{"SUB":"VIP","COST":25,"STATUS":1},{"SUB":"Premium Plus","COST":17,"STATUS":1},{"SUB":"Premium","COST":15,"STATUS":1},{"SUB":"Gold","COST":13,"STATUS":1},{"SUB":"Bronze","COST":10,"STATUS":1},{"SUB":"All of em","COST":"X","STATUS":"X"}]
[{
"SUB": "Insanity",
"COST": "X",
"STATUS": 1,
"IMAGE": "./data/group/Insanity.jpg"
},
{
"SUB": "VIP",
"COST": "X",
"STATUS": 1,
"IMAGE": "./data/group/VIP.jpg"
},
{
"SUB": "Premium Plus",
"COST": "X",
"STATUS": 1,
"IMAGE": "./data/group/Premium_Plus.jpg"
},
{
"SUB": "Premium",
"COST": "X",
"STATUS": 1,
"IMAGE": "./data/group/Premium.jpg"
},
{
"SUB": "Gold",
"COST": "X",
"STATUS": 1,
"IMAGE": "./data/group/Gold.jpg"
},
{
"SUB": "Bronze",
"COST": "X",
"STATUS": 1,
"IMAGE": "./data/group/Bronze.jpg"
},
{
"SUB": "All of em",
"COST": "X",
"STATUS": "X",
"IMAGE": "X"
}
]