mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-03-10 21:00:03 +00:00
Fixed message collecting
This commit is contained in:
parent
2f65126319
commit
70d12b0f73
13
main.js
13
main.js
@ -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) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user