calculate image hash for images sent in chat

This commit is contained in:
2022-12-06 13:13:46 +03:00
parent ed7035b74e
commit d1fa23e399
4 changed files with 512 additions and 299 deletions

View File

@@ -98,7 +98,8 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig):
io.name = 'file.jpg'
bot.get_file(p[-1]).download(out=io)
im = Image.open(io)
if self.queued_items.filter(image_hash=imagehash.phash(im), type='photo').count() > 0:
i.image_hash = imagehash.phash(im)
if self.queued_items.filter(image_hash=i.image_hash, type='photo').count() > 0:
return
elif hasattr(m, 'sticker') and m.sticker:
s = m.sticker