rework sub cost

This commit is contained in:
karl.hudgell 2020-06-28 20:32:58 +01:00
parent 338eea840c
commit 408612be04

View File

@ -3,25 +3,21 @@ const subs = JSON.parse(fs.readFileSync('./data/group/subs.json', 'utf8'))
module.exports = {
prices: (bot, msg, logger) => {
let string = ""
const subPrice = "- subscription prices";
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}
${subs[1].SUB} --------------------£${subs[1].COST}
${subs[2].SUB} -----£${subs[2].COST}
${subs[3].SUB} ---------£${subs[3].COST}
${subs[4].SUB} -------------------£${subs[4].COST}
${subs[5].SUB} ------------------£${subs[5].COST}
${subs[6].SUB} -----------£${subs[6].COST}
${subs[7].SUB} --------------£${subs[7].COST}
${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.")
})
subs.forEach(element => {
if (element.COST != "X") {
let catString = element.SUB + " - £" + element.COST + "."
string += '\n' + catString;
}
});
bot.sendMessage(msg.chat.id, string, { parse_mode: "HTML" }).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.")
})
})
}
}
}