回滚 router ,提升稳定性

This commit is contained in:
SiHuan 2020-08-11 10:24:28 +08:00
parent e825c07a9e
commit b89fef264e

View file

@ -1,27 +1,8 @@
from worker import emmm from worker import emmm
from zzcore import DM
from config import DAAPI
import requests
def ZZRouter(data): def ZZRouter(data):
if data['post_type'] != 'message' or data['message_type'] != 'group' or data['message'][0] != '/': if data['post_type'] != 'message' or data['message_type'] != 'group' or data['message'][0] != '/':
if data['user_id'] == 1318000868 :
return
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 return
uid = data['user_id'] uid = data['user_id']