const fs = require('fs');

module.exports = {
    whatSubShouldIBuy: (bot, msg, logger) => {
        const whatSubShouldIBuy = "what sub should i buy"
        const subs = JSON.parse(fs.readFileSync('./data/group/subs.json', 'utf8'))

        if (msg.text && msg.text.toString().toLowerCase().includes(whatSubShouldIBuy)) {
            logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Asked what sub to buy");
            const randomSub = subs[Math.floor(Math.random() * subs.length)];
            bot.sendMessage(msg.chat.id, randomSub.SUB + "!");
        }
    }
}