Push some updates on start + whois added

This commit is contained in:
Lucas Gabriel 2024-05-24 20:08:22 -03:00
parent c67df9f865
commit 8d34495256
No known key found for this signature in database
GPG Key ID: D9B075FC6DC93985
2 changed files with 27 additions and 2 deletions

View File

@ -1,6 +1,12 @@
// start command handler
module.exports = function(bot, msg) {
const chatId = msg.chat.id;
bot.sendMessage(chatId, "Welcome to Lynx!\n\nI was made with love by Lucas Gabriel (lucmsilva)!\n\nCheck out my source code:\nhttps://github.com/lucmsilva651/lynx")
console.log("INFO: /start executed.")
const userName = msg.from.first_name;
const userId = msg.from.id;
const message = `Hello! I am Lynx!\nI was made with love by Lucas Gabriel (lucmsilva)!\n\nSee /help for the bot commands!`
bot.sendMessage(chatId, message)
.catch(error => console.error('ERROR: Message cannot be send:', error));
console.log(`INFO: /start executed by ${userName}, ${userId}`)
}

19
src/commands/whois.js Normal file
View File

@ -0,0 +1,19 @@
module.exports = function(bot, msg) {
const chatId = msg.chat.id;
const userName = msg.from.first_name;
const userId = msg.from.id;
const userHandle = msg.from.username;
const isBot = msg.from.is_bot;
const userPremium = msg.from.is_premium;
const userPremiumOutput = "";
if (userPremium == "true") {
const userPremiumOutput = "\n\nYou have a Telegram Premium subscription.";
}
const message = `Your name is: ${userName}\nYour username is: ${userHandle}\nYour ID is: ${userId}\nYou are a bot: ${isBot}` + userPremiumOutput;
bot.sendMessage(chatId, message)
.catch(error => console.error('ERROR: Message cannot be send:', error));
console.log(`INFO: /whois executed by ${userName}, ${userId}`)
}