get sub status
This commit is contained in:
parent
51af65dd31
commit
0d88c20960
14
app.js
14
app.js
@ -64,20 +64,12 @@ bot.on('message', (msg) => {
|
||||
bot_chat.fOff(bot, msg, logger, name)
|
||||
// listen for "what sub should i buy?"
|
||||
bot_questions.whatSubShouldIBuy(bot, msg, logger)
|
||||
bot_questions.subStatus(bot, msg, logger)
|
||||
|
||||
|
||||
// FAQ susbcription prices
|
||||
bot_faq_subscription.prices(bot, msg, logger)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const howToSignUp = "- how to get a subscription?";
|
||||
if (msg.text && msg.text.toString().toLowerCase() === howToSignUp) {
|
||||
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Asked how to get a subscription");
|
||||
|
@ -1,14 +1,35 @@
|
||||
const fs = require('fs');
|
||||
const fs = require('fs')
|
||||
const subs = JSON.parse(fs.readFileSync('./data/group/subs.json', 'utf8'))
|
||||
|
||||
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 + "!");
|
||||
}
|
||||
},
|
||||
subStatus: (bot, msg, logger, name) => {
|
||||
let string = ""
|
||||
const subStatus = "sub status";
|
||||
if (msg.text && msg.text.toString().toLowerCase().includes(subStatus)) {
|
||||
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Asked how to get a subscription");
|
||||
subs.forEach(element => {
|
||||
if (element.COST != "X") {
|
||||
if (element.STATUS === 1) {
|
||||
element.STATUS = "Up"
|
||||
} else {
|
||||
element.STATUS = "Down"
|
||||
}
|
||||
let catString = element.SUB + " Is " + element.STATUS
|
||||
// console.log(catString)
|
||||
string += '\n' + catString;
|
||||
}
|
||||
});
|
||||
// console.log(string)
|
||||
bot.sendMessage(msg.chat.id, string)
|
||||
}
|
||||
}
|
||||
}
|
17
data/bot/requests/subStatus.js
Normal file
17
data/bot/requests/subStatus.js
Normal file
@ -0,0 +1,17 @@
|
||||
const fs = require('fs')
|
||||
const subs = JSON.parse(fs.readFileSync('./data/group/subs.json', 'utf8'))
|
||||
|
||||
module.exports = {
|
||||
tellMe: (bot, msg, logger, name) => {
|
||||
|
||||
const subStatus = "sub status";
|
||||
if (msg.text && msg.text.toString().toLowerCase().includes(subStatus)) {
|
||||
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Asked how to get a subscription");
|
||||
|
||||
|
||||
bot.sendMessage(msg.chat.id, subs)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -42,7 +42,7 @@
|
||||
{
|
||||
"SUB": "SOL",
|
||||
"COST": 10,
|
||||
"STATUS": "X"
|
||||
"STATUS": 0
|
||||
},
|
||||
{
|
||||
"SUB": "Gambler",
|
||||
|
Loading…
x
Reference in New Issue
Block a user