From d456dbd5bcd601b39bdeb598a15a71d1a986c9f1 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 4 Aug 2020 13:33:07 +0800 Subject: [PATCH] update lsp --- worker/lsp.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/worker/lsp.py b/worker/lsp.py index e649d5d..990200a 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -14,8 +14,13 @@ class Ans(StdAns): if len(self.parms) < 2: try: 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'] - 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: print(e) msg = '什么东西坏掉了,大概是Pixiv吧...不可能是咱!' @@ -30,7 +35,7 @@ class Ans(StdAns): try: resp = requests.get(url=url,params=params).json() 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' : msg = '[CQ:image,file=' + picurl + ']' @@ -38,5 +43,5 @@ class Ans(StdAns): # msg = picurl.replace('https://i.pixiv.cat', 'https://original.img.cheerfun.dev') except Exception as 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