From 9c30681821a22083fcb14d3d7148955162ab82c2 Mon Sep 17 00:00:00 2001 From: "karl.hudgell" Date: Sun, 21 Jun 2020 16:42:38 +0100 Subject: [PATCH] updates --- .vscode/launch.json | 5 +++- app.js | 63 +++++++++++++++++++++++++++++++++------------ 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 3f3566c..30f54f2 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -13,7 +13,10 @@ ], "program": "${workspaceFolder}\\app.js", "env": { - "BOTTOKEN": "1012409404:AAE-Vt0W_Cfp6ENnz1aZgPaBW_7_kBD7CJI" + "BOT_TOKEN": "1012409404:AAE-Vt0W_Cfp6ENnz1aZgPaBW_7_kBD7CJI", + "BOT_NAME": "Keith", + "CHANNEL": "BBLBTV", + "FILELINKED_PIN": "47054161" } } ] diff --git a/app.js b/app.js index c2bb787..6380d2c 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,8 @@ const TelegramBot = require('node-telegram-bot-api'); -const token = process.env.BOTTOKEN; +const token = process.env.BOT_TOKEN; +const name = process.env.BOT_NAME; +const channel = process.env.CHANNEL const bot = new TelegramBot(token, { polling: true @@ -8,14 +10,14 @@ const bot = new TelegramBot(token, { bot.on('message', (msg) => { - const hi = "hi"; - if (msg.text.toString().toLowerCase().indexOf(hi) === 0) { - bot.sendMessage(msg.chat.id, "Hello " + msg.from.first_name + " Please press /start"); + const hi = "help"; + if (msg.text.toString().toLowerCase().includes(hi)) { + bot.sendMessage(msg.chat.id, "Hello " + msg.from.first_name + " Please PM me @BBLBTV2_bot and i'll help."); } const bye = "bye"; if (msg.text.toString().toLowerCase().includes(bye)) { - bot.sendMessage(msg.chat.id, "Hope to see you around again , Bye"); + bot.sendMessage(msg.chat.id, "Hope to see you again, Bye " + msg.from.first_name + "."); } const subPrice = "subscription prices"; @@ -167,25 +169,54 @@ bot.on('message', (msg) => { ["Technoid"], ["Bluemoon"], ["SOL"], - ["Gambler"] + ["Gambler"], + ["Home"] ] } }) } + const vip = "vip" + const premiumPlus = "premium plus" + const oldPremium = "old premium" + if ((msg.text.toString().toLowerCase().includes(vip)) || (msg.text.toString().toLowerCase().includes(premiumPlus)) || (msg.text.toString().toLowerCase().includes(oldPremium))) { + bot.sendMessage(msg.chat.id, "You can use -\nXCIPTV Blue\nSky Q Yellow\nSMARTERS Green\n\nAll can be downloaded from our FileLinked") + } + + const gold = "gold" + if (msg.text.toString().toLowerCase().includes(gold)) { + bot.sendMessage(msg.chat.id, "You can use -\nXCIPTV Red\nSky Q Yellow\nSMARTERS Green\n\nAll can be downloaded from our FileLinked") + } + + const bronze = "bronze" + if (msg.text.toString().toLowerCase().includes(bronze)) { + bot.sendMessage(msg.chat.id, "You can use -\nXCIPTV Red\nSMARTERS Green\n\nAll can be downloaded from our FileLinked") + } + + const newPremium = "new premium" + const kdb = "kdb" + const technoid = "technoid" + const bluemoon = "bluemoon" + const sol = "sol" + const gambler = "gambler" + if ((msg.text.toString().toLowerCase().includes(newPremium)) || (msg.text.toString().toLowerCase().includes(kdb)) || (msg.text.toString().toLowerCase().includes(gambler)) || (msg.text.toString().toLowerCase().includes(technoid)) || (msg.text.toString().toLowerCase().includes(bluemoon)) || (msg.text.toString().toLowerCase().includes(sol))) { + bot.sendMessage(msg.chat.id, "You can use -\nSMARTERS Green\n\nAll can be downloaded from our FileLinked") + } }), - bot.onText(/^(\/start|Home)$/, (msg) => { - - bot.sendMessage(msg.chat.id, "Please use the buttons below to navigate", { - "reply_markup": { - "keyboard": [ - ["FAQ", "Applications"] - ] - } + bot.onText(/^(\/start|\/help|Home)$/, (msg) => { + bot.sendMessage(msg.chat.id, "I'm " + name).then(() => { + return bot.sendMessage(msg.chat.id, "I'm the " + channel + " Bot, and can answer your questions").then(() => { + return bot.sendMessage(msg.chat.id, "Please use the buttons below to navigate", { + "reply_markup": { + "keyboard": [ + ["FAQ", "Applications"] + ] + } + }) + }) }) - }) @@ -258,7 +289,7 @@ bot.onText(/^IPTV$/, (msg) => { }) bot.onText(/^FileLinked$/, (msg) => { - bot.sendMessage(msg.chat.id, "The current FileLinked code is - 47054161\n\nYou can download all our players from there", { + bot.sendMessage(msg.chat.id, "The current FileLinked code is - " + process.env.FILELINKED_PIN + "\n\nYou can download all our players from there", { "reply_markup": { "keyboard": [ ["Install FileLinked on FireStick", "Install FileLinked on Android"],