const fs = require('fs') const subs = JSON.parse(fs.readFileSync('./data/group/subs.json', 'utf8')) module.exports = { prices: (bot, msg, logger) => { let string = "" logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Got subscription Prices"); 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.") }) }) }, pricesImageList: (bot, msg, logger) => { logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Got subscription Prices"); 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") } }