const fs = require('fs'); const {table} = require('table') const subs = JSON.parse(fs.readFileSync('./data/group/subs.json', 'utf8')) const t = require('obj-array-table') const nodeHtmlToImage = require('node-html-to-image') var arrayToTable = require('array-to-table') module.exports = { prices: (bot, msg, logger) => { 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"); let test = arrayToTable(subs) let t = "
" + test + "
" nodeHtmlToImage({ output: './image.png', html: t }) bot.sendMessage(msg.chat.id, `First Header | Second Header ------------- | ------------- Content Cell | Content Cell Content Cell | Content Cell`, { parse_mode: "Markdown" }) .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.") }) }) } } }