2020-06-21 12:01:11 +01:00
|
|
|
const TelegramBot = require('node-telegram-bot-api');
|
|
|
|
|
2020-06-21 13:10:29 +01:00
|
|
|
const token = process.env.BOTTOKEN;
|
2020-06-21 12:01:11 +01:00
|
|
|
|
|
|
|
const bot = new TelegramBot(token, { polling: true });
|
|
|
|
|
|
|
|
bot.on('message', (msg) => {
|
|
|
|
|
|
|
|
var hi = "hi";
|
|
|
|
if (msg.text.toString().toLowerCase().indexOf(hi) === 0) {
|
2020-06-21 13:10:29 +01:00
|
|
|
bot.sendMessage(msg.chat.id, "Hello " + msg.from.first_name + " Please type /start");
|
2020-06-21 12:01:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
var bye = "bye";
|
|
|
|
if (msg.text.toString().toLowerCase().includes(bye)) {
|
|
|
|
bot.sendMessage(msg.chat.id, "Hope to see you around again , Bye");
|
|
|
|
}
|
|
|
|
|
2020-06-21 13:10:29 +01:00
|
|
|
// 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..");
|
|
|
|
// }
|
2020-06-21 12:01:11 +01:00
|
|
|
|
|
|
|
|
2020-06-21 13:10:29 +01:00
|
|
|
}),
|
|
|
|
bot.onText(/^(\/start|Home)$/, (msg) => {
|
|
|
|
|
|
|
|
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"], ["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"]]
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|