Keith/app.js
karl.hudgell 541c3c1c1e new menu
2020-06-21 21:08:19 +01:00

314 lines
26 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

require('dotenv').config();
const TelegramBot = require('node-telegram-bot-api');
const token = process.env.BOT_TOKEN;
const name = process.env.BOT_NAME;
const channel = process.env.CHANNEL
const bot = new TelegramBot(token, {
polling: true
});
bot.on('message', (msg) => {
const help = "help";
if (msg.text.toString().toLowerCase().includes(help)) {
bot.sendMessage(msg.chat.id, "Hello " + msg.from.first_name + " Please PM me @" + process.env.BOT_USERNAME + " and i'll help.");
}
const bye = "bye";
if (msg.text.toString().toLowerCase().includes(bye)) {
bot.sendMessage(msg.chat.id, "Hope to see you again, Bye " + msg.from.first_name + ".");
}
const subPrice = "-subscription prices";
if (msg.text.toString().toLowerCase() === subPrice) {
bot.sendMessage(msg.chat.id, "PREMIUM PLUS ----£30\nVIP-----------------------£25\nOLD PREMIUM -----£17\nBLUEMOON ---------£15\nKDB --------------------£14\nGOLD ------------------£13\nTECHNOID -----------£13\nBRONZE --------------£10\nSOL ---------------------£10")
.then(() => {
return bot.sendMessage(msg.chat.id, "All of these prices are for 12 Month subscription subs").then(() => {
return bot.sendMessage(msg.chat.id, "Keep an eye out though because we offer special deals on different subs from time to time.")
})
})
}
const howToSignUp = "-how to get a subscription?";
if (msg.text.toString().toLowerCase() === howToSignUp) {
bot.sendMessage(msg.chat.id, "To purchase a subscription you need to send a DM to any of the Admins in the group @Scotslad, @manclad72 or @bob_15.")
.then(() => {
return bot.sendMessage(msg.chat.id, "PLEASE ONLY DM ONE ADMIN AND WAIT FOR THEM TO GET BACK TO YOU.").then(() => {
return bot.sendMessage(msg.chat.id, "When you DM to purchase the subscription please let the Admin know:\n\n1. what device the sub is going onto\n2. If there's a specific username you would like and\n3. If you don't want adult channels included. If you don't want adult channels and don't mention it when purchasing Your sub WILL be issued WITH adult channels. These can't be removed")
})
})
}
const suburls = "-subscription urls";
if (msg.text.toString().toLowerCase() === suburls) {
bot.sendMessage(msg.chat.id, "In this IPTV room we don't give out sub URLs or m3us. We have dedicated apps to play all subs on your Android box or IPTV player in our FileLinked.");
}
const multipleDevices = "-can i stream on multiple devices?";
if (msg.text.toString().toLowerCase() === multipleDevices) {
bot.sendMessage(msg.chat.id, "No. All subs sold is this room are one connection subs unless otherwise stated.\n\nThis means that you can have your sub loaded onto as many devices as you want (eg Android phone, tablet, Firestick, Android TV box) BUT you can only play the sub from one device at a time.")
.then(() => {
return bot.sendMessage(msg.chat.id, "Otherwise you may lose your sub altogether!")
})
}
const updatesGroup = "-updates group";
if (msg.text.toString().toLowerCase() === updatesGroup) {
bot.sendMessage(msg.chat.id, "The updates groups can be found here")
.then(() => {
return bot.sendMessage(msg.chat.id, "https://t.me/joinchat/AAAAAFDxZ2rzgAW5acahxA").then(() => {
return bot.sendMessage(msg.chat.id, "Please join for BBLBTV updates")
})
})
}
const installOnFire = "-install filelinked on firestick";
if (msg.text.toString().toLowerCase() === installOnFire) {
bot.sendMessage(msg.chat.id, "Step 1:\n\nGo to Settings > device/my fire tv > developer options > apps from unknown sources on")
.then(() => {
return bot.sendMessage(msg.chat.id, "Step 2: download an app called downloader. (Orange icon)").then(() => {
return bot.sendMessage(msg.chat.id, "Step 3:\nOpen downloader and type in this address\nhttp://get.filelinked.com\nThen when it asks, install that app.").then(() => {
return bot.sendMessage(msg.chat.id, "Step 4:\nPress and hold home and then click on “Apps” and scroll to the bottom and click on the very last app and open it (filelinked).").then(() => {
return bot.sendMessage(msg.chat.id, "Step 5: Enter the filelinked code from the Updates page to get the list of apps for your sub")
})
})
})
})
}
const installoOnAndroid = "-install filelinked on android";
if (msg.text.toString().toLowerCase() === installoOnAndroid) {
bot.sendMessage(msg.chat.id, "First thing you need to do is go to browser on your Android TV box and enter www.filelinked.com")
.then(() => {
return bot.sendMessage(msg.chat.id, "From this browser page, download FileLinked.").then(() => {
return bot.sendMessage(msg.chat.id, "Once you have pressed download then you can close the browser and go to your apps.").then(() => {
return bot.sendMessage(msg.chat.id, "Then open file manager or file browser. In here go to downloads, filemanager, press install.").then(() => {
return bot.sendMessage(msg.chat.id, "Then go back to your apps section on the box and find filelinked app.").then(() => {
return bot.sendMessage(msg.chat.id, "Open the app and enter the code.")
})
})
})
})
})
}
const SurfShark = "-vpn (surfshark)";
if (msg.text.toString().toLowerCase() === SurfShark) {
bot.sendMessage(msg.chat.id, "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");
}
const iptvGuidance = "-iptv guidance";
if (msg.text.toString().toLowerCase() === iptvGuidance) {
bot.sendMessage(msg.chat.id, "🚨Basic IPTV Guidance🚨\n\nPlease see below some very basic IPTV guidance for those who are new to IPTV")
.then(() => {
return bot.sendMessage(msg.chat.id, "1. What is a sub? A sub is what provides you with your live tv and movies/VOD... They are called different names e.g. GOLD, PREMIUM, ETC... All offer very similar channels with the difference of VOD, Series and time and money spent on servers.").then(() => {
return bot.sendMessage(msg.chat.id, "2. What is an APP? An app is something that you load your sub onto, and enables you to view the channels your sub provides.").then(() => {
return bot.sendMessage(msg.chat.id, "3. What is the difference m3u and Stbemu? you simply add a username...password and url (M3U) to apps such as SMARTERS,XCIPTV that you get when you purchase your sub (the username and password is in effect your sub) These subs can normally be used on multiple devices but only one at a time. Stbemu is a (mac) based app, you give the admin your mac address and they give you a portal (URL) to add to the stbemu app. The latest version on Stbemu is available in my filelinked. Stbemu subs are generally MAC, Serial and Device locked, and are not advised to anyone new to IPTV!!!!").then(() => {
return bot.sendMessage(msg.chat.id, "4. For flexibility and ease of use username and password subs are far better for anyone new to IPTV certain subs have their own dedicated apps and are available to download from my filelinked. I have at least one app available for every sub I sell in this room.").then(() => {
return bot.sendMessage(msg.chat.id, "5. Things you must know when using IPTV How to refresh DNS How to change your app player settings How to change your app player to an external player How to carry out basic but essential IPTV Maintenance.")
})
})
})
})
})
}
const iptvMaintenance = "-basic iptv maintenance";
if (msg.text.toString().toLowerCase() === iptvMaintenance) {
bot.sendMessage(msg.chat.id, "🚨Basic IPTV Maintenance🚨\n\nReboot Router, Reboot Device.\nClear all app caches - Go to settings - Applications - Manage installed applications - click on app and select clear cache. Do this for all installed applications.")
.then(() => {
return bot.sendMessage(msg.chat.id, "To refresh DNS\nClick on add user\nRefresh DNS\nList users\nLog back in").then(() => {
return bot.sendMessage(msg.chat.id, "Adding external players and changing player settings (decoder)\n\nClick the three dots in top corner and select settings.\nClick external players, and add VLC and MX Players.\nGo back one screen and click player selection.\nAt the side of live tv click whichever player you prefer, for live tv and catch up, the built in player generally works best, and choose an external player for VOD and series.\nYou may also find that changing your player setting to HW or Native can help with freezing/stuttering stream issues.").then(() => {
return bot.sendMessage(msg.chat.id, "To get the most from your IPTV you have to take a little time to learn how IPTV works How you do this is by investing a little of your time and reading through previous group messages, you do not have to read through 1000s of messages, simply use the group search function. Also do the same with the updates group, this way your IPTV experience will be a very positive, downtime and buffer free one.").then(() => {
return bot.sendMessage(msg.chat.id, "Using search function\n\nTo save time having to scroll through 1000s of messages utilise the telegram search function, this can be used to search for specific key words.\n\nSimply click on the group name (3dots at the top right of screen)\n\nThis will bring a sub menu select the word search and then type the word you are searching for e.g. your sub name, it will then bring up all messages featuring the word you have searched for.")
})
})
})
})
}
const doIneedVPN = "-do i need a vpn?";
if (msg.text.toString().toLowerCase() === doIneedVPN) {
bot.sendMessage(msg.chat.id, "You only need a VPN if your subscription isn't working at the time of use, normally only when the Football is on do the subs get blocked, if they do, connect using SurfShark using the details provided in the updates channel, DO NOT SHARE THESE DETAILS!");
}
const iptvBible = "-iptv bible";
if (msg.text.toString().toLowerCase() === iptvBible) {
bot.sendMessage(msg.chat.id, "So the first thing I want to get out of the way is the stigma of download speeds and requirements for download speed. \r\n\r\nIn streaming like we do you will be just fine with at least 5mbps. I myself have streamed tethering off my phone with only 3mbps, but let\u2019s set the standard at 5mbps. If you have at least 5mbps and you are having issues with buffering, the download speed is not your problem. \r\n\r\nA lot of people seem to think that buffering is caused by low download speeds but that is just not true. \r\n\r\nLike I said above you can stream perfectly fine on 5mbps, in the same token you can have GB download speeds and have buffering issues.\r\n\r\nThere are a few things that will cause buffering.")
.then(() => {
return bot.sendMessage(msg.chat.id, "1. HEAVY TRAFFIC ON THE SERVER THE LINK IS COMING FROM:\r\n\r\nYes it\u2019s nice to be able to watch movies and tv shows for free using the free links, I mean free anything is always great. But keep in mind free is not always the best. The servers that the free links come from can get congested with heavy traffic spiking the bandwidth usage of that server. \r\n\r\nThis is common during heavy streaming hours (night time and weekends). Unfortunately there is nothing you can do on your end to fix this, the only thing you can do is try another link. \r\n\r\nI highly suggest spending a few bucks for real-debrid. Real-debrid is a premium service that uses tons of premium servers all over the world. They only allow a small amount of bandwidth usage per server so you the user don\u2019t run into heavy traffic. This helps eliminate buffering. If you\u2019re still having issues with buffering using real-debrid then more then likely it\u2019s on your end. I\u2019m not saying real-debrid doesn\u2019t run into issues but It\u2019s Technology, it does have it\'s down points at times.").then(() => {
return bot.sendMessage(msg.chat.id, "2. EQUIPMENT:\r\n\r\nEquipment plays a big roll in internet. If you have cheap equipment and you have the best internet provider in the world with this highest speeds, you are still going to run into issues. \r\n\r\nSo invest a good router that will perform with the speeds you are paying for. \r\n\r\nMost isp routers will not perform with the service they sell you, so it\u2019s best to purchase your own. \r\n\r\nHere is what to look for when shopping for a good router. \r\nFirst do your research on different routers and read customer reviews. \r\nSecond you want a router that is dual band, daul band has both 2.4GHz network and 5GHz network (we will get into networks later). \r\nYou could also go with a mesh system router if you really feel it\u2019s necessary. \r\nNext you want to make sure your router can cover the size of the place you live in. \r\nLook for the sq ft the router covers and be sure it will cover the sq ft of your place. \r\nNext check the speeds the router can output and either match it with the speeds your paying for or higher (I suggest going a little higher then the speeds you pay for). \r\nNext and another key factor is placement of router. \r\nYou should place your router in the center part of your house, or in a open corner so the signal can bounce off the walls and reach were it needs to send the signal.").then(() => {
return bot.sendMessage(msg.chat.id, "3. NETWORK:\r\n\r\nSo as I mentioned above you want to have a dual band router. Dual band routers have two WiFi networks, 2.4GHz network and 5GHz. The 2.4GHz network is your standard WiFi network. On this network your speeds will be drastically reduced. The 2.4GHz is ideal for cellphones, computers...etc..\r\n\r\nThe 5GHz network is your powerhouse network. Like being hardwired the 5GHz network will give you your full speed and best bandwidth. \r\n\r\nThe 5GHz network is designed for streaming\/gaming. You want your firesticks to be on the 5GHz network and only your firesticks, if you have a gaming system you want that on the 5GHz network as well( I highly suggest hardwiring gaming systems if possible). Everything else in your house should be on the 2.4GHz network.\r\n\r\nThe 5GHz network is not designed to handle multiple connections at once, this is why you put all your other devices on the 2.4GHz network. You will be fine running all your firesticks at the same time on the 5GHz network as long as that\u2019s all that\u2019s on this network. Also the 5GHz network is not designed for distance, this is why it is important that you make sure you get a router that covers the sq ft of your house. I also want to clear up wrong information that gets thrown around, some people think the 5GHz network will not go through walls, this is false. The 5GHz network will most certainly go through walls. The whole 5GHz network not being able to go through walls is more towards exterior walls. So for instance if you walk outside your house you will more than likely drop your WiFi. Now I usually go into the router settings and separate the WiFi networks by putting a 5 after the name on my 5GHz network. Example- WiFi name lets say is mark, my 2.4GHz network will be named \u201Cmark\u201D and my 5GHz network will be named \u201Cmark5\u201D. Also make sure that your router is not set to choose network on its own, it\u2019s best to have that set to choose manually").then(() => {
return bot.sendMessage(msg.chat.id, "4. RUNNING A SPEED TEST ON YOUR FIRE DEVICE:\r\n\r\nIf everything above has been done and you are still having issues then next you are going to want too run a speed test on your device. Go ahead and get the speed test app called \"analiti\" on your Fire Device.\r\n\r\nOn a firestick you can go to the amazon store and search for it by name or use the Alexa Mic on your remote and say \u201Cspeed test\u201D, analiti should be the first option. Now once you download analiti open it up, it will start a quick scan test just to tell you your speeds. On the left hand menu you will see a bunch of different options, the second one down is detailed test, you want to click on that. \r\n\r\nNow let the test complete before reading any numbers. Now you want to know what your bandwidth usage is at, analiti will not give you your bandwidth usage and I have yet to find a speed test that will except Xbox\u2019s speed test, but that won\u2019t do you any good because you need to perform the Speedtest on the device that is having issues(every device is going to get different results). So here is what you want to look for too determine your bandwidth usage, average latency. You will notice there are a few latency test results on this speed test, you want all of them to be an average of 30ms to 50ms. \r\n\r\nBandwidth and latency run right with each other for the most part. \r\n\r\nSo let me Break it down for you, \r\nBandwidth should be between 60ms to 80ms(the lower the better) \r\nLatency should be between 30ms and 50ms(again the lower the better). \r\n\r\nSo like I said latency runs with bandwidth, so if your latency is at 30ms then your bandwidth is 60ms give or take. If your latency is at 50ms then your bandwidth is at 80ms give or take.\r\n\r\nNext you want too check your round trip ping. \r\nThe round trip ping is the time it takes for your device to send a request to the server you are pinging to and for the server to respond back(for a better lack of words). \r\n\r\nNow this one is a tough one to determine, distance to server plays a key roll here. So if distance to server is 50 miles or less(the most common) then your ping should be from 1ms to 30ms (the lower the better) if you are pinging across state 100 miles or more then a ping from 30ms to 60ms would be fine(again the lower the number the better). \r\n\r\nIf any of that is higher, you are going to have too determine where the issue is. \r\n\r\nSo next you want to check WiFi signal strength and wifi phy speed (link speed). Be sure that your WiFi signal is good and the router can put out the speed that it\u2019s supposed to. I\u2019m sure you know how to read the signal strength so I\u2019m just going to jump into WiFi link speed. So analiti will test the capability of the routers speed. So if your router is said it can handle speeds up to 400mbps, then your WiFi speed link should show 400mbps average. If the mbps are lower then what the router is supposed to be capable of then your router is dying and you need to replace it.\r\nI also want to point out that if your WiFi signal is low and you know your router covers the sq ft of your house then that").then(() => {
return bot.sendMessage(msg.chat.id, "5. MAINTENANCE:\r\n\r\nIn order for your internet and device to run at its peak performance you will have to perform maintenance on both device and equipment. \r\nOnce a week you should unplug your router and device for at least 5 minutes. Your router stores cache just like your firestick, unplugging it for 5 minutes allows it to clear out cache and start fresh. I actually have my router on a plug timer, you can get one cheap at a Walmart or Target. \r\nI have it set to power down my router at 4AM every morning and it kicks back on at 4:05. That way I have a fresh start every morning.\r\n\r\nI hope this helps. Enjoy and happy streaming everyone.")
})
})
})
})
})
}
const howToResetCache = "-how do i clear cache?";
if (msg.text.toString().toLowerCase() === howToResetCache) {
bot.sendMessage(msg.chat.id, "Cache files are main source of errors and problems in functioning of Apps, by clearing cache may solve most of the problems associated with Apps. To clear cache, go to Settings > Application > Manage apps > Select \"All\" tabs, select the app which was producing error and then tap Clear cache.");
}
const whatAppShouldIUse = "-what app should i use?";
if (msg.text.toString().toLowerCase() === whatAppShouldIUse) {
bot.sendMessage(msg.chat.id, "What Subscription do you have?", {
"reply_markup": {
"keyboard": [
["-VIP"],
["-Premium Plus"],
["-Old Premium"],
["-Gold"],
["-Bronze"],
["-New Premium"],
["-KDB"],
["-Technoid"],
["-Bluemoon"],
["-SOL"],
["-Gambler"],
["-Home"]
]
}
})
}
const vip = "-vip"
const premiumPlus = "-premium plus"
const oldPremium = "-old premium"
if (msg.text.toString().toLowerCase() === vip || msg.text.toString().toLowerCase() === premiumPlus || msg.text.toString().toLowerCase() === 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() === 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() === 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() === newPremium) || (msg.text.toString().toLowerCase() === kdb) || (msg.text.toString().toLowerCase() === gambler) || (msg.text.toString().toLowerCase() === technoid) || (msg.text.toString().toLowerCase() === bluemoon) || (msg.text.toString().toLowerCase()===sol)) {
bot.sendMessage(msg.chat.id, "You can use -\nSMARTERS Green\n\nAll can be downloaded from our FileLinked")
}
}),
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"]
]
}
})
})
})
})
bot.onText(/^-FAQ$/, (msg) => {
bot.sendMessage(msg.chat.id, "Frequently Asked Questions")
.then(() => {
return bot.sendMessage(msg.chat.id, "Please only ask an Admin, if you can't find the answer here..", {
"reply_markup": {
"keyboard": [
["-Subscriptions"],
["-IPTV"],
["-Apps"],
["-Home"]
]
}
})
})
})
bot.onText(/^-Applications$/, (msg) => {
bot.sendMessage(msg.chat.id, "We have a number of different applications that work with our subs, here is an overview of subs/apps colour coded by the icon in our FileLinked").then(() => {
return bot.sendMessage(msg.chat.id, "There are 2 new XCIPTV apps, Blue and Red.\nEach have 3 different sub DNS (URLs) already embedded in the players.").then(() => {
return bot.sendMessage(msg.chat.id, "Sky Q app (yellow player) this holds 4 of the room subs.").then(() => {
return bot.sendMessage(msg.chat.id, "All of the room subs play on the green smarters player", {
"reply_markup": {
"keyboard": [
["-What app should I use?"],
["-VPN (SurfShark)"],
["-FileLinked"],
["-Home"]
]
}
})
})
})
})
})
bot.onText(/^-Subscriptions$/, (msg) => {
bot.sendMessage(msg.chat.id, "Subscription FAQ", {
"reply_markup": {
"keyboard": [
["-Subscription Prices"],
["-How to get a subscription?"],
["-Subscription URLs", "-Can I stream on multiple devices?"],
["-Updates Group"],
["-Install FileLinked on FireStick", "-Install FileLinked on Android"],
["-Home"]
]
}
})
})
bot.onText(/^-IPTV$/, (msg) => {
bot.sendMessage(msg.chat.id, "IPTV FAQ", {
"reply_markup": {
"keyboard": [
["-IPTV Guidance"],
["-Basic IPTV Maintenance"],
["-Do I need a VPN?"],
["-IPTV Bible"],
["-Home"]
]
}
})
})
bot.onText(/^-FileLinked$/, (msg) => {
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"],
["-Home"]
]
}
})
})
bot.onText(/^-Apps$/, (msg) => {
bot.sendMessage(msg.chat.id, "Apps FAQ", {
"reply_markup": {
"keyboard": [
["-How do I clear cache?"],
["-Home"]
]
}
})
})