update lsp

This commit is contained in:
SiHuan 2020-08-04 13:33:07 +08:00
parent 4d6fb1fcee
commit d456dbd5bc

View file

@ -14,8 +14,13 @@ class Ans(StdAns):
if len(self.parms) < 2: if len(self.parms) < 2:
try: try:
resp = requests.get(url=url,params=params).json() resp = requests.get(url=url,params=params).json()
quota = str(resp['quota'])
seconds = resp['quota_min_ttl']
m, s = divmod(seconds, 60)
h, m = divmod(m, 60)
quota_min_ttl = f'{h}{m}{s}'
picurl = resp['data'][0]['url'] picurl = resp['data'][0]['url']
msg = picurl msg = f"[CQ:reply,id={self.raw_msg['message_id']}][CQ:image,file={picurl}]\n剩余次数 {quota}\n距离回复元气 {quota_min_ttl}"
except Exception as e: except Exception as e:
print(e) print(e)
msg = '什么东西坏掉了,大概是Pixiv吧...不可能是咱!' msg = '什么东西坏掉了,大概是Pixiv吧...不可能是咱!'
@ -30,7 +35,7 @@ class Ans(StdAns):
try: try:
resp = requests.get(url=url,params=params).json() resp = requests.get(url=url,params=params).json()
picurl = resp['data'][0]['url'] picurl = resp['data'][0]['url']
msg = '[CQ:at,qq=' + str(self.uid) + ']' + '咱帮你🔍 ' + keyword + ' 找到了这个\n' + picurl msg = '[CQ:reply,id=' + str(self.raw_msg['message_id']) + ']' + '咱帮你🔍 ' + keyword + ' 找到了这个\n' + picurl
if len(self.parms) > 2 and self.parms[2] == 'p' : if len(self.parms) > 2 and self.parms[2] == 'p' :
msg = '[CQ:image,file=' + picurl + ']' msg = '[CQ:image,file=' + picurl + ']'
@ -38,5 +43,5 @@ class Ans(StdAns):
# msg = picurl.replace('https://i.pixiv.cat', 'https://original.img.cheerfun.dev') # msg = picurl.replace('https://i.pixiv.cat', 'https://original.img.cheerfun.dev')
except Exception as e: except Exception as e:
print(e) print(e)
msg = '[CQ:at,qq=' + str(self.uid) + ']咱没查到 ' + keyword + ' 也有可能是Pixiv坏掉了' msg = '[CQ:reply,id=' + str(self.raw_msg['message_id']) + ']咱没查到 ' + keyword + ' 也有可能是Pixiv坏掉了'
return msg return msg