diff --git a/src/commands/chatinfo.js b/src/commands/chatinfo.js index a1b4ab0..eabf24f 100644 --- a/src/commands/chatinfo.js +++ b/src/commands/chatinfo.js @@ -13,20 +13,20 @@ module.exports = function(bot, msg) { isForumOutput = "This chat is a forum (has topics enabled)"; } else { isForumOutput = "This chat is not a forum (doesn't have topics enabled)"; - } + }; if (chatHandle) { chatHandleOutput = `Chat handle: @${chatHandle}`; } else { 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}`; } else { chatNameOutput = `Whoops!\nThis command doesn't work in PM.` - } + }; const message = chatNameOutput; diff --git a/src/commands/furry.js b/src/commands/furry.js new file mode 100644 index 0000000..4c5a620 --- /dev/null +++ b/src/commands/furry.js @@ -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}`) +} \ No newline at end of file diff --git a/src/commands/gay.js b/src/commands/gay.js new file mode 100644 index 0000000..4b9a245 --- /dev/null +++ b/src/commands/gay.js @@ -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}`) + } \ No newline at end of file diff --git a/src/commands/whois.js b/src/commands/whois.js index b043010..8bea5b7 100644 --- a/src/commands/whois.js +++ b/src/commands/whois.js @@ -12,7 +12,7 @@ module.exports = function(bot, msg) { userPremiumOutput = "You have a Telegram Premium subscription."; } else { 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}`; diff --git a/src/main.js b/src/main.js index f9e667c..97f7547 100644 --- a/src/main.js +++ b/src/main.js @@ -21,5 +21,9 @@ bot.on('message', (msg) => { } }); +bot.on('polling_error', (error) => { + console.error('Polling error:', error); +}); + const date = Date(); console.log(`INFO: Lynx started at ${date}\n`) \ No newline at end of file