mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-03-10 21:00:03 +00:00
Markdown formatting + some fixes
This commit is contained in:
parent
1ec0af7cdb
commit
57154bcb70
@ -1,11 +0,0 @@
|
||||
module.exports = function(bot, msg) {
|
||||
const chatId = msg.chat.id;
|
||||
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 sent:', error));
|
||||
console.log(`INFO: /start executed by ${userName}, ${userId}`)
|
||||
}
|
@ -10,27 +10,27 @@ module.exports = function(bot, msg) {
|
||||
let isForumOutput = "";
|
||||
|
||||
if (isForum) {
|
||||
isForumOutput = "This chat is a forum (has topics enabled)";
|
||||
isForumOutput = "*This chat is a forum (has topics enabled).*";
|
||||
} else {
|
||||
isForumOutput = "This chat is not a forum (doesn't have topics enabled)";
|
||||
};
|
||||
isForumOutput = "*This chat is not a forum (doesn't have topics enabled).*";
|
||||
}
|
||||
|
||||
if (chatHandle) {
|
||||
chatHandleOutput = `Chat handle: @${chatHandle}`;
|
||||
chatHandleOutput = `*Chat handle:* @${chatHandle}`;
|
||||
} else {
|
||||
chatHandleOutput = `Chat handle: none (private group)`;
|
||||
};
|
||||
chatHandleOutput = `*Chat handle:* none (private group)`;
|
||||
}
|
||||
|
||||
// if chatName returns undefined, the chat is not a group or channel
|
||||
if (chatName) {
|
||||
chatNameOutput = `Chat name: ${chatName}\n${chatHandleOutput}\nChat ID: ${chatId}\n\n${isForumOutput}`;
|
||||
chatNameOutput = `*Chat name:* ${chatName}\n${chatHandleOutput}\n*Chat ID:* ${chatId}\n\n${isForumOutput}`;
|
||||
} else {
|
||||
chatNameOutput = `Whoops!\nThis command doesn't work in PM.`
|
||||
};
|
||||
chatNameOutput = "Whoops!\nThis command doesn't work in PM.";
|
||||
}
|
||||
|
||||
const message = chatNameOutput;
|
||||
|
||||
bot.sendMessage(chatId, message)
|
||||
bot.sendMessage(chatId, message, { parse_mode: 'Markdown' })
|
||||
.catch(error => console.error('ERROR: Message cannot be sent:', error));
|
||||
console.log(`INFO: /chatinfo executed by ${userName}, ${userId}`);
|
||||
}
|
||||
}
|
||||
|
@ -6,19 +6,19 @@ module.exports = function(bot, msg) {
|
||||
|
||||
function getRandomInt(max) {
|
||||
return Math.floor(Math.random() * max);
|
||||
};
|
||||
}
|
||||
|
||||
const randomValue = getRandomInt(2);
|
||||
|
||||
if (randomValue === 0) {
|
||||
isFurry = `You (${userName}) are not a furry.`;
|
||||
isFurry = `*You (${userName}) are not a furry.*`;
|
||||
} else {
|
||||
isFurry = `Yes, you (${userName}) are a furry.`;
|
||||
};
|
||||
isFurry = `*Yes, you (${userName}) are a furry.*`;
|
||||
}
|
||||
|
||||
const message = `${isFurry}`;
|
||||
|
||||
bot.sendMessage(chatId, message)
|
||||
bot.sendMessage(chatId, message, { parse_mode: 'Markdown' })
|
||||
.catch(error => console.error('ERROR: Message cannot be sent:', error));
|
||||
console.log(`INFO: /furry executed by ${userName}, ${userId}`)
|
||||
}
|
||||
console.log(`INFO: /furry executed by ${userName}, ${userId}`);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
module.exports = function (bot, msg) {
|
||||
module.exports = function(bot, msg) {
|
||||
const chatId = msg.chat.id;
|
||||
const userName = msg.from.first_name;
|
||||
const userId = msg.from.id;
|
||||
@ -6,19 +6,19 @@ module.exports = function (bot, msg) {
|
||||
|
||||
function getRandomInt(max) {
|
||||
return Math.floor(Math.random() * max);
|
||||
};
|
||||
}
|
||||
|
||||
const randomValue = getRandomInt(2);
|
||||
|
||||
if (randomValue === 0) {
|
||||
isGay = `You (${userName}) are not a gay.`;
|
||||
isGay = `*You (${userName}) are not gay.*`;
|
||||
} else {
|
||||
isGay = `Yes, you (${userName}) are a gay.`;
|
||||
};
|
||||
isGay = `*Yes, you (${userName}) are gay.*`;
|
||||
}
|
||||
|
||||
const message = `${isGay}`;
|
||||
|
||||
bot.sendMessage(chatId, message)
|
||||
bot.sendMessage(chatId, message, { parse_mode: 'Markdown' })
|
||||
.catch(error => console.error('ERROR: Message cannot be sent:', error));
|
||||
console.log(`INFO: /gay executed by ${userName}, ${userId}`)
|
||||
}
|
||||
console.log(`INFO: /gay executed by ${userName}, ${userId}`);
|
||||
}
|
||||
|
@ -2,18 +2,21 @@ module.exports = function(bot, msg) {
|
||||
const chatId = msg.chat.id;
|
||||
const userName = msg.from.first_name;
|
||||
const userId = msg.from.id;
|
||||
const lynxPhoto = 'https://graph.org/file/a77382dab4d62ba626806.jpg'
|
||||
const lynxFullPhoto = 'https://graph.org/file/a77382dab4d62ba626806.jpg';
|
||||
|
||||
const message = `Hi! I am Lynx!\nI am a simple bot made entirely from scratch in Node.js by Lucas Gabriel (lucmsilva).\n\nSome commands to test:
|
||||
• /start: start the bot
|
||||
• /help: send this message
|
||||
• /whois: send some information about yourself
|
||||
• /chatinfo: send some information about the group
|
||||
• /furry: check if you are a furry
|
||||
• /gay: check if you are a gay\n\nSee my source code in:
|
||||
• https://github.com/lucmsilva651/lynx.\n\nThanks to all users, testers, contributors, and others. Without you, perhaps this bot wouldn't be possible ❤️`;
|
||||
const message = `*Hello! I'm Lynx!*\n\nI'm a simple bot made entirely from scratch in Node.js by Lucas Gabriel (lucmsilva).\n\n` +
|
||||
`I might be running on a GitHub Codespaces server (see /stats), so please refrain from overusing or spamming the bot!\n\n` +
|
||||
`*Some commands to test*:
|
||||
• */start*: start the bot
|
||||
• */help*: send this message
|
||||
• */whois*: send some information about yourself
|
||||
• */chatinfo*: send some information about the group
|
||||
• */furry*: check if you are a furry
|
||||
• */gay*: check if you are gay\n\n` +
|
||||
`*See my source code in:* [GitHub Repository](https://github.com/lucmsilva651/lynx)\n\n` +
|
||||
`Thanks to all users, testers, contributors, and others. Without you, perhaps this bot wouldn't be possible ❤️`;
|
||||
|
||||
bot.sendPhoto(chatId, lynxPhoto, { caption: message })
|
||||
.catch(error => console.error('ERROR: Message cannot be send:', error));
|
||||
bot.sendPhoto(chatId, lynxFullPhoto, { caption: message, parse_mode: 'Markdown' })
|
||||
.catch(error => console.error('ERROR: Message cannot be sent:', error));
|
||||
console.log(`INFO: /help executed by ${userName}, ${userId}`);
|
||||
}
|
||||
|
@ -2,10 +2,11 @@ module.exports = function(bot, msg) {
|
||||
const chatId = msg.chat.id;
|
||||
const userName = msg.from.first_name;
|
||||
const userId = msg.from.id;
|
||||
const lynxProfilePhoto = 'https://graph.org/file/10452df450f13ffb968c5.jpg';
|
||||
|
||||
const message = `Hello! I am Lynx!\nI was made with love by Lucas Gabriel (lucmsilva)!\n\nSee /help for the bot commands!`
|
||||
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)
|
||||
bot.sendPhoto(chatId, lynxProfilePhoto, { caption: message, parse_mode: 'Markdown' } )
|
||||
.catch(error => console.error('ERROR: Message cannot be sent:', error));
|
||||
console.log(`INFO: /start executed by ${userName}, ${userId}`)
|
||||
}
|
||||
console.log(`INFO: /start executed by ${userName}, ${userId}`);
|
||||
}
|
||||
|
@ -10,20 +10,20 @@ module.exports = function(bot, msg) {
|
||||
let userPremiumOutput = "";
|
||||
|
||||
if (userPremium) {
|
||||
userPremiumOutput = "You have a Telegram Premium subscription.";
|
||||
userPremiumOutput = "*You have a Telegram Premium subscription.*";
|
||||
} else {
|
||||
userPremiumOutput = "You don't have a Telegram Premium subscription.";
|
||||
};
|
||||
userPremiumOutput = "*You don't have a Telegram Premium subscription.*";
|
||||
}
|
||||
|
||||
if (userHandle) {
|
||||
haveUsername = `Your username is: @${userHandle}`;
|
||||
haveUsername = `*Your username is:* @${userHandle}`;
|
||||
} else {
|
||||
haveUsername = "Your username is: none";
|
||||
};
|
||||
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}`;
|
||||
const message = `*Your name is:* ${userName}\n${haveUsername}\n*Your ID is:* ${userId}\n*You are a bot:* ${isBot}\n*Your language:* ${userLang}\n\n${userPremiumOutput}`;
|
||||
|
||||
bot.sendMessage(chatId, message)
|
||||
bot.sendMessage(chatId, message, { parse_mode: 'Markdown' })
|
||||
.catch(error => console.error('ERROR: Message cannot be sent:', error));
|
||||
console.log(`INFO: /whois executed by ${userName}, ${userId}`)
|
||||
}
|
||||
console.log(`INFO: /whois executed by ${userName}, ${userId}`);
|
||||
}
|
||||
|
@ -26,4 +26,4 @@ bot.on('polling_error', (error) => {
|
||||
});
|
||||
|
||||
const date = Date();
|
||||
console.log(`INFO: Lynx started at ${date}\n`)
|
||||
console.log(`INFO: Lynx started at: \n• ${date}\n`)
|
Loading…
x
Reference in New Issue
Block a user