This commit is contained in:
karl.hudgell 2020-06-21 16:42:38 +01:00
parent a82778bf0a
commit 9c30681821
2 changed files with 51 additions and 17 deletions

5
.vscode/launch.json vendored
View File

@ -13,7 +13,10 @@
], ],
"program": "${workspaceFolder}\\app.js", "program": "${workspaceFolder}\\app.js",
"env": { "env": {
"BOTTOKEN": "1012409404:AAE-Vt0W_Cfp6ENnz1aZgPaBW_7_kBD7CJI" "BOT_TOKEN": "1012409404:AAE-Vt0W_Cfp6ENnz1aZgPaBW_7_kBD7CJI",
"BOT_NAME": "Keith",
"CHANNEL": "BBLBTV",
"FILELINKED_PIN": "47054161"
} }
} }
] ]

63
app.js
View File

@ -1,6 +1,8 @@
const TelegramBot = require('node-telegram-bot-api'); 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, { const bot = new TelegramBot(token, {
polling: true polling: true
@ -8,14 +10,14 @@ const bot = new TelegramBot(token, {
bot.on('message', (msg) => { bot.on('message', (msg) => {
const hi = "hi"; const hi = "help";
if (msg.text.toString().toLowerCase().indexOf(hi) === 0) { if (msg.text.toString().toLowerCase().includes(hi)) {
bot.sendMessage(msg.chat.id, "Hello " + msg.from.first_name + " Please press /start"); bot.sendMessage(msg.chat.id, "Hello " + msg.from.first_name + " Please PM me @BBLBTV2_bot and i'll help.");
} }
const bye = "bye"; const bye = "bye";
if (msg.text.toString().toLowerCase().includes(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"; const subPrice = "subscription prices";
@ -167,25 +169,54 @@ bot.on('message', (msg) => {
["Technoid"], ["Technoid"],
["Bluemoon"], ["Bluemoon"],
["SOL"], ["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.onText(/^(\/start|\/help|Home)$/, (msg) => {
bot.sendMessage(msg.chat.id, "I'm " + name).then(() => {
bot.sendMessage(msg.chat.id, "Please use the buttons below to navigate", { return bot.sendMessage(msg.chat.id, "I'm the " + channel + " Bot, and can answer your questions").then(() => {
"reply_markup": { return bot.sendMessage(msg.chat.id, "Please use the buttons below to navigate", {
"keyboard": [ "reply_markup": {
["FAQ", "Applications"] "keyboard": [
] ["FAQ", "Applications"]
} ]
}
})
})
}) })
}) })
@ -258,7 +289,7 @@ bot.onText(/^IPTV$/, (msg) => {
}) })
bot.onText(/^FileLinked$/, (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": { "reply_markup": {
"keyboard": [ "keyboard": [
["Install FileLinked on FireStick", "Install FileLinked on Android"], ["Install FileLinked on FireStick", "Install FileLinked on Android"],