mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-03-10 21:00:03 +00:00
Username check in whois
This commit is contained in:
parent
6c4b708242
commit
0753ecd173
@ -6,6 +6,7 @@ module.exports = function(bot, msg) {
|
|||||||
const isBot = msg.from.is_bot;
|
const isBot = msg.from.is_bot;
|
||||||
const userPremium = msg.from.is_premium;
|
const userPremium = msg.from.is_premium;
|
||||||
const userLang = msg.from.language_code;
|
const userLang = msg.from.language_code;
|
||||||
|
let haveUsername = "";
|
||||||
let userPremiumOutput = "";
|
let userPremiumOutput = "";
|
||||||
|
|
||||||
if (userPremium) {
|
if (userPremium) {
|
||||||
@ -14,7 +15,13 @@ module.exports = function(bot, msg) {
|
|||||||
userPremiumOutput = "You don't have a Telegram Premium subscription.";
|
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)
|
bot.sendMessage(chatId, message)
|
||||||
.catch(error => console.error('ERROR: Message cannot be sent:', error));
|
.catch(error => console.error('ERROR: Message cannot be sent:', error));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user