mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-04-29 09:25:58 +00:00
Push some updates on start + whois added
This commit is contained in:
parent
c67df9f865
commit
8d34495256
@ -1,6 +1,12 @@
|
|||||||
// start command handler
|
// start command handler
|
||||||
module.exports = function(bot, msg) {
|
module.exports = function(bot, msg) {
|
||||||
const chatId = msg.chat.id;
|
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")
|
const userName = msg.from.first_name;
|
||||||
console.log("INFO: /start executed.")
|
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
19
src/commands/whois.js
Normal 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}`)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user