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,21 +3,17 @@ const subs = JSON.parse(fs.readFileSync('./data/group/subs.json', 'utf8'))
module.exports = { module.exports = {
prices: (bot, msg, logger) => { prices: (bot, msg, logger) => {
let string = ""
const subPrice = "- subscription prices"; const subPrice = "- subscription prices";
if (msg.text && msg.text.toString().toLowerCase() === subPrice) { if (msg.text && msg.text.toString().toLowerCase() === subPrice) {
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Got subscription Prices"); logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Got subscription Prices");
bot.sendMessage(msg.chat.id, subs.forEach(element => {
`${subs[0].SUB} ----£${subs[0].COST} if (element.COST != "X") {
${subs[1].SUB} --------------------£${subs[1].COST} let catString = element.SUB + " - £" + element.COST + "."
${subs[2].SUB} -----£${subs[2].COST} string += '\n' + catString;
${subs[3].SUB} ---------£${subs[3].COST} }
${subs[4].SUB} -------------------£${subs[4].COST} });
${subs[5].SUB} ------------------£${subs[5].COST} bot.sendMessage(msg.chat.id, string, { parse_mode: "HTML" }).then(() => {
${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, "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.") return bot.sendMessage(msg.chat.id, "Keep an eye out though because we offer special deals on different subs from time to time.")
}) })