keep going

This commit is contained in:
karl.hudgell 2020-06-25 20:51:12 +01:00
parent 3b23421140
commit b472bed57f
3 changed files with 13 additions and 29 deletions

5
app.js
View File

@ -16,7 +16,7 @@ const bot_welcome = require('./data/bot/welcomeMesage')
const bot_questions = require('./data/bot/questions')
const bot_football = require('./data/bot/requests/football')
const bot_joke = require('./data/bot/requests/joke')
const bot_faq_subscriptions = require('./data/bot/faq/subscriptions')
const bot_faq_subscription = require('./data/bot/faq/subscriptions')
const token = process.env.BOT_TOKEN;
const name = process.env.BOT_NAME;
@ -65,8 +65,7 @@ bot.on('message', (msg) => {
// listen for "what sub should i buy?"
bot_questions.whatSubShouldIBuy(bot, msg, logger)
bot_faq_subscriptions.prices(bot, msg, logger)
bot_faq_subscription.prices(bot, msg, logger)

View File

@ -1,33 +1,18 @@
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 = "<pre>" + test + "</pre>"
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" })
bot.sendMessage(msg.chat.id, `
PREMIUM PLUS ----£30\n
VIP-----------------------£25\n
OLD PREMIUM -----£17\n
BLUEMOON ---------£15\n
KDB --------------------£14\n
GOLD ------------------£13\n
TECHNOID -----------£13\n
BRONZE --------------£10\n
SOL ---------------------£10`)
.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.")
@ -35,4 +20,4 @@ module.exports = {
})
}
}
}
}

BIN
image.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB