changes to welcome stuff

This commit is contained in:
karl.hudgell 2020-06-22 11:17:00 +01:00
parent 737255c94f
commit 642fd7ccde

27
app.js
View File

@ -15,6 +15,8 @@ logger.initialize('FrontEndDriver', {
const token = process.env.BOT_TOKEN; const token = process.env.BOT_TOKEN;
const name = process.env.BOT_NAME; const name = process.env.BOT_NAME;
const channel = process.env.CHANNEL const channel = process.env.CHANNEL
const username = process.env.BOT_USERNAME;
const bot = new TelegramBot(token, { const bot = new TelegramBot(token, {
polling: true polling: true
@ -24,8 +26,17 @@ bot.on('message', (msg) => {
const help = "help"; const help = "help";
if (msg.text.toString().toLowerCase().includes(help)) { if (msg.text.toString().toLowerCase().includes(help)) {
const userMention = "["+msg.from.first_name+"](tg://user?id="+msg.from.id+")"
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Asked for help"); logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Asked for help");
bot.sendMessage(msg.chat.id, "Hello " + msg.from.first_name + " please PM me @" + process.env.BOT_USERNAME + " and i'll try to help."); // bot.sendMessage(msg.chat.id, "Hello " + userMention + " please PM me @" + process.env.BOT_USERNAME + " and i'll try to help.", { parse_mode: "Markdown" });
// bot.sendMessage(msg.chat.id, "Hello " + userMention + " please PM me @" + username + " dmd", { parse_mode: "HTML" });
bot.sendMessage(msg.chat.id, "<a href="tg://user?id=123456789">inline mention of a user</a>" , { parse_mode: "HTML" });
}
const help_filelinked = "filelinked code";
if (msg.text.toString().toLowerCase().includes(help_filelinked)) {
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Asked for fileLinked code");
bot.sendMessage(msg.chat.id, "Hello " + msg.from.first_name + " please PM me @" + process.env.BOT_USERNAME + " and i'll help you.");
} }
const bye = "bye"; const bye = "bye";
@ -39,12 +50,19 @@ bot.on('message', (msg) => {
bot.sendMessage(msg.chat.id, "I love you too " + msg.from.first_name); bot.sendMessage(msg.chat.id, "I love you too " + msg.from.first_name);
} }
const fuck = "fuck off "; const fuuk = "fuck off ";
const fuckPlus = fuck + name.toLowerCase() const fuuckPlus = fuuk + name.toLowerCase()
if (msg.text.toString().toLowerCase().includes(fuckPlus)) { if (msg.text.toString().toLowerCase().includes(fuuckPlus)) {
bot.sendMessage(msg.chat.id, "Fuck off yourself " + msg.from.first_name + "!"); bot.sendMessage(msg.chat.id, "Fuck off yourself " + msg.from.first_name + "!");
} }
const fish = "fish";
const userMention = "["+msg.from.first_name+"](tg://user?id="+msg.from.id+")"
if (msg.text.toString().toLowerCase().includes(fish)) {
bot.sendMessage(msg.chat.id, test, { parse_mode: "Markdown" });
}
const deal = "deal"; const deal = "deal";
// const id = 434187971 // const id = 434187971
if (msg.text.toString().toLowerCase().match(/\bdeal\b/)) { if (msg.text.toString().toLowerCase().match(/\bdeal\b/)) {
@ -237,6 +255,7 @@ bot.on('message', (msg) => {
}), }),
bot.onText(/^(\/start|\/help|- Home)$/, (msg) => { bot.onText(/^(\/start|\/help|- Home)$/, (msg) => {
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Started a Chat with me");
bot.sendMessage(msg.chat.id, "I'm " + name).then(() => { 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, "I'm the " + channel + " Bot, and can answer your questions").then(() => {
return bot.sendMessage(msg.chat.id, "Please use the buttons below to navigate", { return bot.sendMessage(msg.chat.id, "Please use the buttons below to navigate", {