From 8cd2f32624bb5dd3effbd9f212cbc559efc19195 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 3 Aug 2020 23:17:56 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E8=B0=81=E5=85=88=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- route.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/route.py b/route.py index f1f1d2a..751b5e0 100644 --- a/route.py +++ b/route.py @@ -1,14 +1,23 @@ from worker import emmm from zzcore import DM +from config import DAAPI def ZZRouter(data): - if ('[CQ:image,file=a854b2390d427b02fc26cae49d508a75.image]' in data['raw_message'] or '[CQ:image,file=6a507d12d1542cbed37af4776a1cd066.image]' in data['raw_message']) and data['user_id'] != 1318000868: - DM(data['message_id']) - - if data['post_type'] != 'message' or data['message_type'] != 'group' or data['message'][0] != '/': + if len(data['raw_message']) == 54 and data['raw_message'][:15] == '[CQ:image,file=': # use re + url = data['message'][58:][:-1] + r = requests.post( + "https://api.deepai.org/api/image-similarity", + data={ + 'image1': 'https://img.vim-cn.com/fa/4a7f3996e3601e98bd3c1b245fcb88e05f32ec.jpg', + 'image2': url, + }, + headers={'api-key': DAAPI} + ) + if r.json()['output']['distance'] < 10: + DM(data['message_id']) return uid = data['user_id']