Username check in whois

This commit is contained in:
Lucas Gabriel 2024-06-01 22:47:36 +00:00
parent 6c4b708242
commit 0753ecd173

View File

@ -6,6 +6,7 @@ module.exports = function(bot, msg) {
const isBot = msg.from.is_bot;
const userPremium = msg.from.is_premium;
const userLang = msg.from.language_code;
let haveUsername = "";
let userPremiumOutput = "";
if (userPremium) {
@ -14,7 +15,13 @@ module.exports = function(bot, msg) {
userPremiumOutput = "You don't have a Telegram Premium subscription.";
};
const message = `Your name is: ${userName}\nYour username is: @${userHandle}\nYour ID is: ${userId}\nYou are a bot: ${isBot}\nYour language: ${userLang}\n\n${userPremiumOutput}`;
if (userHandle) {
haveUsername = `Your username is: @${userHandle}`;
} else {
haveUsername = "Your username is: none";
};
const message = `Your name is: ${userName}\n${haveUsername}\nYour ID is: ${userId}\nYou are a bot: ${isBot}\nYour language: ${userLang}\n\n${userPremiumOutput}`;
bot.sendMessage(chatId, message)
.catch(error => console.error('ERROR: Message cannot be sent:', error));