This commit is contained in:
SiHuan 2021-08-12 19:01:29 +08:00
parent d941f32194
commit 643f2545ba
No known key found for this signature in database
GPG key ID: A047C9783A4C18AA

View file

@ -10,15 +10,21 @@ class Ans(StdAns):
204097403,138966354] 204097403,138966354]
def GETMSG(self): def GETMSG(self):
if self.parms[-1] == 'p':
flash = ''
self.parms = self.parms[0:-1]
else:
flash = ',type=flash'
if len(self.parms) == 1: if len(self.parms) == 1:
code, picurl = getsetu() code, picurl, pid = getsetu()
else: else:
keyword = self.parms[1] keyword = self.parms[1]
if mysakuya(self, keyword) == False: if mysakuya(self, keyword) == False:
return "不许你们看咲夜的涩图!!" return "不许你们看咲夜的涩图!!"
code, picurl = getsetu(keyword) code, picurl, pid = getsetu(keyword)
if code == 0: if code == 0:
return f'[CQ:reply,id={self.mid}][CQ:image,file={picurl},type=flash]' return f'[CQ:image,file={picurl}{flash}]Pixiv ID:{pid}'
else: else:
return f'[CQ:reply,id={self.mid}] 什么东西出错了code:{code}' return f'[CQ:reply,id={self.mid}] 什么东西出错了code:{code}'
@ -33,10 +39,10 @@ def getsetu(keyword=''):
try: try:
resp = requests.get(url=url, params=params, timeout=5).json() resp = requests.get(url=url, params=params, timeout=5).json()
except: except:
return 500, '' return 500, '',0
picurl = '' picurl = ''
if resp['code'] == 0: if resp['code'] == 0:
picurl = "https://r.zjuyk.site/" + resp['data'][0]['url'] picurl = "https://r.zjuyk.site/" + resp['data'][0]['url']
return resp['code'], picurl return resp['code'], picurl, resp['data'][0]['pid']