diff --git a/main.py b/main.py index 77d6adc..f3f2b6c 100755 --- a/main.py +++ b/main.py @@ -17,7 +17,7 @@ from redis import Redis from telegram.error import Unauthorized, TelegramError from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackQueryHandler, CallbackContext from telegram import Message, Update, Bot, InlineKeyboardMarkup, InlineKeyboardButton, User, InputMediaPhoto, \ - InputMediaVideo, InputMediaAnimation, InputMediaAudio, InputMediaDocument + InputMediaVideo, InputMediaAnimation, InputMediaAudio, InputMediaDocument, PhotoSize from config import BOT_TOKEN, SENTRY_DSN, MANAGEMENT_CHAT, DEBUG from db import get_conn, Subscriber, commit @@ -280,6 +280,7 @@ def _process_message(bot: Bot, m: Message): func = None args = [] + hash_args = None kwargs = {} if m.forward_date: func = m.forward @@ -297,6 +298,7 @@ def _process_message(bot: Bot, m: Message): p = m.photo func = bot.send_photo args = [p[-1].file_id, caption] + hash_args = [p[-1].file_unique_id, caption] kwargs = dict(parse_mode='html') elif hasattr(m, 'sticker') and m.sticker: s = m.sticker @@ -333,7 +335,7 @@ def _process_message(bot: Bot, m: Message): func = bot.send_message args = [text, 'html'] - if not _antispam(args): + if not _antispam(hash_args or args): return m.reply_text('Не вайпи', quote=True) remove_uids = []