update
This commit is contained in:
parent
d941f32194
commit
643f2545ba
1 changed files with 11 additions and 5 deletions
|
@ -10,15 +10,21 @@ class Ans(StdAns):
|
|||
204097403,138966354]
|
||||
|
||||
def GETMSG(self):
|
||||
if self.parms[-1] == 'p':
|
||||
flash = ''
|
||||
self.parms = self.parms[0:-1]
|
||||
else:
|
||||
flash = ',type=flash'
|
||||
|
||||
if len(self.parms) == 1:
|
||||
code, picurl = getsetu()
|
||||
code, picurl, pid = getsetu()
|
||||
else:
|
||||
keyword = self.parms[1]
|
||||
if mysakuya(self, keyword) == False:
|
||||
return "不许你们看咲夜的涩图!!"
|
||||
code, picurl = getsetu(keyword)
|
||||
code, picurl, pid = getsetu(keyword)
|
||||
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:
|
||||
return f'[CQ:reply,id={self.mid}] 什么东西出错了,code:{code}'
|
||||
|
||||
|
@ -33,10 +39,10 @@ def getsetu(keyword=''):
|
|||
try:
|
||||
resp = requests.get(url=url, params=params, timeout=5).json()
|
||||
except:
|
||||
return 500, ''
|
||||
return 500, '',0
|
||||
|
||||
picurl = ''
|
||||
if resp['code'] == 0:
|
||||
picurl = "https://r.zjuyk.site/" + resp['data'][0]['url']
|
||||
|
||||
return resp['code'], picurl
|
||||
return resp['code'], picurl, resp['data'][0]['pid']
|
||||
|
|
Loading…
Reference in a new issue