diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..3f3566c --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,20 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "skipFiles": [ + "/**" + ], + "program": "${workspaceFolder}\\app.js", + "env": { + "BOTTOKEN": "1012409404:AAE-Vt0W_Cfp6ENnz1aZgPaBW_7_kBD7CJI" + } + } + ] +} \ No newline at end of file diff --git a/app.js b/app.js index ba69aab..c369c8d 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,6 @@ const TelegramBot = require('node-telegram-bot-api'); -const token = '1012409404:AAE-Vt0W_Cfp6ENnz1aZgPaBW_7_kBD7CJI'; +const token = process.env.BOTTOKEN; const bot = new TelegramBot(token, { polling: true }); @@ -8,7 +8,7 @@ bot.on('message', (msg) => { var hi = "hi"; if (msg.text.toString().toLowerCase().indexOf(hi) === 0) { - bot.sendMessage(msg.chat.id, "Hello dear user"); + bot.sendMessage(msg.chat.id, "Hello " + msg.from.first_name + " Please type /start"); } var bye = "bye"; @@ -16,11 +16,46 @@ bot.on('message', (msg) => { bot.sendMessage(msg.chat.id, "Hope to see you around again , Bye"); } + // const faq = "faq"; + // if (msg.text.toString().toLocaleLowerCase().includes(faq)) { + // // bot.sendMessage(msg.chat.id, "Here are Frequently Asked Questions"); + // // bot.sendMessage(msg.chat.id, "Please only ask an Admin, if you can't find the answer here.."); + // } + }), - - bot.onText(/\/start/, (msg) => { + bot.onText(/^(\/start|Home)$/, (msg) => { - bot.sendMessage(msg.chat.id, "Welcome to BigBoxLittleBox Bot"); + bot.sendMessage(msg.chat.id, "Please use the buttons below to navigate", { + "reply_markup": { + "keyboard": [["FAQ", "Applications"]] + } + }) -}) \ No newline at end of file + }) + + +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"], ["Home"]] + } + }) + }) +}) + + +bot.onText(/Subscriptions/, (msg) => { + bot.sendMessage(msg.chat.id, "Please only ask an Admin, if you can't find the answer here..", { + "reply_markup": { + "keyboard": [["Subscription Prices"], + ["How to get a subscription?"], + ["Subscriptions URLs", "Can I stream on multiple devices?"], + ["Updates Group"], + ["Install FileLinked on FireStick", "Install FileLinked on Android"], + ["Home"]] + } + }) +})