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
7
main.js
7
main.js
@ -20,17 +20,18 @@ bot.on('message', (msg) => {
|
|||||||
const userId = msg.from.id;
|
const userId = msg.from.id;
|
||||||
const messageText = msg.text;
|
const messageText = msg.text;
|
||||||
|
|
||||||
|
if (msg.chat.type == 'private') {
|
||||||
if (isBlocked(userId)) {
|
if (isBlocked(userId)) {
|
||||||
console.log(`WARN: Blocked user ${userName}, ${userId} tried to access the bot with the command or message "${messageText}".\n`);
|
console.log(`WARN: Blocked user ${userName}, ${userId} tried to access the bot with the command or message "${messageText}".\n`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log(`INFO: User ${userName}, ${userId} sended a command or message with the content:
|
||||||
|
• ${messageText}\n`)
|
||||||
|
}
|
||||||
|
|
||||||
if (commandHandlers[messageText]) {
|
if (commandHandlers[messageText]) {
|
||||||
commandHandlers[messageText](bot, msg);
|
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) => {
|
bot.on('polling_error', (error) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user