BBLBTV_Suzie/data/bot/functions/faq/subscriptions.js

24 lines
1.0 KiB
JavaScript
Raw Normal View History

2020-06-25 21:05:19 +01:00
const fs = require('fs')
const subs = JSON.parse(fs.readFileSync('./data/group/subs.json', 'utf8'))
2020-06-25 19:45:38 +01:00
module.exports = {
prices: (bot, msg, logger) => {
2020-06-28 20:32:58 +01:00
let string = ""
2020-06-25 19:45:38 +01:00
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");
2020-06-28 20:32:58 +01:00
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.")
2020-06-25 19:45:38 +01:00
})
2020-06-28 20:32:58 +01:00
})
2020-06-25 19:45:38 +01:00
}
}
2020-06-25 20:51:12 +01:00
}