Implemented SpamWatch blocklist

This commit is contained in:
Lucas Gabriel 2024-06-02 22:01:52 +00:00
parent 1bc99afe87
commit 0cdcc28d3e
5 changed files with 46 additions and 2 deletions

View file

@ -4,6 +4,7 @@ const path = require('path');
const token = process.env.TGBOT_TOKEN;
const bot = new TelegramBot(token, { polling: true });
const { isBlocked } = require('./blocklist');
const { isOnSpamWatch } = require('./blocklist');
require('./logger');
const commandsPath = path.join(__dirname, 'commands');
@ -21,7 +22,7 @@ bot.on('message', (msg) => {
const messageText = msg.text;
if (msg.chat.type == 'private') {
if (isBlocked(userId)) {
if (isBlocked(userId) || isOnSpamWatch(userId)) {
console.log(`WARN: Blocked user ${userName}, ${userId} tried to access the bot with the command or message "${messageText}".\n`);
return;
}