MiWatch_MiWatchBot/data/bot/questions.js
2020-06-25 19:45:38 +01:00

14 lines
597 B
JavaScript

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 + "!");
}
}
}