direct mentions

This commit is contained in:
karl.hudgell 2020-06-22 12:28:44 +01:00
parent 642fd7ccde
commit 28d5f3243a

21
app.js
View File

@ -26,17 +26,16 @@ 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+")" const userMention = "<a href=\"tg:\/\/user?id=" + msg.from.id + "\">@" + msg.from.first_name + "<\/a>"
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 " + 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 @" + process.env.BOT_USERNAME + " and i'll try to help.", { parse_mode: "HTML" });
// 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"; const help_filelinked = "filelinked code";
if (msg.text.toString().toLowerCase().includes(help_filelinked)) { if (msg.text.toString().toLowerCase().includes(help_filelinked)) {
const userMention = "<a href=\"tg:\/\/user?id=" + msg.from.id + "\">@" + msg.from.first_name + "<\/a>"
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Asked for fileLinked code"); 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."); bot.sendMessage(msg.chat.id, "Hello " + userMention + " please PM me @" + process.env.BOT_USERNAME + " and i'll give you the code");
} }
const bye = "bye"; const bye = "bye";
@ -60,11 +59,19 @@ bot.on('message', (msg) => {
const userMention = "[" + msg.from.first_name + "](tg://user?id=" + msg.from.id + ")" const userMention = "[" + msg.from.first_name + "](tg://user?id=" + msg.from.id + ")"
if (msg.text.toString().toLowerCase().includes(fish)) { if (msg.text.toString().toLowerCase().includes(fish)) {
bot.sendMessage(msg.chat.id, test, { parse_mode: "Markdown" }); bot.sendMessage(msg.chat.id, userMention, { parse_mode: "Markdown" });
}
const whatSubShouldIBuy = "what sub should i buy?"
const subs = ["VIP!", "Premium Plus!", "Old Premium!", "Gold!", "Bronze!", "New Premium!", "KDB!", "Technoid!", "Bluemoon!", "SOL!", "Gambler!", "All of em!"]
if (msg.text.toString().toLowerCase().includes(whatSubShouldIBuy)) {
const randomSub = subs[Math.floor(Math.random() * subs.length)];
bot.sendMessage(msg.chat.id, randomSub);
} }
const deal = "deal"; const deal = "deal";
// const id = 434187971 const me = 434187971
const sarah = 868225940
if (msg.text.toString().toLowerCase().match(/\bdeal\b/)) { if (msg.text.toString().toLowerCase().match(/\bdeal\b/)) {
bot.sendMessage(msg.chat.id, "I LOVE it when " + msg.from.first_name + ", does a deal :)"); bot.sendMessage(msg.chat.id, "I LOVE it when " + msg.from.first_name + ", does a deal :)");
} }