fix update case
This commit is contained in:
parent
156c0d6218
commit
15a420bac6
17
app.js
17
app.js
@ -61,28 +61,19 @@ bot.on('message', (msg) => {
|
|||||||
|
|
||||||
for (const x of jointArray) {
|
for (const x of jointArray) {
|
||||||
if (msg.text && msg.text.toString() === x.NAME) {
|
if (msg.text && msg.text.toString() === x.NAME) {
|
||||||
common.chat(bot, msg, x.NAME, logger)
|
common.faq(bot, msg, x.NAME, logger)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const x of commands) {
|
for (const x of commands) {
|
||||||
if (msg.text && msg.text.toString().includes(x.NAME)) {
|
if (msg.text && msg.text.toString().includes(x.NAME)) {
|
||||||
common.commands(bot, msg, x.NAME, logger)
|
common.chat(bot, msg, x.NAME, logger)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.text && msg.text.toString().includes("/chat")) {
|
if (msg.text && msg.text.toString().includes("/chat")) {
|
||||||
const chatId = msg.chat.id;
|
match = msg.text.substring(6);
|
||||||
match = msg.text.match(/([^\s]+)/g);
|
common.chat(bot, msg, match, logger)
|
||||||
const resp = match[1]; // the captured "whatever"
|
|
||||||
|
|
||||||
// for (const x of jointArray) {
|
|
||||||
// if (resp === x.NAME) {
|
|
||||||
// common.chat(bot, msg, resp)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
console.log('chat')
|
|
||||||
bot.sendMessage(msg.chat.id, resp, logger)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.text && msg.text.toString().toLowerCase().includes("set sub")) {
|
if (msg.text && msg.text.toString().toLowerCase().includes("set sub")) {
|
||||||
|
@ -14,7 +14,7 @@ module.exports = {
|
|||||||
status = 0
|
status = 0
|
||||||
}
|
}
|
||||||
subs.forEach(function (element, index) {
|
subs.forEach(function (element, index) {
|
||||||
if (element.SUB.toLowerCase() === sub) {
|
if (element.SUB.toLowerCase() === sub.toLowerCase()) {
|
||||||
subs[index].STATUS = status; //set the value
|
subs[index].STATUS = status; //set the value
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
const decache = require('decache');
|
const decache = require('decache');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
commands: async (bot, msg, input, logger) => {
|
chat: async (bot, msg, input, logger) => {
|
||||||
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " did - " + input);
|
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " did - " + input);
|
||||||
const userMention = "<a href=\"tg:\/\/user?id=" + msg.from.id + "\">@" + msg.from.first_name + "<\/a> "
|
const userMention = "<a href=\"tg:\/\/user?id=" + msg.from.id + "\">@" + msg.from.first_name + "<\/a> "
|
||||||
let commands = require('../../group/commands')
|
let commands = require('../../group/commands')
|
||||||
for (const x of commands) {
|
let chat = require('../../group/chat')
|
||||||
|
let jointArray = commands.concat(chat)
|
||||||
|
for (const x of jointArray) {
|
||||||
if (x.NAME === input) {
|
if (x.NAME === input) {
|
||||||
let n = x.NAME
|
let n = x.NAME
|
||||||
let t = x.TEXT
|
let t = x.TEXT
|
||||||
@ -18,14 +20,12 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
chat: async (bot, msg, input, logger) => {
|
faq: async (bot, msg, input, logger) => {
|
||||||
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " asked - " + input);
|
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " asked - " + input);
|
||||||
const userMention = "<a href=\"tg:\/\/user?id=" + msg.from.id + "\">@" + msg.from.first_name + "<\/a> "
|
const userMention = "<a href=\"tg:\/\/user?id=" + msg.from.id + "\">@" + msg.from.first_name + "<\/a> "
|
||||||
let commands = require('../../group/commands')
|
let commands = require('../../group/commands')
|
||||||
let navigation = require('../../group/FAQ')
|
let navigation = require('../../group/FAQ')
|
||||||
let chat = require('../../group/chat')
|
let jointArray = commands.concat(navigation)
|
||||||
let jointArray = commands.concat(navigation, chat)
|
|
||||||
|
|
||||||
for (const x of jointArray) {
|
for (const x of jointArray) {
|
||||||
if (x.NAME === input) {
|
if (x.NAME === input) {
|
||||||
let n = x.NAME
|
let n = x.NAME
|
||||||
|
@ -2,7 +2,17 @@ const name = process.env.BOT_NAME
|
|||||||
const channel = process.env.CHANNEL
|
const channel = process.env.CHANNEL
|
||||||
|
|
||||||
const chat = [
|
const chat = [
|
||||||
|
{
|
||||||
|
"NAME": "fuck off " + name.toLowerCase(),
|
||||||
|
"TEXT": [
|
||||||
|
"fuck off mate",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"NAME": "i love you " + name.toLowerCase(),
|
||||||
|
"TEXT": [
|
||||||
|
"fuck off mate",
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
module.exports = chat;
|
module.exports = chat;
|
@ -1 +1 @@
|
|||||||
[{"SUB":"Premium Plus","COST":30,"STATUS":1,"APPS":["XCIPTV Blue","Sky Q Yellow","SMARTERS Green"]},{"SUB":"VIP","COST":25,"STATUS":1,"APPS":["XCIPTV Blue","Sky Q Yellow","SMARTERS Green"]},{"SUB":"Old Premium","COST":17,"STATUS":1,"APPS":["XCIPTV Blue","Sky Q Yellow","SMARTERS Green"]},{"SUB":"Bluemoon","COST":15,"STATUS":1,"APPS":["SMARTERS Green"]},{"SUB":"KDB","COST":14,"STATUS":1,"APPS":["SMARTERS Green"]},{"SUB":"Gold","COST":13,"STATUS":1,"APPS":["XCIPTV Red","Sky Q Yellow","SMARTERS Green"]},{"SUB":"Technoid","COST":13,"STATUS":0,"APPS":["SMARTERS Green"]},{"SUB":"Bronze","COST":10,"STATUS":1,"APPS":["XCIPTV Red","SMARTERS Green"]},{"SUB":"SOL","COST":10,"STATUS":1,"APPS":["SMARTERS Green"]},{"SUB":"New Premium (tvob)","COST":"X","STATUS":1,"APPS":["SMARTERS Green"]},{"SUB":"Gambler","COST":"X","STATUS":1,"APPS":["SMARTERS Green"]},{"SUB":"All of em","COST":"X","STATUS":"X"}]
|
[{"SUB":"Premium Plus","COST":30,"STATUS":1,"APPS":["XCIPTV Blue","Sky Q Yellow","SMARTERS Green"]},{"SUB":"VIP","COST":25,"STATUS":1,"APPS":["XCIPTV Blue","Sky Q Yellow","SMARTERS Green"]},{"SUB":"Old Premium","COST":17,"STATUS":1,"APPS":["XCIPTV Blue","Sky Q Yellow","SMARTERS Green"]},{"SUB":"Bluemoon","COST":15,"STATUS":1,"APPS":["SMARTERS Green"]},{"SUB":"KDB","COST":14,"STATUS":1,"APPS":["SMARTERS Green"]},{"SUB":"Gold","COST":13,"STATUS":1,"APPS":["XCIPTV Red","Sky Q Yellow","SMARTERS Green"]},{"SUB":"Technoid","COST":13,"STATUS":1,"APPS":["SMARTERS Green"]},{"SUB":"Bronze","COST":10,"STATUS":1,"APPS":["XCIPTV Red","SMARTERS Green"]},{"SUB":"SOL","COST":10,"STATUS":1,"APPS":["SMARTERS Green"]},{"SUB":"New Premium (tvob)","COST":"X","STATUS":0,"APPS":["SMARTERS Green"]},{"SUB":"Gambler","COST":"X","STATUS":1,"APPS":["SMARTERS Green"]},{"SUB":"All of em","COST":"X","STATUS":"X"}]
|
Loading…
x
Reference in New Issue
Block a user