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_questions = require('./data/bot/questions')
const bot_football = require('./data/bot/requests/football') const bot_football = require('./data/bot/requests/football')
const bot_joke = require('./data/bot/requests/joke') 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 token = process.env.BOT_TOKEN;
const name = process.env.BOT_NAME; const name = process.env.BOT_NAME;
@ -65,8 +65,7 @@ bot.on('message', (msg) => {
// listen for "what sub should i buy?" // listen for "what sub should i buy?"
bot_questions.whatSubShouldIBuy(bot, msg, logger) 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 = { module.exports = {
prices: (bot, msg, logger) => { prices: (bot, msg, logger) => {
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, `
PREMIUM PLUS ----£30\n
let test = arrayToTable(subs) VIP-----------------------£25\n
OLD PREMIUM -----£17\n
let t = "<pre>" + test + "</pre>" BLUEMOON ---------£15\n
KDB --------------------£14\n
nodeHtmlToImage({ GOLD ------------------£13\n
output: './image.png', TECHNOID -----------£13\n
html: t BRONZE --------------£10\n
}) SOL ---------------------£10`)
bot.sendMessage(msg.chat.id,
`First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cell`, { parse_mode: "Markdown" })
.then(() => { .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.")

BIN
image.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB