2024-05-24 20:08:22 -03:00
|
|
|
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;
|
2024-05-24 20:57:44 -03:00
|
|
|
let userPremiumOutput = "";
|
|
|
|
|
|
|
|
if (userPremium) {
|
|
|
|
userPremiumOutput = "You have a Telegram Premium subscription.";
|
|
|
|
} else {
|
|
|
|
userPremiumOutput = "You don't have a Telegram Premium subscription.";
|
2024-05-24 20:08:22 -03:00
|
|
|
}
|
|
|
|
|
2024-05-24 20:57:44 -03:00
|
|
|
const message = `Your name is: ${userName}\nYour username is: ${userHandle}\nYour ID is: ${userId}\nYou are a bot: ${isBot}\n\n${userPremiumOutput}`;
|
|
|
|
|
2024-05-24 20:08:22 -03:00
|
|
|
bot.sendMessage(chatId, message)
|
|
|
|
.catch(error => console.error('ERROR: Message cannot be send:', error));
|
|
|
|
console.log(`INFO: /whois executed by ${userName}, ${userId}`)
|
|
|
|
}
|