Fixed message collecting

This commit is contained in:
Lucas Gabriel 2024-06-02 15:04:45 +00:00
parent 2f65126319
commit 70d12b0f73

13
main.js
View File

@ -20,17 +20,18 @@ bot.on('message', (msg) => {
const userId = msg.from.id;
const messageText = msg.text;
if (isBlocked(userId)) {
console.log(`WARN: Blocked user ${userName}, ${userId} tried to access the bot with the command or message "${messageText}".\n`);
return;
if (msg.chat.type == 'private') {
if (isBlocked(userId)) {
console.log(`WARN: Blocked user ${userName}, ${userId} tried to access the bot with the command or message "${messageText}".\n`);
return;
}
console.log(`INFO: User ${userName}, ${userId} sended a command or message with the content:
${messageText}\n`)
}
if (commandHandlers[messageText]) {
commandHandlers[messageText](bot, msg);
}
console.log(`INFO: User ${userName}, ${userId} sended a command or message with the content:
${messageText}\n`)
});
bot.on('polling_error', (error) => {