hashing images correctly?

This commit is contained in:
bakatrouble 2020-05-25 17:26:55 +03:00
parent b4513267ca
commit 563389ad36

View File

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