From 563389ad36a6c347dfec83d51c34a329e56ff372 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Mon, 25 May 2020 17:26:55 +0300 Subject: [PATCH] hashing images correctly? --- main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 = []