From fa689f50d1e240378d99e50cc33e71e6e524017c Mon Sep 17 00:00:00 2001 From: Karl Date: Mon, 12 Jul 2021 13:33:59 +0000 Subject: [PATCH] pre new changes --- app.js | 5 +++++ data/bot/lib/questions.js | 44 +++++++++++++++++++++++++-------------- data/group/FAQ.js | 13 ++++++++++-- data/group/subs.json | 6 +++--- package-lock.json | 5 +++++ package.json | 2 ++ 6 files changed, 54 insertions(+), 21 deletions(-) diff --git a/app.js b/app.js index 8913882..f878b70 100644 --- a/app.js +++ b/app.js @@ -70,6 +70,11 @@ bot.on('message', (msg) => { } } + if (msg.text && msg.text.toString().includes("/password")) { + match = msg.text.substring(10); + questions.password(bot, msg, match, logger) + } + if (msg.text && msg.text.toString().toLowerCase().includes("set sub")) { bot_subStatus.setSubStatus(bot, msg, logger) } diff --git a/data/bot/lib/questions.js b/data/bot/lib/questions.js index 80a5cc3..60c86f2 100644 --- a/data/bot/lib/questions.js +++ b/data/bot/lib/questions.js @@ -1,4 +1,5 @@ const fs = require('fs') +const Nato = require('nato'); module.exports = { whatSubShouldIBuy: (bot, msg, logger) => { @@ -17,20 +18,31 @@ module.exports = { let string = "" const subStatus = "sub status"; - logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Asked how to get a subscription"); - subs.forEach(element => { - if (element.STATUS != "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; + logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Asked how to get a subscription"); + subs.forEach(element => { + if (element.STATUS != "X") { + if (element.STATUS === 1) { + element.STATUS = "Up" + } else { + element.STATUS = "Down" } - }); - // console.log(string) - bot.sendMessage(msg.chat.id, string, { parse_mode: "HTML" }) - } - } \ No newline at end of file + let catString = element.SUB + " Is " + element.STATUS + // console.log(catString) + string += '\n' + catString; + } + }); + // console.log(string) + bot.sendMessage(msg.chat.id, string, { parse_mode: "HTML" }) + }, + password: (bot, msg, match, logger) => { + logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Asked for their password being spelt"); + // console.log(string) + + let sendString = new Nato(match.toLowerCase()) + + bot.sendMessage(msg.chat.id, sendString.nato, { + force_reply: true, + parse_mode: "HTML" + }) + } +} \ No newline at end of file diff --git a/data/group/FAQ.js b/data/group/FAQ.js index 75020c5..43d13bd 100644 --- a/data/group/FAQ.js +++ b/data/group/FAQ.js @@ -39,7 +39,7 @@ const chat = [ "TEXT": [ "Hints & Tips" ], - "MENU": '[["- IPTV"],["- How do I clear cache?"],["- Home"]]' + "MENU": '[["- IPTV"],["- How do I clear cache?"],["- What IS my password?"],["- Home"]]' }, { "NAME": "- Subscriptions", @@ -181,7 +181,16 @@ const chat = [ "SurfShark is the VPN that we advise you use on your device to bypass the blocks,\n\nYou can install this on your device from our FileLinked\n\nWe provide a username and password for you to use in the updates groups. DO NOT SHARE THE DETAILS" ], "MENU": '[[]]' - } + }, + { + "NAME": "- What IS my password?", + "TEXT": [ + "If you want to know what your password is (sometimes its hard working out 0 and O) you can ask me in this chat by copying and pasting the password you received from Sarah", + "/password CopyAndPasteYourPasswordHere", + "I will send you back a phonetic spelling of your password, don't worry, I dont' save it.", + ], + "MENU": '[[]]' + }, ] module.exports = chat; \ No newline at end of file diff --git a/data/group/subs.json b/data/group/subs.json index c83fee7..4b172f9 100644 --- a/data/group/subs.json +++ b/data/group/subs.json @@ -66,7 +66,7 @@ "SUB": "KDB", "COST": 0, "STATUS": 1, - "IMAGE": "./data/group/Sports.jpg", + "IMAGE": "./data/group/KDB.jpg", "APPS": [ "Red XCIPTV", "White&Black IM", @@ -90,7 +90,7 @@ "SUB": "Gunslinger", "COST": 0, "STATUS": 1, - "IMAGE": "X", + "IMAGE": "./data/group/Gunslinger.jpg", "APPS": [ "Red XCIPTV", "White&Black IM", @@ -102,7 +102,7 @@ "SUB": "Irish Lass", "COST": 0, "STATUS": 1, - "IMAGE": "X", + "IMAGE": "./data/group/Irish_Lass.jpg", "APPS": [ "White&Black IM", "Green SMARTERS" diff --git a/package-lock.json b/package-lock.json index 149aa35..8dd77aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -485,6 +485,11 @@ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, + "phonetic-alphabet-converter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/phonetic-alphabet-converter/-/phonetic-alphabet-converter-1.1.0.tgz", + "integrity": "sha512-0jTb/6wXLLlL8Mxe45zYwT/ukAOAbXgVq192V4ThZQlBf2YDMGyw81QudfhiSEO2ViMCNUDBIrIF0mZSUUgyGw==" + }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", diff --git a/package.json b/package.json index ba4c7df..d994df3 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,10 @@ "cached-request": "^2.0.1", "dotenv": "^8.2.0", "fs": "0.0.1-security", + "nato": "^0.1.1", "node-telegram-bot-api": "^0.50.0", "perfect-logger": "^2.0.1", + "phonetic-alphabet-converter": "^1.1.0", "request": "^2.88.2", "require-dir": "^1.2.0", "throttled-request": "^0.1.1"