|
|
|
@ -2,6 +2,7 @@ import base64
|
|
|
|
|
import json
|
|
|
|
|
import os
|
|
|
|
|
import tempfile
|
|
|
|
|
import traceback
|
|
|
|
|
from io import BytesIO
|
|
|
|
|
from uuid import uuid4
|
|
|
|
|
|
|
|
|
@ -99,8 +100,13 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig):
|
|
|
|
|
bot.get_file(p[-1]).download(out=io)
|
|
|
|
|
im = Image.open(io)
|
|
|
|
|
i.image_hash = imagehash.phash(im)
|
|
|
|
|
if self.queued_items.filter(image_hash=i.image_hash, type='photo').count() > 0:
|
|
|
|
|
update.message.reply_text('Duplicate', quote=True)
|
|
|
|
|
duplicate = self.queued_items.filter(image_hash=i.image_hash, type='photo').first()
|
|
|
|
|
if duplicate:
|
|
|
|
|
try:
|
|
|
|
|
update.message.reply_photo(json.loads(duplicate.args)[0], 'Duplicate', quote=True)
|
|
|
|
|
except:
|
|
|
|
|
traceback.print_exc()
|
|
|
|
|
update.message.reply_text('Could not send duplicate original', quote=True)
|
|
|
|
|
return
|
|
|
|
|
elif hasattr(m, 'sticker') and m.sticker:
|
|
|
|
|
s = m.sticker
|
|
|
|
|