furry and gay added + Code fixes

This commit is contained in:
Lucas Gabriel 2024-05-31 17:40:29 -03:00
parent 419575ebf7
commit 009881efc2
No known key found for this signature in database
GPG Key ID: D9B075FC6DC93985
5 changed files with 56 additions and 4 deletions

View File

@ -13,20 +13,20 @@ module.exports = function(bot, msg) {
isForumOutput = "This chat is a forum (has topics enabled)"; isForumOutput = "This chat is a forum (has topics enabled)";
} else { } 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) { if (chatHandle) {
chatHandleOutput = `Chat handle: @${chatHandle}`; chatHandleOutput = `Chat handle: @${chatHandle}`;
} else { } 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 returns undefined, the chat is not a group or channel
if (chatName) { if (chatName) {
chatNameOutput = `Chat name: ${chatName}\n${chatHandleOutput}\nChat ID: ${chatId}\n\n${isForumOutput}`; chatNameOutput = `Chat name: ${chatName}\n${chatHandleOutput}\nChat ID: ${chatId}\n\n${isForumOutput}`;
} else { } else {
chatNameOutput = `Whoops!\nThis command doesn't work in PM.` chatNameOutput = `Whoops!\nThis command doesn't work in PM.`
} };
const message = chatNameOutput; const message = chatNameOutput;

24
src/commands/furry.js Normal file
View File

@ -0,0 +1,24 @@
module.exports = function(bot, msg) {
const chatId = msg.chat.id;
const userName = msg.from.first_name;
const userId = msg.from.id;
let isFurry = "";
function getRandomInt(max) {
return Math.floor(Math.random() * max);
}
const randomValue = getRandomInt(2);
if (randomValue === 0) {
isFurry = `${userName} is not furry`;
} else {
isFurry = `${userName} is a furry.`;
}
const message = `${isFurry}`;
bot.sendMessage(chatId, message)
.catch(error => console.error('ERROR: Message cannot be sent:', error));
console.log(`INFO: /furry executed by ${userName}, ${userId}`)
}

24
src/commands/gay.js Normal file
View File

@ -0,0 +1,24 @@
module.exports = function(bot, msg) {
const chatId = msg.chat.id;
const userName = msg.from.first_name;
const userId = msg.from.id;
let isGay = "";
function getRandomInt(max) {
return Math.floor(Math.random() * max);
}
const randomValue = getRandomInt(2);
if (randomValue === 0) {
isGay = `${userName} is not gay.`;
} else {
isGay = `${userName} is a gay.`;
}
const message = `${isGay}`;
bot.sendMessage(chatId, message)
.catch(error => console.error('ERROR: Message cannot be sent:', error));
console.log(`INFO: /gay executed by ${userName}, ${userId}`)
}

View File

@ -12,7 +12,7 @@ module.exports = function(bot, msg) {
userPremiumOutput = "You have a Telegram Premium subscription."; userPremiumOutput = "You have a Telegram Premium subscription.";
} else { } else {
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}`; 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}`;

View File

@ -21,5 +21,9 @@ bot.on('message', (msg) => {
} }
}); });
bot.on('polling_error', (error) => {
console.error('Polling error:', error);
});
const date = Date(); const date = Date();
console.log(`INFO: Lynx started at ${date}\n`) console.log(`INFO: Lynx started at ${date}\n`)