changes to welcome stuff

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

35
app.js
View File

@ -3,7 +3,7 @@ require('dotenv').config();
const logger = require('perfect-logger');
const TelegramBot = require('node-telegram-bot-api');
// Configure Settings
logger.initialize('FrontEndDriver', {
logLevelFile: 0, // Log level for file
@ -15,6 +15,8 @@ logger.initialize('FrontEndDriver', {
const token = process.env.BOT_TOKEN;
const name = process.env.BOT_NAME;
const channel = process.env.CHANNEL
const username = process.env.BOT_USERNAME;
const bot = new TelegramBot(token, {
polling: true
@ -24,8 +26,17 @@ bot.on('message', (msg) => {
const help = "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");
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";
@ -39,16 +50,23 @@ bot.on('message', (msg) => {
bot.sendMessage(msg.chat.id, "I love you too " + msg.from.first_name);
}
const fuck = "fuck off ";
const fuckPlus = fuck + name.toLowerCase()
if (msg.text.toString().toLowerCase().includes(fuckPlus)) {
const fuuk = "fuck off ";
const fuuckPlus = fuuk + name.toLowerCase()
if (msg.text.toString().toLowerCase().includes(fuuckPlus)) {
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 id = 434187971
if (msg.text.toString().toLowerCase().match(/\bdeal\b/)){
bot.sendMessage(msg.chat.id, "I LOVE it when " + msg.from.first_name + ", does a deal :)");
if (msg.text.toString().toLowerCase().match(/\bdeal\b/)) {
bot.sendMessage(msg.chat.id, "I LOVE it when " + msg.from.first_name + ", does a deal :)");
}
const subPrice = "- subscription prices";
@ -237,6 +255,7 @@ bot.on('message', (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(() => {
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", {