From 408612be0447f41961a6f84273d09206f5523499 Mon Sep 17 00:00:00 2001 From: "karl.hudgell" Date: Sun, 28 Jun 2020 20:32:58 +0100 Subject: [PATCH] rework sub cost --- data/bot/faq/subscriptions.js | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/data/bot/faq/subscriptions.js b/data/bot/faq/subscriptions.js index d51f686..f650e66 100644 --- a/data/bot/faq/subscriptions.js +++ b/data/bot/faq/subscriptions.js @@ -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.") }) + }) } } }