From 7b2090065513eb7d826bdaff1c63da650aad24b2 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 2 Mar 2020 19:54:13 +0800 Subject: [PATCH 001/240] add bbc --- worker/bbc.py | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 worker/bbc.py diff --git a/worker/bbc.py b/worker/bbc.py new file mode 100644 index 0000000..7692b3f --- /dev/null +++ b/worker/bbc.py @@ -0,0 +1,54 @@ +from zzcore import StdAns + +class Ans(StdAns): + def GETMSG(self): + if len(self.parms) < 2: + return '不加参数是坏文明!' + try: + msg = str(bc(self.raw_msg['message'][5:])) + except Exception as e: + msg = str(e) + return msg + +def bc(formula): + formula = pure(formula) + try: + return float(formula) + except ValueError: + print(subFormula(formula)) + subLift,subRight,flag = subFormula(formula) + return cal(bc(subLift),bc(subRight),flag) + +def pure(formula): + while(formula[0] == '(' or (formula[0] == '-' and formula[1] == '-')): + if formula[0] == '(': + formula == formula[1:] + else: + formula = formula[2:] + while(formula[len(formula) - 1] == ')'): + formula = formula[:len(formula) - 1] + + return formula + +def subFormula(formula): + start = 0 + if formula[0]=='-': + start = 1 + for index in range(start,len(formula)): + if formula[index] in ['*','/']: + lastxx = index + elif formula[index] == '+': + return formula[:index],formula[index+1:],'+' + elif formula[index] == '-' and formula[index-1] not in ['*','/']: + return formula[:index],formula[index:],'+' + elif formula[index] == '(': + return formula[:index-1],formula[index:],formula[index-1] + return formula[:lastxx],formula[lastxx+1:],formula[lastxx] + +def cal(f1,f2,flag): + do = { + '+':lambda x,y: x+y, + '*':lambda x,y: x*y, + '/':lambda x,y: x/y + } + return do[flag](f1,f2) \ No newline at end of file From e96d9929ac842a441d788f847099f2c17e2ba7be Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 2 Mar 2020 20:18:54 +0800 Subject: [PATCH 002/240] bbc up --- worker/bbc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/bbc.py b/worker/bbc.py index 7692b3f..b654691 100644 --- a/worker/bbc.py +++ b/worker/bbc.py @@ -22,7 +22,7 @@ def bc(formula): def pure(formula): while(formula[0] == '(' or (formula[0] == '-' and formula[1] == '-')): if formula[0] == '(': - formula == formula[1:] + formula = formula[1:] else: formula = formula[2:] while(formula[len(formula) - 1] == ')'): @@ -51,4 +51,4 @@ def cal(f1,f2,flag): '*':lambda x,y: x*y, '/':lambda x,y: x/y } - return do[flag](f1,f2) \ No newline at end of file + return do[flag](f1,f2) From b0f7d20c490d3cc615cbb77bad3a181a1c84e180 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 2 Mar 2020 20:58:29 +0800 Subject: [PATCH 003/240] add pull --- worker/pull.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 worker/pull.py diff --git a/worker/pull.py b/worker/pull.py new file mode 100644 index 0000000..30cc934 --- /dev/null +++ b/worker/pull.py @@ -0,0 +1,11 @@ +from zzcore import StdAns + +from subprocess import getoutput + +class Ans(StdAns): + AllowUser = [1318000868] + UserNotAllow = '汝不是咱的Master!' + + def GETMSG(self): + output = getoutput('git pull') + return output From e3f12ec9f5d6b978eaabd576901384b6ad53e8c2 Mon Sep 17 00:00:00 2001 From: DD6181S03 Date: Mon, 2 Mar 2020 21:15:18 +0800 Subject: [PATCH 004/240] add ip and dns lookup --- worker/ip.py | 32 ++++++++++++++++++++++++++++++++ worker/ns.py | 9 +++++++++ worker/yiyan.py | 11 +++++------ 3 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 worker/ip.py create mode 100644 worker/ns.py diff --git a/worker/ip.py b/worker/ip.py new file mode 100644 index 0000000..67cdc29 --- /dev/null +++ b/worker/ip.py @@ -0,0 +1,32 @@ +from zzcore import StdAns +import requests + +class Ans(StdAns): + def GETMSG(self): + try: + ip = self.parms[0] + except: + ip = '' + url = 'https://api.ip.sb/geoip/' + if ip == '' or ip == 'help': + ret = '您可以使用 "/ip ip地址" 进行查找' + else: + res = requests.get(url + ip) + rsc = res.status_code + rem = res.json() + if rsc == 400: + ret = '不是正确的ip地址,您可以使用 "/ip ip地址" 进行查找' + else: + rlt = [] + try: + rlt.append('IP: ' + ip) + rlt.append('国家/地区: ' + rem['country']) + rlt.append('ISP: ' + rem['isp']) + rlt.append('ASN: ' + str(rem['asn'])) + rlt.append('ASN组织: ' + rem['asn_organization']) + rlt[1] += ', ' + rem['region'] + rlt[1] += ', ' + rem['city'] + except: + pass + ret = '\n'.join(rlt) + return ret diff --git a/worker/ns.py b/worker/ns.py new file mode 100644 index 0000000..ecbf91d --- /dev/null +++ b/worker/ns.py @@ -0,0 +1,9 @@ +from zzcore import StdAns +import os + +class Ans(StdAns): + def GETMSG(self): + domain = 'www.qq.com' + p = os.popen("nslookup " + domain) + msg = p.read() + return msg \ No newline at end of file diff --git a/worker/yiyan.py b/worker/yiyan.py index b6d0e05..f4bfd93 100644 --- a/worker/yiyan.py +++ b/worker/yiyan.py @@ -12,11 +12,10 @@ class Ans(StdAns): cmd = '' if cmd == '帮助': msg = '您可以使用以下参数:\n 动画,漫画,游戏,文学,原创,来自网络,其他,影视,诗词,网易云,哲学,抖机灵' + elif cmd == '': + msg = requests.get(url).text + elif cmd in cmdlst: + msg = requests.get(url+cmdlst[cmd]).text else: - if cmd == '': - msg = requests.get(url).text - elif cmd in cmdlst: - msg = requests.get(url+cmdlst[cmd]).text - else: - msg = '我不知道 ' + cmd + ' 这个参数,你可以使用"/yiyan 帮助"来获取帮助' + msg = '我不知道 ' + cmd + ' 这个参数,你可以使用"/yiyan 帮助"来获取帮助' return msg \ No newline at end of file From d41786672b1833bd341c34da7800b298516024b9 Mon Sep 17 00:00:00 2001 From: Si-Huan <49349784+Si-Huan@users.noreply.github.com> Date: Mon, 2 Mar 2020 21:40:12 +0800 Subject: [PATCH 005/240] Update ns.py --- worker/ns.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/worker/ns.py b/worker/ns.py index ecbf91d..b73cb3d 100644 --- a/worker/ns.py +++ b/worker/ns.py @@ -1,9 +1,9 @@ from zzcore import StdAns -import os +from subprocess import Popen class Ans(StdAns): def GETMSG(self): - domain = 'www.qq.com' - p = os.popen("nslookup " + domain) + domain = self.raw_msg['message'][4:] + p = Popen(["nslookup ",domain]) msg = p.read() - return msg \ No newline at end of file + return msg From 22af472eb07f280077c63395542382d2aa5f918f Mon Sep 17 00:00:00 2001 From: Si-Huan <49349784+Si-Huan@users.noreply.github.com> Date: Mon, 2 Mar 2020 21:44:10 +0800 Subject: [PATCH 006/240] ns up up --- worker/ns.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/ns.py b/worker/ns.py index b73cb3d..cbb6f96 100644 --- a/worker/ns.py +++ b/worker/ns.py @@ -4,6 +4,6 @@ from subprocess import Popen class Ans(StdAns): def GETMSG(self): domain = self.raw_msg['message'][4:] - p = Popen(["nslookup ",domain]) + p = Popen(["nslookup",domain]) msg = p.read() return msg From 1e73015e29f497fa5aab6212a7fb6d725692f442 Mon Sep 17 00:00:00 2001 From: Si-Huan <49349784+Si-Huan@users.noreply.github.com> Date: Mon, 2 Mar 2020 21:51:47 +0800 Subject: [PATCH 007/240] ns up up up --- worker/ns.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/worker/ns.py b/worker/ns.py index cbb6f96..37f94e0 100644 --- a/worker/ns.py +++ b/worker/ns.py @@ -1,9 +1,8 @@ from zzcore import StdAns -from subprocess import Popen +from subprocess import run class Ans(StdAns): def GETMSG(self): domain = self.raw_msg['message'][4:] - p = Popen(["nslookup",domain]) - msg = p.read() + msg = run(["nslookup",domain],capture_output=True) return msg From 80eb4956944f282188c60f7f99b7f8e1e33f2f6d Mon Sep 17 00:00:00 2001 From: Si-Huan <49349784+Si-Huan@users.noreply.github.com> Date: Mon, 2 Mar 2020 21:54:54 +0800 Subject: [PATCH 008/240] ns up up up up --- worker/ns.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worker/ns.py b/worker/ns.py index 37f94e0..ca1f439 100644 --- a/worker/ns.py +++ b/worker/ns.py @@ -4,5 +4,6 @@ from subprocess import run class Ans(StdAns): def GETMSG(self): domain = self.raw_msg['message'][4:] - msg = run(["nslookup",domain],capture_output=True) + r = run(["nslookup",domain],capture_output=True) + msg = r.stdout return msg From a98cc9f8d67fa4a29343864aefa14feaccf36ac1 Mon Sep 17 00:00:00 2001 From: Si-Huan <49349784+Si-Huan@users.noreply.github.com> Date: Mon, 2 Mar 2020 21:58:51 +0800 Subject: [PATCH 009/240] ns up up up up --- worker/ns.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/ns.py b/worker/ns.py index ca1f439..1aed0f6 100644 --- a/worker/ns.py +++ b/worker/ns.py @@ -5,5 +5,5 @@ class Ans(StdAns): def GETMSG(self): domain = self.raw_msg['message'][4:] r = run(["nslookup",domain],capture_output=True) - msg = r.stdout + msg = bytes.decode(r.stdout) return msg From 4b038254b4087ac5e36e8bf3518b7add4ab103ec Mon Sep 17 00:00:00 2001 From: Si-Huan <49349784+Si-Huan@users.noreply.github.com> Date: Mon, 2 Mar 2020 22:00:46 +0800 Subject: [PATCH 010/240] ip up --- worker/ip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/ip.py b/worker/ip.py index 67cdc29..22caeb2 100644 --- a/worker/ip.py +++ b/worker/ip.py @@ -4,7 +4,7 @@ import requests class Ans(StdAns): def GETMSG(self): try: - ip = self.parms[0] + ip = self.parms[1] except: ip = '' url = 'https://api.ip.sb/geoip/' From c2846aaa5de34eed2f6e4468459d42054f4ed22e Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sat, 7 Mar 2020 17:11:08 +0800 Subject: [PATCH 011/240] ns up up up --- worker/ns.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/worker/ns.py b/worker/ns.py index 1aed0f6..99e2764 100644 --- a/worker/ns.py +++ b/worker/ns.py @@ -1,9 +1,15 @@ from zzcore import StdAns -from subprocess import run +from subprocess import check_output class Ans(StdAns): def GETMSG(self): + if len(self.parms) < 2: + return '不加参数是坏文明!' + domain = self.raw_msg['message'][4:] - r = run(["nslookup",domain],capture_output=True) - msg = bytes.decode(r.stdout) - return msg + try: + answer = check_output(['nslookup',domain],shell=False,timeout=4) + msg = bytes.decode(answer) + except: + msg = '汝干了什么! ns 超时了!' + return msg \ No newline at end of file From 212d47b93f2a432442ad7a5af97e329b7a27a4fe Mon Sep 17 00:00:00 2001 From: weilinfox Date: Sat, 7 Mar 2020 18:45:44 +0800 Subject: [PATCH 012/240] fix bc bug --- worker/bc.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/worker/bc.py b/worker/bc.py index 705dd4e..f20b9ab 100644 --- a/worker/bc.py +++ b/worker/bc.py @@ -365,13 +365,10 @@ def funMain (ch): def sysbc (arg): try: - arg = "echo \"" + arg + "\" | bc" - ret = subprocess.run(arg, shell = True, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, check = True, timeout = 2) - retmes = str(ret.stdout) - retmes = retmes[2:len(retmes)-3] - retmes = retmes.replace('\\n', ". ") - retmes = retmes.replace('\\', "") - return retmes + arg = arg.replace("\'", "") + arg = "echo \'\'\'" + arg + "\'\'\' | bc" + ret = subprocess.run(arg, shell = True, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, check = True, timeout = 1) + return bytes.decode(ret.stdout).replace("\n", "") except subprocess.TimeoutExpired: return "你干了啥怎么半天算不完啦!服务器爆了打你哦~" except: From a70b99e39eefcb89620113dd2c4c6e9795026b64 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 9 Mar 2020 10:26:18 +0800 Subject: [PATCH 013/240] add gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..05cc0cf --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +env +__pycache__ +.vscode From 0997d2763b39a2933ea6b7c60573e369cb60b843 Mon Sep 17 00:00:00 2001 From: weilinfox Date: Wed, 11 Mar 2020 18:16:42 +0800 Subject: [PATCH 014/240] add sys mode for bc --- worker/bc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worker/bc.py b/worker/bc.py index f20b9ab..bf5f3ec 100644 --- a/worker/bc.py +++ b/worker/bc.py @@ -366,7 +366,8 @@ def funMain (ch): def sysbc (arg): try: arg = arg.replace("\'", "") - arg = "echo \'\'\'" + arg + "\'\'\' | bc" + arg = "echo '''" + arg + "''' | bc" + #print(arg) ret = subprocess.run(arg, shell = True, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, check = True, timeout = 1) return bytes.decode(ret.stdout).replace("\n", "") except subprocess.TimeoutExpired: From 7dbbbd0b389ef8c3be816aabb88c9aeeac9aefea Mon Sep 17 00:00:00 2001 From: weilinfox <54651938+weilinfox@users.noreply.github.com> Date: Thu, 12 Mar 2020 21:20:55 +0800 Subject: [PATCH 015/240] Update bc.py --- worker/bc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/worker/bc.py b/worker/bc.py index bf5f3ec..a00e0f9 100644 --- a/worker/bc.py +++ b/worker/bc.py @@ -436,6 +436,7 @@ def sysMain (lst): #代码段 class Ans (StdAns): + AllowGroup = [959613860] def GETMSG(self): ans = "汝以为咱不会算算数的嘛!" if (len(self.parms) < 2): From 2ef53a8d257036bd734b845c9ce3c3fcba084844 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 16 Mar 2020 15:42:57 +0800 Subject: [PATCH 016/240] music change api --- config.py | 4 +++- main.py | 5 ++--- worker/music.py | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/config.py b/config.py index 1301d36..381f5b2 100644 --- a/config.py +++ b/config.py @@ -4,4 +4,6 @@ APIURL = 'http://127.0.0.1:5700/' AUTHORIZATION = '' -PORT = 5580 \ No newline at end of file +PORT = 5580 + + diff --git a/main.py b/main.py index c138b5c..0b7e4b0 100644 --- a/main.py +++ b/main.py @@ -9,6 +9,5 @@ def whenmsg(): ZZRouter(request.get_json()) return '' -app.run(host='0.0.0.0', port=PORT) -if __name__ == '__main__': - app.run() +app.run(host='0.0.0.0',debug=True) + diff --git a/worker/music.py b/worker/music.py index 0d5aacb..59a4fbc 100644 --- a/worker/music.py +++ b/worker/music.py @@ -6,10 +6,12 @@ class Ans(StdAns): if len(self.parms) < 2: return '不加参数是坏文明!' - url = 'http://47.100.45.234/search' + url = 'https://api.imjad.cn/cloudmusic/' params = { - 'keywords':self.raw_msg['message'][6:], + 'type': 'search', + 'search_type': 1, 'limit': 1, + 's':self.raw_msg['message'][6:], } try: resp = requests.get(url=url,params=params).json() From 0ceafa4a0491910bd19b7138b8450b04fc3c17c3 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 16 Mar 2020 15:46:37 +0800 Subject: [PATCH 017/240] music change api ++ --- main.py | 2 +- worker/echo.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 0b7e4b0..d031539 100644 --- a/main.py +++ b/main.py @@ -9,5 +9,5 @@ def whenmsg(): ZZRouter(request.get_json()) return '' -app.run(host='0.0.0.0',debug=True) +app.run(host='0.0.0.0',port = PORT, debug=True) diff --git a/worker/echo.py b/worker/echo.py index 83c95e6..04db737 100644 --- a/worker/echo.py +++ b/worker/echo.py @@ -7,7 +7,7 @@ class Ans(StdAns): return '不加参数是坏文明!' r = random.randint(1,3) if r == 1: - msg = self.raw_msg['message'][5:] + msg = self.raw_msg['message'][6:] elif r == 2: msg = "汝以为咱会复读的嘛!\n(╯' - ')╯︵ ┻━┻\n" + self.raw_msg['message'][5:] elif r == 3: From a08aaee2e130be75cd0e9a7416d1580213ab320e Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 16 Mar 2020 15:47:50 +0800 Subject: [PATCH 018/240] music change api +++ --- config.py => sample_config.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename config.py => sample_config.py (100%) diff --git a/config.py b/sample_config.py similarity index 100% rename from config.py rename to sample_config.py From c714a1f860bb5ccfd3b80228c9e53b4289e47a2a Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 16 Mar 2020 16:47:54 +0800 Subject: [PATCH 019/240] pixiv --- .gitignore | 1 + worker/pixiv.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 worker/pixiv.py diff --git a/.gitignore b/.gitignore index 05cc0cf..1dc8a82 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ env __pycache__ .vscode +config.py \ No newline at end of file diff --git a/worker/pixiv.py b/worker/pixiv.py new file mode 100644 index 0000000..7a9cbc2 --- /dev/null +++ b/worker/pixiv.py @@ -0,0 +1,32 @@ +from zzcore import StdAns +import requests + +class Ans(StdAns): + AllowGroup = [959613860] + def GETMSG(self): + url = 'https://api.lolicon.app/setu/' + params = { + 'apikey': '095536795e6f0715593173', + } + + if len(self.parms) < 2: + try: + resp = requests.get(url=url,params=params).json() + picurl = resp['data'][0]['url'] + msg = picurl + except Exception as e: + print(e) + msg = '什么东西坏掉了,大概是Pixiv吧...不可能是咱!' + return msg + + else: + keyword = self.raw_msg['message'][7:] + params['keyword'] = keyword + try: + resp = requests.get(url=url,params=params).json() + picurl = resp['data'][0]['url'] + msg = picurl + except Exception as e: + print(e) + msg = '咱没查到,也有可能是Pixiv坏掉了' + return msg \ No newline at end of file From 4dbd574921ecebfd7b435dc620d9a88c1b09e0b7 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 16 Mar 2020 17:11:55 +0800 Subject: [PATCH 020/240] update pixiv --- worker/pixiv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index 7a9cbc2..22595bb 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -2,7 +2,7 @@ from zzcore import StdAns import requests class Ans(StdAns): - AllowGroup = [959613860] + AllowGroup = [959613860,805197917] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From 9634a6164ab7cd6773a692b37a187352943903bd Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 16 Mar 2020 17:14:24 +0800 Subject: [PATCH 021/240] update pixiv --- worker/pixiv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index 22595bb..3e717b4 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -2,7 +2,7 @@ from zzcore import StdAns import requests class Ans(StdAns): - AllowGroup = [959613860,805197917] + AllowGroup = [805197917,959613860] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From 7663e30d905fdc4419d39bd55c36752725694d03 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 16 Mar 2020 17:18:32 +0800 Subject: [PATCH 022/240] update pixiv --- route.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/route.py b/route.py index 59880f0..20c1b3e 100644 --- a/route.py +++ b/route.py @@ -5,7 +5,8 @@ def ZZRouter(data): gid = data['group_id'] role = data['sender']['role'] parms = str.split(data['message'][1:]) - if not parms: + print(uid,gid,role,parms) + if parms == []: parms[0] = 'help' worker = parms[0] From 37271f5fa3087b479b17efa20337641fad50d446 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 17 Mar 2020 14:20:21 +0800 Subject: [PATCH 023/240] update pixiv --- worker/pixiv.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index 3e717b4..ac9ed67 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -1,12 +1,14 @@ from zzcore import StdAns import requests +from config import LOLIKEY + class Ans(StdAns): AllowGroup = [805197917,959613860] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { - 'apikey': '095536795e6f0715593173', + 'apikey': LOLIKEY, } if len(self.parms) < 2: From b6bcdfc93a609f2a768800f9f2870dda64bb490d Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 20 Mar 2020 22:46:11 +0800 Subject: [PATCH 024/240] add redis db --- zzcore.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/zzcore.py b/zzcore.py index 16d48d6..01f9103 100644 --- a/zzcore.py +++ b/zzcore.py @@ -1,7 +1,8 @@ -import requests -import json +import requests, json, redis from config import APIURL, ALLWORKERS, AUTHORIZATION from worker import emmm +pool = redis.ConnectionPool(host='127.0.0.1', port=6379, decode_responses=True) +r = redis.Redis(connection_pool=pool) class StdAns(): AllowGroup = [] @@ -18,6 +19,11 @@ class StdAns(): self.role = role self.raw_msg = raw_msg + def DATAGET(self): + return r.hgetall(self.parms[0]) + + def DATASET(self,data): + r.hmset(self.parms[0],data) def CheckPermission(self): if self.AllowGroup and self.gid not in self.AllowGroup: @@ -43,4 +49,4 @@ class StdAns(): 'group_id' : self.gid, 'message': msg } - requests.post(url = url, data = json.dumps(data),headers = Headers) + return requests.post(url = url, data = json.dumps(data),headers = Headers).json()['data']['message_id'] From 2d22be7e613f389f42727100656373bce55d30e4 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 20 Mar 2020 22:46:23 +0800 Subject: [PATCH 025/240] add inx --- worker/inx.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 worker/inx.py diff --git a/worker/inx.py b/worker/inx.py new file mode 100644 index 0000000..8c3da5d --- /dev/null +++ b/worker/inx.py @@ -0,0 +1,27 @@ +from zzcore import StdAns +import requests, time + +class Ans(StdAns): + def GETMSG(self): + if len(self.parms) < 2: + return '不加参数是坏文明!' + cmd = self.parms[1] + AllowCmd = ['start','stop'] + + if cmd in AllowCmd: + if cmd == 'stop': + self.DATASET({'status':'0'}) + return '我已知晓你希望 inx 停止.' + if cmd == 'start': + self.DATASET({'status':'1'}) + self.sendmsg('inx 启动!') + while(self.DATAGET()['status'] == 1): + req = requests.get("https://hq.sinajs.cn/etag.php?_=1584712625172&list=gb_$inx") + num = req.text[28:].split(",")[1] + self.sendmsg('标普500现在情况: ' + num) + time.sleep(10) + + return "现在 inx 真的停了!" + + else: + return '汝是不是在inx后面添加了奇怪的参数,咱可只知道 start 和 stop。' \ No newline at end of file From 6b2476b697aabbf81aa0e46488e31be4932ae674 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 20 Mar 2020 22:51:35 +0800 Subject: [PATCH 026/240] inx ++ --- worker/inx.py | 5 +++-- zzcore.py | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/worker/inx.py b/worker/inx.py index 8c3da5d..73c74b2 100644 --- a/worker/inx.py +++ b/worker/inx.py @@ -15,11 +15,12 @@ class Ans(StdAns): if cmd == 'start': self.DATASET({'status':'1'}) self.sendmsg('inx 启动!') - while(self.DATAGET()['status'] == 1): + while(self.DATAGET()['status'] == '1'): req = requests.get("https://hq.sinajs.cn/etag.php?_=1584712625172&list=gb_$inx") num = req.text[28:].split(",")[1] - self.sendmsg('标普500现在情况: ' + num) + msgid = self.sendmsg('标普500现在情况: ' + num) time.sleep(10) + self.delmsg(msgid) return "现在 inx 真的停了!" diff --git a/zzcore.py b/zzcore.py index 01f9103..1f37c15 100644 --- a/zzcore.py +++ b/zzcore.py @@ -50,3 +50,15 @@ class StdAns(): 'message': msg } return requests.post(url = url, data = json.dumps(data),headers = Headers).json()['data']['message_id'] + + + def delmsg(self,msgid): + url = APIURL + "delete_msg" + Headers = { + 'content-type': 'application/json', + 'Authorization':'Bearer ' + AUTHORIZATION + } + data = { + 'message_id' : msgid, + } + requests.post(url = url, data = json.dumps(data),headers = Headers) \ No newline at end of file From 1b9c7ea74419e2557adc53c31cb9e2eee475120d Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 24 Mar 2020 20:48:05 +0800 Subject: [PATCH 027/240] inx more --- worker/inx.py | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/worker/inx.py b/worker/inx.py index 73c74b2..53cfd77 100644 --- a/worker/inx.py +++ b/worker/inx.py @@ -15,14 +15,35 @@ class Ans(StdAns): if cmd == 'start': self.DATASET({'status':'1'}) self.sendmsg('inx 启动!') + pinx = 0 + pixic = 0 + pdji = 0 while(self.DATAGET()['status'] == '1'): - req = requests.get("https://hq.sinajs.cn/etag.php?_=1584712625172&list=gb_$inx") - num = req.text[28:].split(",")[1] - msgid = self.sendmsg('标普500现在情况: ' + num) - time.sleep(10) - self.delmsg(msgid) - + inx, ixic, dji = getMG() + msg = '标普500 现在的涨跌幅度: ' + inx + ' ' + emoji(pinx,inx) + '纳斯达克现在的涨跌幅度: ' + ixic + ' ' + emoji(pixic,ixic) + '道琼斯指数现在的涨跌幅: ' + dji + ' ' + emoji(pdji,dji) + self.sendmsg(msg) + pinx = inx + pixic = ixic + pdji = dji + time.sleep(16) + return "现在 inx 真的停了!" else: - return '汝是不是在inx后面添加了奇怪的参数,咱可只知道 start 和 stop。' \ No newline at end of file + return '汝是不是在inx后面添加了奇怪的参数,咱可只知道 start 和 stop。' + + +def getMG(): + req = requests.get("https://hq.sinajs.cn/etag.php?_=1584712625172&list=gb_$inx,gb_$ixic,gb_$dji").text.split(',') + return req[2], req[29], req[56] + +def emoji(p,n): + n = float(n) + p = float(p) + if n < p: + emoji = '🟩🟩🟩🎉\n' + elif n > p: + emoji = '🟥🟥🟥😢\n' + else : + emoji = '⬜⬜⬜🌚\n' + return emoji From 902c0b27de7d7757b19e0f162c9596d277df81cc Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 24 Mar 2020 20:53:49 +0800 Subject: [PATCH 028/240] inx emoji --- worker/inx.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/worker/inx.py b/worker/inx.py index 53cfd77..3c87094 100644 --- a/worker/inx.py +++ b/worker/inx.py @@ -14,14 +14,15 @@ class Ans(StdAns): return '我已知晓你希望 inx 停止.' if cmd == 'start': self.DATASET({'status':'1'}) - self.sendmsg('inx 启动!') + # self.sendmsg('inx 启动!') pinx = 0 pixic = 0 pdji = 0 while(self.DATAGET()['status'] == '1'): inx, ixic, dji = getMG() - msg = '标普500 现在的涨跌幅度: ' + inx + ' ' + emoji(pinx,inx) + '纳斯达克现在的涨跌幅度: ' + ixic + ' ' + emoji(pixic,ixic) + '道琼斯指数现在的涨跌幅: ' + dji + ' ' + emoji(pdji,dji) - self.sendmsg(msg) + msg = '标普 500 : ' + inx + ' ' + emoji(pinx,inx) + '纳斯达克 : ' + ixic + ' ' + emoji(pixic,ixic) + '道琼斯指数: ' + dji + ' ' + emoji(pdji,dji) + # self.sendmsg(msg) + print(msg) pinx = inx pixic = ixic pdji = dji @@ -41,9 +42,9 @@ def emoji(p,n): n = float(n) p = float(p) if n < p: - emoji = '🟩🟩🟩🎉\n' + emoji = '📉📉📉🎉\n' elif n > p: - emoji = '🟥🟥🟥😢\n' + emoji = '📈📈📈😢\n' else : emoji = '⬜⬜⬜🌚\n' return emoji From 44a5f1ecbaa97344fdde8a987f0467680101396d Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 24 Mar 2020 20:55:50 +0800 Subject: [PATCH 029/240] update pixiv --- worker/inx.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/inx.py b/worker/inx.py index 3c87094..c873c79 100644 --- a/worker/inx.py +++ b/worker/inx.py @@ -14,15 +14,15 @@ class Ans(StdAns): return '我已知晓你希望 inx 停止.' if cmd == 'start': self.DATASET({'status':'1'}) - # self.sendmsg('inx 启动!') + self.sendmsg('inx 启动!') pinx = 0 pixic = 0 pdji = 0 while(self.DATAGET()['status'] == '1'): inx, ixic, dji = getMG() msg = '标普 500 : ' + inx + ' ' + emoji(pinx,inx) + '纳斯达克 : ' + ixic + ' ' + emoji(pixic,ixic) + '道琼斯指数: ' + dji + ' ' + emoji(pdji,dji) - # self.sendmsg(msg) - print(msg) + self.sendmsg(msg) + # print(msg) pinx = inx pixic = ixic pdji = dji From 49cd565c858647f2ba285561fdd86039f942020a Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 24 Mar 2020 20:57:39 +0800 Subject: [PATCH 030/240] update inx --- worker/inx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/inx.py b/worker/inx.py index c873c79..3c0a2b1 100644 --- a/worker/inx.py +++ b/worker/inx.py @@ -20,7 +20,7 @@ class Ans(StdAns): pdji = 0 while(self.DATAGET()['status'] == '1'): inx, ixic, dji = getMG() - msg = '标普 500 : ' + inx + ' ' + emoji(pinx,inx) + '纳斯达克 : ' + ixic + ' ' + emoji(pixic,ixic) + '道琼斯指数: ' + dji + ' ' + emoji(pdji,dji) + msg = '标普 500: ' + inx + ' ' + emoji(pinx,inx) + '纳斯达克: ' + ixic + ' ' + emoji(pixic,ixic) + '道琼斯 : ' + dji + ' ' + emoji(pdji,dji) self.sendmsg(msg) # print(msg) pinx = inx From 60e32a2643414f8b8d5b84d37b1b0091f262b057 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 24 Mar 2020 20:58:31 +0800 Subject: [PATCH 031/240] update inx --- worker/inx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/inx.py b/worker/inx.py index 3c0a2b1..bb5445f 100644 --- a/worker/inx.py +++ b/worker/inx.py @@ -20,7 +20,7 @@ class Ans(StdAns): pdji = 0 while(self.DATAGET()['status'] == '1'): inx, ixic, dji = getMG() - msg = '标普 500: ' + inx + ' ' + emoji(pinx,inx) + '纳斯达克: ' + ixic + ' ' + emoji(pixic,ixic) + '道琼斯 : ' + dji + ' ' + emoji(pdji,dji) + msg = '标普 500 : ' + inx + ' ' + emoji(pinx,inx) + '纳斯达克 : ' + ixic + ' ' + emoji(pixic,ixic) + '道琼斯 : ' + dji + ' ' + emoji(pdji,dji) self.sendmsg(msg) # print(msg) pinx = inx From 3fec19972ca47756004d32ecc7eecdc34766896d Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 2 Apr 2020 21:48:59 +0800 Subject: [PATCH 032/240] update inx --- worker/inx.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/worker/inx.py b/worker/inx.py index bb5445f..eea7a26 100644 --- a/worker/inx.py +++ b/worker/inx.py @@ -35,8 +35,11 @@ class Ans(StdAns): def getMG(): - req = requests.get("https://hq.sinajs.cn/etag.php?_=1584712625172&list=gb_$inx,gb_$ixic,gb_$dji").text.split(',') - return req[2], req[29], req[56] + req = requests.get("https://hq.sinajs.cn/etag.php?_=1584712625172&list=gb_$inx,gb_$ixic,gb_$dji").text.split(';') + inx = req[0].split(',')[2] + ixic = req[1].split(',')[2] + dji = req[2].split(',')[2] + return inx, ixic, dji def emoji(p,n): n = float(n) From b68793d247288ca11bf50fc87c3b957d7753e8ce Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 7 Apr 2020 19:11:32 +0800 Subject: [PATCH 033/240] music jeeas --- worker/music.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/worker/music.py b/worker/music.py index 59a4fbc..0f6dbe5 100644 --- a/worker/music.py +++ b/worker/music.py @@ -6,15 +6,16 @@ class Ans(StdAns): if len(self.parms) < 2: return '不加参数是坏文明!' - url = 'https://api.imjad.cn/cloudmusic/' + # url = 'https://api.imjad.cn/cloudmusic/' + url = 'https://music.jeeas.cn/v1/search' params = { - 'type': 'search', - 'search_type': 1, 'limit': 1, + 'from': 'music', 's':self.raw_msg['message'][6:], } try: resp = requests.get(url=url,params=params).json() + # print(resp) musicid = resp['result']['songs'][0]['id'] msg = '[CQ:music,type=163,id='+ str(musicid)+']' except Exception as e: From b84d3fcb1fbf67ffa1194ccc00752e7cb7cedfe8 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 26 Apr 2020 21:54:38 +0800 Subject: [PATCH 034/240] music use local api --- worker/music.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/music.py b/worker/music.py index 0f6dbe5..2979974 100644 --- a/worker/music.py +++ b/worker/music.py @@ -7,11 +7,11 @@ class Ans(StdAns): return '不加参数是坏文明!' # url = 'https://api.imjad.cn/cloudmusic/' - url = 'https://music.jeeas.cn/v1/search' + # url = 'https://music.jeeas.cn/v1/search' + url = 'http://mc.sakuya.love:3000/search' params = { 'limit': 1, - 'from': 'music', - 's':self.raw_msg['message'][6:], + 'keywords':self.raw_msg['message'][6:], } try: resp = requests.get(url=url,params=params).json() From 708c59cd2f9132e94552185b3e8c9a0c8cea99c8 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 27 Apr 2020 11:27:16 +0800 Subject: [PATCH 035/240] add touhou group --- worker/pixiv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index ac9ed67..b239307 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEY class Ans(StdAns): - AllowGroup = [805197917,959613860] + AllowGroup = [805197917,959613860,343700338] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From 80cdf0790f4407d29f71cdc0450a9a79801194d9 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 10:50:13 +0800 Subject: [PATCH 036/240] add xizse group --- worker/pixiv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index b239307..acab7f2 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEY class Ans(StdAns): - AllowGroup = [805197917,959613860,343700338] + AllowGroup = [805197917,959613860,343700338,125733077] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From 1e1277da538cc8be8d114ddc652e55ca1a38bca9 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 16:32:45 +0800 Subject: [PATCH 037/240] add pcr --- worker/pcr.py | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 worker/pcr.py diff --git a/worker/pcr.py b/worker/pcr.py new file mode 100644 index 0000000..72c6587 --- /dev/null +++ b/worker/pcr.py @@ -0,0 +1,214 @@ +import json +from zzcore import StdAns + +AllowCMD = ['登记','申请出刀','报刀','挂树','查树','进度','查刀','新的一天','血量','初始化'] + +status = { + 'all_player':{ + '1318000868': { + 'id':'十六夜咲夜', + '余刀': 3, + '加时刀': 0, + # 'SL':1 + }, + }, + 'boss_num': 0, + 'boss_hp': 0, + 'dao':{ + 'qq':1318000868, + '类型':'普通刀', + }, + 'tree':[] +} + +class Ans(StdAns): + AllowGroup = [125733077] + + def GETMSG(self): + if len(self.parms) < 2: + return '不加参数是坏文明!' + + cmd = self.parms[1] + if cmd not in AllowCMD: + return '没有 ' + cmd + ' 这个命令,请检查。' + + + try: + nowdata = json.loads(self.DATAGET()['data']) + except: + return '请管理员先初始化,初始化会将进度设置为第一周目第一个Boss,成员数据不会丢失。' + + + if cmd == '初始化': + if self.role not in ['owner','admin'] and self.uid != 1318000868: + return '你没有权限执行初始化。' + else: + try: + all_player = nowdata['all_player'] + except: + all_player = {} + + nowdata = {} + nowdata['all_player'] = all_player + nowdata['boss_num'] = 1 + nowdata['boss_hp'] = -1 + nowdata['dao'] = { + 'qq':0, + '类型':'普通刀', + } + nowdata['tree'] = [] + self.DATASET({'data':json.dumps(nowdata)}) + return '初始化完成!请使用\n /pcr 血量 xxxx \n 来设置第一周目第一个Boss的总血量。' + + if cmd == '登记': + nickname = self.raw_msg['message'][8:] + if nickname: + player = { + 'id':nickname, + '余刀': 3, + '加时刀': 0, + # 'SL':1 + } + + nowdata['all_player'][str(self.gid)] = player + self.DATASET({'data':json.dumps(nowdata)}) + + return '[CQ:at,qq=' + str(self.uid) + ']' + '游戏id设置为 ' + nickname + + else: + return '登记失败,请使用合法的游戏id。' + + if cmd == '血量': + if self.role not in ['owner','admin'] and self.uid != 1318000868: + return '你没有权限设置血量。' + else: + try: + hp = int(self.parms[2]) + except: + return '血量应该是整数!' + + nowdata['boss_hp'] = hp + self.DATASET({'data':json.dumps(nowdata)}) + return '现在' + bossname(int(nowdata['boss_num'])) +'的血量被设置为' + str(hp) + + if cmd == '新的一天': + if self.role not in ['owner','admin'] and self.uid != 1318000868: + return '你没有权限新的一天。' + else: + for value in nowdata['all_player'].itervalues(): + value['余刀'] == 3 + value['加时刀'] == 0 + # value['SL'] == 1 + self.DATASET({'data':json.dumps(nowdata)}) + return '新的一天已经开始,大家各有3刀剩余了。' + + + if cmd == '进度': + return bossname(int(nowdata['boss_num'])) + '\n剩余血量:' + str(nowdata['boss_hp']) + + if cmd == '申请出刀': + try: + nowplayer = nowdata['all_player'][str(self.uid)] + except: + return '您未登记。' + daoqq = nowdata['dao']['qq'] + if daoqq != 0 and daoqq not in nowdata['tree']: + return nowdata['all_player'][str(daoqq)]['id'] + '正在出刀,请等待他结算或挂树.' + elif nowplayer['余刀'] + nowdata['加时刀'] < 1: + return '您已无刀可出。' + else: + nowdata['dao']['qq'] = self.uid + if nowplayer['加时刀'] > 0: + nowdata['dao']['类型'] = '加时刀' + else: + nowdata['dao']['类型'] = '普通刀' + + self.DATASET({'data':json.dumps(nowdata)}) + return nowplayer['id'] + '出' + nowdata['dao']['类型'] + '讨伐' + bossname(int(nowdata['boss_num'])) + '\n剩余血量:' + str(nowdata['boss_hp']) + + + if cmd == '报刀': + try: + nowplayer = nowdata['all_player'][str(self.uid)] + except: + return '您未登记。' + + try: + jianhp = int(self.parms[2]) + except: + return '打掉的血量应该是整数!' + + newhp = nowdata['boss_hp'] - jianhp + # BOSS 没死 + if newhp > 0: + nowdata['boss_hp'] = newhp + nowdata['dao']['qq'] = 0 + if nowdata['dao']['类型'] == '加时刀': + nowplayer['加时刀'] = 0 + else: + nowplayer['余刀'] = nowplayer['余刀'] - 1 + + nowdata['all_player'][str(self.uid)] = nowplayer + self.DATASET({'data':json.dumps(nowdata)}) + + return nowplayer['id'] + '打了' + bossname(int(nowdata['boss_num'])) + str(jianhp) + '\n剩余血量:' + str(nowdata['boss_hp']) + #BOSS 死了 + else: + nowdata['boss_hp'] = 0 + nowdata['boss_num'] = nowdata['boss_num'] + 1 + nowdata['dao']['qq'] = 0 + nowdata['tree'] = [] + if nowdata['dao']['类型'] == '加时刀': + nowplayer['加时刀'] = 0 + else: + nowplayer['余刀'] = nowplayer['余刀'] - 1 + nowplayer['加时刀'] = 1 + + nowdata['all_player'][str(self.uid)] = nowplayer + self.DATASET({'data':json.dumps(nowdata)}) + + return nowplayer['id'] + '击杀了' + bossname(int(nowdata['boss_num'])-1) + '\n现在进入' + bossname(int(nowdata['boss_num'])) + '\n挂树的同学已经全部下树' + + + if cmd == '挂树': + try: + nowplayer = nowdata['all_player'][str(self.uid)] + except: + return '您未登记。' + + if nowdata['dao']['qq'] != self.uid: + return '您未出刀,挂个毛树' + + # elif nowplayer['SL'] == 1: + + else: + nowdata['dao']['qq'] = 0 + nowdata['tree'] = nowdata['tree'].append(self.uid) + self.DATASET({'data':json.dumps(nowdata)}) + return '已挂树' + + if cmd == '查树': + on_tree_players = '' + for p in nowdata['tree']: + on_tree_players = on_tree_players + nowdata['all_player'][str(p)]['id'] + '\n' + return '树上的有\n' + on_tree_players + + if cmd == '查刀': + alldao = '' + for value in nowdata['all_player'].itervalues(): + alldao = value['id'] + ' ' + '🔪'*value['余刀'] + '🍴'*value['加时刀'] + '\n' + return alldao + + + + +def bossname(num): + zm = int(num/5)+1 + z = num%5 + + if z == 0: + z = 5 + zm = zm - 1 + + return '第'+ str(zm) + '周目第' + str(z) + 'Boss' + From c76e46f76b7c8180092f6304fe926533c3e54627 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 16:38:05 +0800 Subject: [PATCH 038/240] fix pcr --- worker/pcr.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/worker/pcr.py b/worker/pcr.py index 72c6587..5fe4a1e 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -36,7 +36,10 @@ class Ans(StdAns): try: nowdata = json.loads(self.DATAGET()['data']) except: - return '请管理员先初始化,初始化会将进度设置为第一周目第一个Boss,成员数据不会丢失。' + if cmd == '初始化': + nowdata = {} + else: + return '请管理员先初始化,初始化会将进度设置为第一周目第一个Boss,成员数据不会丢失。' if cmd == '初始化': From 0b2defb0db55ca1bdfcb3acf25b8cb2378e92997 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 16:39:54 +0800 Subject: [PATCH 039/240] fix pcr --- worker/pcr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/pcr.py b/worker/pcr.py index 5fe4a1e..e1cfdac 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -99,8 +99,8 @@ class Ans(StdAns): return '你没有权限新的一天。' else: for value in nowdata['all_player'].itervalues(): - value['余刀'] == 3 - value['加时刀'] == 0 + value['余刀'] = 3 + value['加时刀'] = 0 # value['SL'] == 1 self.DATASET({'data':json.dumps(nowdata)}) return '新的一天已经开始,大家各有3刀剩余了。' From dfc9035ce463001e55349d6367421bcd45b5c8f6 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 16:41:53 +0800 Subject: [PATCH 040/240] fix pcr --- worker/pcr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/pcr.py b/worker/pcr.py index e1cfdac..6ea9877 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -98,7 +98,7 @@ class Ans(StdAns): if self.role not in ['owner','admin'] and self.uid != 1318000868: return '你没有权限新的一天。' else: - for value in nowdata['all_player'].itervalues(): + for value in nowdata['all_player'].values(): value['余刀'] = 3 value['加时刀'] = 0 # value['SL'] == 1 @@ -198,7 +198,7 @@ class Ans(StdAns): if cmd == '查刀': alldao = '' - for value in nowdata['all_player'].itervalues(): + for value in nowdata['all_player'].values(): alldao = value['id'] + ' ' + '🔪'*value['余刀'] + '🍴'*value['加时刀'] + '\n' return alldao From 9ae71a889e4dfef20a5aaf28238dcd2ec79d1038 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 16:45:30 +0800 Subject: [PATCH 041/240] fix pcr --- worker/pcr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pcr.py b/worker/pcr.py index 6ea9877..faf35df 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -73,7 +73,7 @@ class Ans(StdAns): # 'SL':1 } - nowdata['all_player'][str(self.gid)] = player + nowdata['all_player'][str(self.uid)] = player self.DATASET({'data':json.dumps(nowdata)}) return '[CQ:at,qq=' + str(self.uid) + ']' + '游戏id设置为 ' + nickname From 1b3d93dbaea403ee5f4b59ca8e3f21e9d4f92d3e Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 16:49:23 +0800 Subject: [PATCH 042/240] fix pcr --- worker/pcr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pcr.py b/worker/pcr.py index faf35df..a27fbbd 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -117,7 +117,7 @@ class Ans(StdAns): daoqq = nowdata['dao']['qq'] if daoqq != 0 and daoqq not in nowdata['tree']: return nowdata['all_player'][str(daoqq)]['id'] + '正在出刀,请等待他结算或挂树.' - elif nowplayer['余刀'] + nowdata['加时刀'] < 1: + elif nowplayer['余刀'] + nowplayer['加时刀'] < 1: return '您已无刀可出。' else: nowdata['dao']['qq'] = self.uid From 77bf4a9f5b8b30c1b8bf479d1527ca3c22a686ed Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 16:53:26 +0800 Subject: [PATCH 043/240] fix pcr --- worker/pcr.py | 1 + 1 file changed, 1 insertion(+) diff --git a/worker/pcr.py b/worker/pcr.py index a27fbbd..dc28893 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -102,6 +102,7 @@ class Ans(StdAns): value['余刀'] = 3 value['加时刀'] = 0 # value['SL'] == 1 + nowdata['tree'] = [] self.DATASET({'data':json.dumps(nowdata)}) return '新的一天已经开始,大家各有3刀剩余了。' From bbbf566d46e61d1d098f2b26aa40a4b3d5a2cfdf Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 16:56:06 +0800 Subject: [PATCH 044/240] fix pcr --- worker/pcr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pcr.py b/worker/pcr.py index dc28893..42db912 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -200,7 +200,7 @@ class Ans(StdAns): if cmd == '查刀': alldao = '' for value in nowdata['all_player'].values(): - alldao = value['id'] + ' ' + '🔪'*value['余刀'] + '🍴'*value['加时刀'] + '\n' + alldao = alldao + value['id'] + ' ' + '🔪'*value['余刀'] + '🍴'*value['加时刀'] + '\n' return alldao From 47f67350153302a072740870c6015ce2ca9f8338 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 17:08:54 +0800 Subject: [PATCH 045/240] fix pcr --- worker/pcr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pcr.py b/worker/pcr.py index 42db912..177f4c8 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -171,7 +171,7 @@ class Ans(StdAns): nowdata['all_player'][str(self.uid)] = nowplayer self.DATASET({'data':json.dumps(nowdata)}) - return nowplayer['id'] + '击杀了' + bossname(int(nowdata['boss_num'])-1) + '\n现在进入' + bossname(int(nowdata['boss_num'])) + '\n挂树的同学已经全部下树' + return nowplayer['id'] + '击杀了' + bossname(int(nowdata['boss_num'])-1) + '\n现在进入' + bossname(int(nowdata['boss_num'])) + '\n挂树的同学已经全部下树\n请使用\n /pcr 血量 xxxx \n 来设置新Boss的总血量' if cmd == '挂树': From 32dd49edf83aa5133aac98ed0a86b238e67f38e1 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 17:13:00 +0800 Subject: [PATCH 046/240] fix pcr --- worker/pcr.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/worker/pcr.py b/worker/pcr.py index 177f4c8..3005568 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -187,6 +187,8 @@ class Ans(StdAns): else: nowdata['dao']['qq'] = 0 + print(nowdata['tree']) + print(type(nowdata['tree'])) nowdata['tree'] = nowdata['tree'].append(self.uid) self.DATASET({'data':json.dumps(nowdata)}) return '已挂树' From b0f42533e73a0a5a954c611324224cf605dec572 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 17:13:21 +0800 Subject: [PATCH 047/240] fix pcr --- worker/pcr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pcr.py b/worker/pcr.py index 3005568..e989d96 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -22,7 +22,7 @@ status = { } class Ans(StdAns): - AllowGroup = [125733077] + # AllowGroup = [125733077] def GETMSG(self): if len(self.parms) < 2: From ab7a1487da32fc3a635bbde70a2f35190bfbf616 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 17:19:39 +0800 Subject: [PATCH 048/240] fix pcr --- worker/pcr.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/worker/pcr.py b/worker/pcr.py index e989d96..64cc278 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -190,6 +190,8 @@ class Ans(StdAns): print(nowdata['tree']) print(type(nowdata['tree'])) nowdata['tree'] = nowdata['tree'].append(self.uid) + print(nowdata['tree']) + print(type(nowdata['tree'])) self.DATASET({'data':json.dumps(nowdata)}) return '已挂树' From c4e3d70eb4888132362f15f522131cebe54bbb51 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 17:27:59 +0800 Subject: [PATCH 049/240] fix pcr --- worker/pcr.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/worker/pcr.py b/worker/pcr.py index 64cc278..837f3b8 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -22,7 +22,7 @@ status = { } class Ans(StdAns): - # AllowGroup = [125733077] + AllowGroup = [125733077] def GETMSG(self): if len(self.parms) < 2: @@ -184,14 +184,16 @@ class Ans(StdAns): return '您未出刀,挂个毛树' # elif nowplayer['SL'] == 1: - + elif self.uid in nowdata['tree']: + return '您已经在树上了。' + else: nowdata['dao']['qq'] = 0 - print(nowdata['tree']) - print(type(nowdata['tree'])) - nowdata['tree'] = nowdata['tree'].append(self.uid) - print(nowdata['tree']) - print(type(nowdata['tree'])) + # print(nowdata['tree']) + # print(type(nowdata['tree'])) + nowdata['tree'].append(self.uid) + # print(nowdata['tree']) + # print(type(nowdata['tree'])) self.DATASET({'data':json.dumps(nowdata)}) return '已挂树' From 229222d158b136ec1ebe62a9abaa894b27e7c257 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 17:30:08 +0800 Subject: [PATCH 050/240] fix pcr --- worker/pcr.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/worker/pcr.py b/worker/pcr.py index 837f3b8..8b36df5 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -180,13 +180,12 @@ class Ans(StdAns): except: return '您未登记。' - if nowdata['dao']['qq'] != self.uid: - return '您未出刀,挂个毛树' + if self.uid in nowdata['tree']: + return '您已经在树上了。' # elif nowplayer['SL'] == 1: - elif self.uid in nowdata['tree']: - return '您已经在树上了。' - + elif nowdata['dao']['qq'] != self.uid: + return '您未出刀,挂个毛树' else: nowdata['dao']['qq'] = 0 # print(nowdata['tree']) From 195dcd71acbf918feb32e7f0f4579534b7ede17d Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 17:34:00 +0800 Subject: [PATCH 051/240] fix pcr --- worker/pcr.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/worker/pcr.py b/worker/pcr.py index 8b36df5..7404943 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -204,8 +204,12 @@ class Ans(StdAns): if cmd == '查刀': alldao = '' - for value in nowdata['all_player'].values(): - alldao = alldao + value['id'] + ' ' + '🔪'*value['余刀'] + '🍴'*value['加时刀'] + '\n' + for key, value in nowdata['all_player'].items(): + alldao = alldao + value['id'] + ' ' + '🔪'*value['余刀'] + '🍴'*value['加时刀'] + if int(key) in nowdata['tree']: + alldao = alldao + ' 在🌳上\n' + else: + alldao = alldao + '\n' return alldao From 3402fb4c8624a78e4af2781d2fb9a53e9059d05e Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 17:50:23 +0800 Subject: [PATCH 052/240] fix pcr --- worker/pcr.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/worker/pcr.py b/worker/pcr.py index 7404943..ffa3ef4 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -1,7 +1,7 @@ import json from zzcore import StdAns -AllowCMD = ['登记','申请出刀','报刀','挂树','查树','进度','查刀','新的一天','血量','初始化'] +AllowCMD = ['登记','申请出刀','报刀','挂树','查树','进度','查刀','新的一天','血量','初始化','求助'] status = { 'all_player':{ @@ -136,7 +136,8 @@ class Ans(StdAns): nowplayer = nowdata['all_player'][str(self.uid)] except: return '您未登记。' - + if nowdata['dao']['qq'] != self.uid: + return '您未出刀,报个毛刀' try: jianhp = int(self.parms[2]) except: @@ -212,6 +213,11 @@ class Ans(StdAns): alldao = alldao + '\n' return alldao + if cmd == '求助': + on_tree_players = '' + for p in nowdata['tree']: + on_tree_players = on_tree_players + nowdata['all_player'][str(p)]['id'] + '\n' + return '救命[CQ:at,qq=3178302597][CQ:at,qq=3430357110]\n' + on_tree_players + '都在🌳上' From bcf52de52bd83a60af60eb020531ea9232785618 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 18:09:37 +0800 Subject: [PATCH 053/240] fix pcr --- worker/pcr.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/worker/pcr.py b/worker/pcr.py index ffa3ef4..cb681d0 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -115,6 +115,10 @@ class Ans(StdAns): nowplayer = nowdata['all_player'][str(self.uid)] except: return '您未登记。' + + if self.uid in nowdata['tree']: + return '您在树上了。' + daoqq = nowdata['dao']['qq'] if daoqq != 0 and daoqq not in nowdata['tree']: return nowdata['all_player'][str(daoqq)]['id'] + '正在出刀,请等待他结算或挂树.' @@ -136,7 +140,11 @@ class Ans(StdAns): nowplayer = nowdata['all_player'][str(self.uid)] except: return '您未登记。' - if nowdata['dao']['qq'] != self.uid: + + if s: + + + if nowdata['dao']['qq'] != self.uid and self.uid not in nowdata['tree']: return '您未出刀,报个毛刀' try: jianhp = int(self.parms[2]) @@ -154,9 +162,13 @@ class Ans(StdAns): nowplayer['余刀'] = nowplayer['余刀'] - 1 nowdata['all_player'][str(self.uid)] = nowplayer + if self.uid in nowdata['tree']: + nowdata.['tree'].remove(self.uid) self.DATASET({'data':json.dumps(nowdata)}) - return nowplayer['id'] + '打了' + bossname(int(nowdata['boss_num'])) + str(jianhp) + '\n剩余血量:' + str(nowdata['boss_hp']) + msg = nowplayer['id'] + '打了' + bossname(int(nowdata['boss_num'])) + str(jianhp) + '\n剩余血量:' + str(nowdata['boss_hp']) + if self.uid in nowdata['tree']: + msg = msg + '\n' + nowplayer['id'] + '自行下树' #BOSS 死了 else: nowdata['boss_hp'] = 0 @@ -170,6 +182,8 @@ class Ans(StdAns): nowplayer['加时刀'] = 1 nowdata['all_player'][str(self.uid)] = nowplayer + if self.uid in nowdata['tree']: + nowdata.['tree'].remove(self.uid) self.DATASET({'data':json.dumps(nowdata)}) return nowplayer['id'] + '击杀了' + bossname(int(nowdata['boss_num'])-1) + '\n现在进入' + bossname(int(nowdata['boss_num'])) + '\n挂树的同学已经全部下树\n请使用\n /pcr 血量 xxxx \n 来设置新Boss的总血量' From f4c17ad5ab39fddc388f08f82f89fa8e74c93db6 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 18:14:43 +0800 Subject: [PATCH 054/240] fix pcr --- worker/pcr.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/worker/pcr.py b/worker/pcr.py index cb681d0..e5af2a4 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -140,10 +140,6 @@ class Ans(StdAns): nowplayer = nowdata['all_player'][str(self.uid)] except: return '您未登记。' - - if s: - - if nowdata['dao']['qq'] != self.uid and self.uid not in nowdata['tree']: return '您未出刀,报个毛刀' try: @@ -163,7 +159,7 @@ class Ans(StdAns): nowdata['all_player'][str(self.uid)] = nowplayer if self.uid in nowdata['tree']: - nowdata.['tree'].remove(self.uid) + nowdata['tree'].remove(self.uid) self.DATASET({'data':json.dumps(nowdata)}) msg = nowplayer['id'] + '打了' + bossname(int(nowdata['boss_num'])) + str(jianhp) + '\n剩余血量:' + str(nowdata['boss_hp']) @@ -183,7 +179,7 @@ class Ans(StdAns): nowdata['all_player'][str(self.uid)] = nowplayer if self.uid in nowdata['tree']: - nowdata.['tree'].remove(self.uid) + nowdata['tree'].remove(self.uid) self.DATASET({'data':json.dumps(nowdata)}) return nowplayer['id'] + '击杀了' + bossname(int(nowdata['boss_num'])-1) + '\n现在进入' + bossname(int(nowdata['boss_num'])) + '\n挂树的同学已经全部下树\n请使用\n /pcr 血量 xxxx \n 来设置新Boss的总血量' From 78f360a99d89d0d56fc38e237cb78baf6aff55f0 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 30 Apr 2020 18:17:04 +0800 Subject: [PATCH 055/240] fix pcr --- worker/pcr.py | 1 + 1 file changed, 1 insertion(+) diff --git a/worker/pcr.py b/worker/pcr.py index e5af2a4..a21f6c8 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -165,6 +165,7 @@ class Ans(StdAns): msg = nowplayer['id'] + '打了' + bossname(int(nowdata['boss_num'])) + str(jianhp) + '\n剩余血量:' + str(nowdata['boss_hp']) if self.uid in nowdata['tree']: msg = msg + '\n' + nowplayer['id'] + '自行下树' + return msg #BOSS 死了 else: nowdata['boss_hp'] = 0 From 76b55c2d0203dfd9e384e5971c07032af17d0869 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 6 May 2020 16:05:27 +0800 Subject: [PATCH 056/240] fix pcr --- worker/pcr.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/worker/pcr.py b/worker/pcr.py index a21f6c8..eab3556 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -216,12 +216,14 @@ class Ans(StdAns): if cmd == '查刀': alldao = '' + index = 1 for key, value in nowdata['all_player'].items(): - alldao = alldao + value['id'] + ' ' + '🔪'*value['余刀'] + '🍴'*value['加时刀'] + alldao = alldao + str(index) + '. ' + value['id'] + ' ' + '🔪'*value['余刀'] + '🍴'*value['加时刀'] if int(key) in nowdata['tree']: alldao = alldao + ' 在🌳上\n' else: alldao = alldao + '\n' + index = index + 1 return alldao if cmd == '求助': From 52ab281bd16b97258c8f8bfc30b383d7018b465c Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 7 May 2020 17:42:46 +0800 Subject: [PATCH 057/240] duo gonghui pcr --- worker/pcr.py | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/worker/pcr.py b/worker/pcr.py index eab3556..a0e5d6f 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -1,7 +1,7 @@ import json from zzcore import StdAns -AllowCMD = ['登记','申请出刀','报刀','挂树','查树','进度','查刀','新的一天','血量','初始化','求助'] +AllowCMD = ['登记','申请出刀','报刀','挂树','查树','进度','查刀','新的一天','血量','初始化','求助','迁移'] status = { 'all_player':{ @@ -32,9 +32,20 @@ class Ans(StdAns): if cmd not in AllowCMD: return '没有 ' + cmd + ' 这个命令,请检查。' - + if cmd == '迁移': + if self.uid != 1318000868: + return '迁移数据请联系SiHuan' + try: + nowdata = json.loads(self.DATAGET()[self.parms[2]]) + except: + return '获取原始数据出错!' + self.DATASET({self.parms[2]:json.dumps(nowdata)}) + return '数据迁移完成! ' + self.parms[1] + '现在迁移到' + self.parms[2] + + gid = str(self.gid) + try: - nowdata = json.loads(self.DATAGET()['data']) + nowdata = json.loads(self.DATAGET()[gid]) except: if cmd == '初始化': nowdata = {} @@ -60,7 +71,7 @@ class Ans(StdAns): '类型':'普通刀', } nowdata['tree'] = [] - self.DATASET({'data':json.dumps(nowdata)}) + self.DATASET({gid:json.dumps(nowdata)}) return '初始化完成!请使用\n /pcr 血量 xxxx \n 来设置第一周目第一个Boss的总血量。' if cmd == '登记': @@ -74,7 +85,7 @@ class Ans(StdAns): } nowdata['all_player'][str(self.uid)] = player - self.DATASET({'data':json.dumps(nowdata)}) + self.DATASET({gid:json.dumps(nowdata)}) return '[CQ:at,qq=' + str(self.uid) + ']' + '游戏id设置为 ' + nickname @@ -91,7 +102,7 @@ class Ans(StdAns): return '血量应该是整数!' nowdata['boss_hp'] = hp - self.DATASET({'data':json.dumps(nowdata)}) + self.DATASET({gid:json.dumps(nowdata)}) return '现在' + bossname(int(nowdata['boss_num'])) +'的血量被设置为' + str(hp) if cmd == '新的一天': @@ -103,7 +114,7 @@ class Ans(StdAns): value['加时刀'] = 0 # value['SL'] == 1 nowdata['tree'] = [] - self.DATASET({'data':json.dumps(nowdata)}) + self.DATASET({gid:json.dumps(nowdata)}) return '新的一天已经开始,大家各有3刀剩余了。' @@ -131,7 +142,7 @@ class Ans(StdAns): else: nowdata['dao']['类型'] = '普通刀' - self.DATASET({'data':json.dumps(nowdata)}) + self.DATASET({gid:json.dumps(nowdata)}) return nowplayer['id'] + '出' + nowdata['dao']['类型'] + '讨伐' + bossname(int(nowdata['boss_num'])) + '\n剩余血量:' + str(nowdata['boss_hp']) @@ -160,7 +171,7 @@ class Ans(StdAns): nowdata['all_player'][str(self.uid)] = nowplayer if self.uid in nowdata['tree']: nowdata['tree'].remove(self.uid) - self.DATASET({'data':json.dumps(nowdata)}) + self.DATASET({gid:json.dumps(nowdata)}) msg = nowplayer['id'] + '打了' + bossname(int(nowdata['boss_num'])) + str(jianhp) + '\n剩余血量:' + str(nowdata['boss_hp']) if self.uid in nowdata['tree']: @@ -181,7 +192,7 @@ class Ans(StdAns): nowdata['all_player'][str(self.uid)] = nowplayer if self.uid in nowdata['tree']: nowdata['tree'].remove(self.uid) - self.DATASET({'data':json.dumps(nowdata)}) + self.DATASET({gid:json.dumps(nowdata)}) return nowplayer['id'] + '击杀了' + bossname(int(nowdata['boss_num'])-1) + '\n现在进入' + bossname(int(nowdata['boss_num'])) + '\n挂树的同学已经全部下树\n请使用\n /pcr 血量 xxxx \n 来设置新Boss的总血量' @@ -205,7 +216,7 @@ class Ans(StdAns): nowdata['tree'].append(self.uid) # print(nowdata['tree']) # print(type(nowdata['tree'])) - self.DATASET({'data':json.dumps(nowdata)}) + self.DATASET({gid:json.dumps(nowdata)}) return '已挂树' if cmd == '查树': From 2930e09df87e3568f4393577a2369a2e5ac53516 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 7 May 2020 17:44:04 +0800 Subject: [PATCH 058/240] duo gonghui pcr --- worker/pcr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/pcr.py b/worker/pcr.py index a0e5d6f..8e23514 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -39,8 +39,8 @@ class Ans(StdAns): nowdata = json.loads(self.DATAGET()[self.parms[2]]) except: return '获取原始数据出错!' - self.DATASET({self.parms[2]:json.dumps(nowdata)}) - return '数据迁移完成! ' + self.parms[1] + '现在迁移到' + self.parms[2] + self.DATASET({self.parms[3]:json.dumps(nowdata)}) + return '数据迁移完成! ' + self.parms[2] + '现在迁移到' + self.parms[3] gid = str(self.gid) From 9753ba2a17428545d85605521c8cda2c8acca533 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 7 May 2020 19:59:46 +0800 Subject: [PATCH 059/240] add tiren --- worker/pcr.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/worker/pcr.py b/worker/pcr.py index 8e23514..9a247db 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -1,7 +1,7 @@ import json from zzcore import StdAns -AllowCMD = ['登记','申请出刀','报刀','挂树','查树','进度','查刀','新的一天','血量','初始化','求助','迁移'] +AllowCMD = ['登记','申请出刀','报刀','挂树','查树','进度','查刀','新的一天','血量','初始化','求助','迁移','踢人'] status = { 'all_player':{ @@ -92,6 +92,25 @@ class Ans(StdAns): else: return '登记失败,请使用合法的游戏id。' + if cmd == '踢人': + if self.role not in ['owner','admin'] and self.uid != 1318000868: + return '你没有权限踢人。' + else: + tiqq = self.parms[2] + try: + nowplayer = nowdata['all_player'][tiqq] + except: + return '此人未登记!!!。' + + if tiqq in nowdata['tree']: + nowdata['tree'].remove(tiqq) + if str(nowdata['dao']['qq']) == tiqq: + nowdata['dao']['qq'] = 0 + + del nowdata['all_player'][tiqq] + self.DATASET({gid: json.dumps(nowdata)}) + return nowplayer['id'] + '已被踢除。' + if cmd == '血量': if self.role not in ['owner','admin'] and self.uid != 1318000868: return '你没有权限设置血量。' From 6c59b3282f21f8eebd325a5f3d95b10098b9ad7d Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 7 May 2020 20:25:32 +0800 Subject: [PATCH 060/240] add THBwiki group pixiv pcr --- worker/pcr.py | 2 +- worker/pixiv.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/pcr.py b/worker/pcr.py index 9a247db..8a6bebf 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -22,7 +22,7 @@ status = { } class Ans(StdAns): - AllowGroup = [125733077] + AllowGroup = [125733077,1084566280] def GETMSG(self): if len(self.parms) < 2: diff --git a/worker/pixiv.py b/worker/pixiv.py index acab7f2..b1e01fb 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEY class Ans(StdAns): - AllowGroup = [805197917,959613860,343700338,125733077] + AllowGroup = [805197917,959613860,343700338,125733077,1084566280] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From 2731de7f9bda70356d97cddbb9f3802d8564efae Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 8 May 2020 18:08:37 +0800 Subject: [PATCH 061/240] add dafenshu group pixiv pcr --- worker/pcr.py | 2 +- worker/pixiv.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/pcr.py b/worker/pcr.py index 8a6bebf..9b0ddd4 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -22,7 +22,7 @@ status = { } class Ans(StdAns): - AllowGroup = [125733077,1084566280] + AllowGroup = [125733077,1084566280,920863253] def GETMSG(self): if len(self.parms) < 2: diff --git a/worker/pixiv.py b/worker/pixiv.py index b1e01fb..e435d1e 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEY class Ans(StdAns): - AllowGroup = [805197917,959613860,343700338,125733077,1084566280] + AllowGroup = [805197917,959613860,343700338,125733077,1084566280,920863253] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From 7e222f329e1b7d566d4fa3755701dab9e7a0d160 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 8 May 2020 22:21:47 +0800 Subject: [PATCH 062/240] adel THBwiki group pixiv --- worker/pixiv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index e435d1e..2c44fed 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEY class Ans(StdAns): - AllowGroup = [805197917,959613860,343700338,125733077,1084566280,920863253] + AllowGroup = [805197917,959613860,343700338,125733077,920863253] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From 13c4aff66b771b51db2dc4a9e174de4955e9c144 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 8 May 2020 22:30:14 +0800 Subject: [PATCH 063/240] add THBwiki group pixiv --- worker/pixiv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index 2c44fed..e435d1e 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEY class Ans(StdAns): - AllowGroup = [805197917,959613860,343700338,125733077,920863253] + AllowGroup = [805197917,959613860,343700338,125733077,1084566280,920863253] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From 5cf462f65455d147f89db5c53d709c4594aa6a24 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 10 May 2020 12:01:32 +0800 Subject: [PATCH 064/240] pixiv use sihuan pximg --- worker/pixiv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index e435d1e..84aab02 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -27,7 +27,7 @@ class Ans(StdAns): try: resp = requests.get(url=url,params=params).json() picurl = resp['data'][0]['url'] - msg = picurl + msg = picurl.replace('https://i.pixiv.cat', 'https://pximg.sihuan.workers.dev') except Exception as e: print(e) msg = '咱没查到,也有可能是Pixiv坏掉了' From 4f4c5a22e11b6c25e840104ac9df58fe9a7e7aab Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 10 May 2020 13:09:38 +0800 Subject: [PATCH 065/240] pixiv use cheerfun pximg --- worker/pixiv.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index 84aab02..aac92dd 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -27,7 +27,8 @@ class Ans(StdAns): try: resp = requests.get(url=url,params=params).json() picurl = resp['data'][0]['url'] - msg = picurl.replace('https://i.pixiv.cat', 'https://pximg.sihuan.workers.dev') + # msg = picurl.replace('https://i.pixiv.cat', 'https://pximg.sihuan.workers.dev') + msg = picurl.replace('https://i.pixiv.cat', 'https://original.img.cheerfun.dev/') except Exception as e: print(e) msg = '咱没查到,也有可能是Pixiv坏掉了' From 790ed95970cba19ccf99c2e12f4b699bd1e83d05 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 10 May 2020 13:11:08 +0800 Subject: [PATCH 066/240] pixiv use cheerfun pximg --- worker/pixiv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index aac92dd..8f668c5 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -28,7 +28,7 @@ class Ans(StdAns): resp = requests.get(url=url,params=params).json() picurl = resp['data'][0]['url'] # msg = picurl.replace('https://i.pixiv.cat', 'https://pximg.sihuan.workers.dev') - 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: print(e) msg = '咱没查到,也有可能是Pixiv坏掉了' From 89f108f89fbee3f1855019b51b3d1fd36f5b83a7 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 10 May 2020 13:13:15 +0800 Subject: [PATCH 067/240] pixiv use cheerfun pximg --- worker/pixiv.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index 8f668c5..3719250 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -27,8 +27,8 @@ class Ans(StdAns): try: resp = requests.get(url=url,params=params).json() picurl = resp['data'][0]['url'] - # msg = picurl.replace('https://i.pixiv.cat', 'https://pximg.sihuan.workers.dev') - msg = picurl.replace('https://i.pixiv.cat', 'https://original.img.cheerfun.dev') + msg = picurl.replace('https://i.pixiv.cat', 'https://pximg.sihuan.workers.dev') + # msg = picurl.replace('https://i.pixiv.cat', 'https://original.img.cheerfun.dev') except Exception as e: print(e) msg = '咱没查到,也有可能是Pixiv坏掉了' From a5ea67bad75f65fd20ebc8842c57ec43eb0ba4a1 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 10 May 2020 18:58:05 +0800 Subject: [PATCH 068/240] pcr add boss --- worker/pcr.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/worker/pcr.py b/worker/pcr.py index 9b0ddd4..b63e893 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -1,7 +1,7 @@ import json from zzcore import StdAns -AllowCMD = ['登记','申请出刀','报刀','挂树','查树','进度','查刀','新的一天','血量','初始化','求助','迁移','踢人'] +AllowCMD = ['登记','申请出刀','报刀','挂树','查树','进度','查刀','新的一天','血量','boss','初始化','求助','迁移','踢人'] status = { 'all_player':{ @@ -124,6 +124,19 @@ class Ans(StdAns): self.DATASET({gid:json.dumps(nowdata)}) return '现在' + bossname(int(nowdata['boss_num'])) +'的血量被设置为' + str(hp) + if cmd == 'boss': + if self.role not in ['owner','admin'] and self.uid != 1318000868: + return '你没有权限设置boss。' + else: + try: + boss = int(self.parms[2]) + except: + return 'boss序号应该是整数!' + + nowdata['boss_num'] = boss + self.DATASET({gid:json.dumps(nowdata)}) + return '现在boss被设置为' + bossname(int(nowdata['boss_num'])) + if cmd == '新的一天': if self.role not in ['owner','admin'] and self.uid != 1318000868: return '你没有权限新的一天。' From 0e9f0a5706d7a8f3dc810cc275053514d9eb92d2 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 18 May 2020 13:26:38 +0800 Subject: [PATCH 069/240] pixiv jjc group --- worker/pixiv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index 3719250..7021937 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEY class Ans(StdAns): - AllowGroup = [805197917,959613860,343700338,125733077,1084566280,920863253] + AllowGroup = [805197917,959613860,343700338,125733077,1084566280,920863253,798595664] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From d80d8cc518ea569e636d60b924977c521707ecdc Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 19 May 2020 16:18:26 +0800 Subject: [PATCH 070/240] pixiv mirai group --- worker/pixiv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index 7021937..d9b64e9 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEY class Ans(StdAns): - AllowGroup = [805197917,959613860,343700338,125733077,1084566280,920863253,798595664] + AllowGroup = [805197917,959613860,343700338,125733077,1084566280,920863253,798595664,655057127] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From 15766dd4ccdc4a17aecb3e557f368d964fc67ce2 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 25 May 2020 15:25:10 +0800 Subject: [PATCH 071/240] pixiv mirai group --- worker/pixiv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index d9b64e9..e76b0c8 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEY class Ans(StdAns): - AllowGroup = [805197917,959613860,343700338,125733077,1084566280,920863253,798595664,655057127] + AllowGroup = [805197917,959613860,343700338,125733077,1084566280,920863253,798595664,655057127,196268763] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From 24fdca9c86b7a46952b34555f80fd734b4bd1208 Mon Sep 17 00:00:00 2001 From: Si-Huan <49349784+Si-Huan@users.noreply.github.com> Date: Mon, 1 Jun 2020 22:50:52 +0800 Subject: [PATCH 072/240] Update mc.py --- worker/mc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/mc.py b/worker/mc.py index 1870cea..0bd3568 100644 --- a/worker/mc.py +++ b/worker/mc.py @@ -3,7 +3,7 @@ import re from subprocess import getoutput,call class Ans(StdAns): - AllowGroup = [959613860] + AllowGroup = [959613860, 125733077] def GETMSG(self): if len(self.parms) < 2: return '不加参数是坏文明!' @@ -47,4 +47,4 @@ class Ans(StdAns): else: msg = '汝是不是在mc后面添加了奇怪的参数,咱可只知道 status list 和 say。' - return msg \ No newline at end of file + return msg From 3a6f81375d9268dc019ea80944bda700a12d99cf Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 18 Jun 2020 19:25:32 +0800 Subject: [PATCH 073/240] update emmm --- route.py | 14 +++++++++----- worker/emmm.py | 9 ++++++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/route.py b/route.py index 20c1b3e..02c5adb 100644 --- a/route.py +++ b/route.py @@ -1,23 +1,27 @@ from worker import emmm + def ZZRouter(data): uid = data['user_id'] gid = data['group_id'] role = data['sender']['role'] parms = str.split(data['message'][1:]) - print(uid,gid,role,parms) + print(uid, gid, role, parms) if parms == []: parms[0] = 'help' worker = parms[0] try: - package = __import__(name='worker.'+ worker, fromlist=worker) - Ans_ = getattr(package,'Ans') + package = __import__(name='worker.' + worker, fromlist=worker) + Ans_ = getattr(package, 'Ans') except: Ans_ = emmm.Ans - Ans = Ans_(parms,uid,gid,role,data) + Ans = Ans_(parms, uid, gid, role, data) Message = Ans.CheckPermission() if Message == 0: Message = Ans.GETMSG() - Ans.sendmsg(Message) \ No newline at end of file + elif Message == -1: + pass + else: + Ans.sendmsg(Message) diff --git a/worker/emmm.py b/worker/emmm.py index 8a470bd..d15ddec 100644 --- a/worker/emmm.py +++ b/worker/emmm.py @@ -1,8 +1,15 @@ from zzcore import StdAns + class Ans(StdAns): + NotAllowGroup = [204097403] + + def CheckPermission(self): + if self.gid not in self.NotAllowGroup: + return -1 + def GETMSG(self): if self.parms: return '咱也不知道' + self.parms[0] + '是啥呢~' else: - return '汝再调戏咱,咱可就生气了!!' \ No newline at end of file + return '汝再调戏咱,咱可就生气了!!' From 682ce89140d436820962806f5893d9fd13169ba5 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 18 Jun 2020 19:35:09 +0800 Subject: [PATCH 074/240] fix bug --- route.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/route.py b/route.py index 02c5adb..43fb494 100644 --- a/route.py +++ b/route.py @@ -22,6 +22,5 @@ def ZZRouter(data): if Message == 0: Message = Ans.GETMSG() elif Message == -1: - pass - else: - Ans.sendmsg(Message) + return + Ans.sendmsg(Message) From bf7b1f427c0a2cf3196acc9bdb32234ae3c54389 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sat, 20 Jun 2020 15:35:23 +0800 Subject: [PATCH 075/240] update emmm --- worker/emmm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worker/emmm.py b/worker/emmm.py index d15ddec..04d2d10 100644 --- a/worker/emmm.py +++ b/worker/emmm.py @@ -5,8 +5,9 @@ class Ans(StdAns): NotAllowGroup = [204097403] def CheckPermission(self): - if self.gid not in self.NotAllowGroup: + if self.gid in self.NotAllowGroup: return -1 + return 0 def GETMSG(self): if self.parms: From 5a01f1faf8dba1b3495ce209d35fc89a44049d6a Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 25 Jun 2020 11:19:04 +0800 Subject: [PATCH 076/240] add archcnqq mc --- worker/mc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/mc.py b/worker/mc.py index 0bd3568..c789289 100644 --- a/worker/mc.py +++ b/worker/mc.py @@ -3,7 +3,7 @@ import re from subprocess import getoutput,call class Ans(StdAns): - AllowGroup = [959613860, 125733077] + AllowGroup = [959613860, 125733077, 204097403] def GETMSG(self): if len(self.parms) < 2: return '不加参数是坏文明!' From b0f7274fae11b5ff2f9334c241368a261c82a3c9 Mon Sep 17 00:00:00 2001 From: SiHuan <49349784+Si-Huan@users.noreply.github.com> Date: Thu, 25 Jun 2020 19:15:16 +0800 Subject: [PATCH 077/240] Update pixiv.py --- worker/pixiv.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index e76b0c8..8ddfdfd 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEY class Ans(StdAns): - AllowGroup = [805197917,959613860,343700338,125733077,1084566280,920863253,798595664,655057127,196268763] + AllowGroup = [805197917,959613860,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 204097403] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { @@ -32,4 +32,4 @@ class Ans(StdAns): except Exception as e: print(e) msg = '咱没查到,也有可能是Pixiv坏掉了' - return msg \ No newline at end of file + return msg From f3e548e7de2cfbaef3467e88e0ca5ebca52c3152 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 28 Jun 2020 12:38:59 +0800 Subject: [PATCH 078/240] add dots group pixiv --- worker/pixiv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index e76b0c8..4892745 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEY class Ans(StdAns): - AllowGroup = [805197917,959613860,343700338,125733077,1084566280,920863253,798595664,655057127,196268763] + AllowGroup = [805197917,959613860,343700338,125733077,1084566280,920863253,798595664,655057127,196268763,474907856] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From af31d0374eb1b4ac5d180553655e42bdf2590f64 Mon Sep 17 00:00:00 2001 From: SiHuan <49349784+Si-Huan@users.noreply.github.com> Date: Thu, 9 Jul 2020 10:45:41 +0800 Subject: [PATCH 079/240] pixiv add 247022495 --- worker/pixiv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index 8ddfdfd..8e40ba9 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEY class Ans(StdAns): - AllowGroup = [805197917,959613860,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 204097403] + AllowGroup = [805197917,959613860,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 204097403, 247022495] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From dd5386427cd8dd3f323841a4d0e6c060fea6e618 Mon Sep 17 00:00:00 2001 From: SiHuan <49349784+Si-Huan@users.noreply.github.com> Date: Thu, 9 Jul 2020 10:49:39 +0800 Subject: [PATCH 080/240] del pixiv sdustlug --- worker/pixiv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index 8e40ba9..32da47d 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEY class Ans(StdAns): - AllowGroup = [805197917,959613860,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 204097403, 247022495] + AllowGroup = [805197917,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 204097403, 247022495] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From 4f7c1f70b721154d3627786a9bf5a63a2357d3b4 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sat, 11 Jul 2020 22:43:42 +0800 Subject: [PATCH 081/240] update pixiv --- worker/pixiv.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index 736127b..915ba6b 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -27,9 +27,10 @@ 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.replace('https://i.pixiv.cat', 'https://pximg.sihuan.workers.dev') + msg = '[CQ:at,qq=' + str(self.uid) + ']' + '咱帮你🔍 ' + keyword + ' 找到了这个\n' + picurl + # .replace('https://i.pixiv.cat', 'https://pximg.sihuan.workers.dev') # 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:at,qq=' + str(self.uid) + ']咱没查到 ' + keyword + ' 也有可能是Pixiv坏掉了' return msg From 92c10ae93d3c6c43133bfa96cb8bb6844b831218 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 12 Jul 2020 22:41:00 +0800 Subject: [PATCH 082/240] pixiv add erchiyuan froup --- worker/pixiv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index 915ba6b..888e558 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEY class Ans(StdAns): - AllowGroup = [805197917,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 204097403, 247022495, 474907856] + AllowGroup = [973510746, 805197917,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 204097403, 247022495, 474907856] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From 00ff3b0981e9e1360254c592513a980d27625e4d Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 12 Jul 2020 23:19:40 +0800 Subject: [PATCH 083/240] pixiv no sakuya --- worker/pixiv.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/worker/pixiv.py b/worker/pixiv.py index 888e558..5320581 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -23,6 +23,8 @@ class Ans(StdAns): else: keyword = self.raw_msg['message'][7:] + if keyword in ['十六夜咲夜','十六夜','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: + return "不许看咲夜的涩图!!" params['keyword'] = keyword try: resp = requests.get(url=url,params=params).json() From a07e0f0eb797e2466eb67f94cf07706ce7fbc1d0 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 12 Jul 2020 23:23:05 +0800 Subject: [PATCH 084/240] pixiv no sakuya --- worker/pixiv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pixiv.py b/worker/pixiv.py index 5320581..cebc613 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -23,7 +23,7 @@ class Ans(StdAns): else: keyword = self.raw_msg['message'][7:] - if keyword in ['十六夜咲夜','十六夜','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: + if keyword in ['十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: return "不许看咲夜的涩图!!" params['keyword'] = keyword try: From a8c24e350b9add3098d4ac2ec71670ae64dec0e9 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 14 Jul 2020 16:44:26 +0800 Subject: [PATCH 085/240] only my sakuya --- worker/echo.py | 6 ++++++ worker/emmm.py | 4 ++++ worker/pixiv.py | 6 ++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/worker/echo.py b/worker/echo.py index 04db737..49d4161 100644 --- a/worker/echo.py +++ b/worker/echo.py @@ -5,6 +5,12 @@ class Ans(StdAns): def GETMSG(self): if len(self.parms) < 2: return '不加参数是坏文明!' + + if self.uid != 1318000868: + for sakuya in ['十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: + if sakuya in keyword: + return "不许你们说咲夜!!" + r = random.randint(1,3) if r == 1: msg = self.raw_msg['message'][6:] diff --git a/worker/emmm.py b/worker/emmm.py index 04d2d10..d461b49 100644 --- a/worker/emmm.py +++ b/worker/emmm.py @@ -11,6 +11,10 @@ class Ans(StdAns): def GETMSG(self): if self.parms: + if self.uid != 1318000868: + for sakuya in ['十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: + if sakuya in self.parms[0]: + return "咲夜是最完美的!!" return '咱也不知道' + self.parms[0] + '是啥呢~' else: return '汝再调戏咱,咱可就生气了!!' diff --git a/worker/pixiv.py b/worker/pixiv.py index cebc613..9e71e50 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -23,8 +23,10 @@ class Ans(StdAns): else: keyword = self.raw_msg['message'][7:] - if keyword in ['十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: - return "不许看咲夜的涩图!!" + if self.uid != 1318000868: + for sakuya in ['十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: + if sakuya in keyword: + return "不许你们看咲夜的涩图!!" params['keyword'] = keyword try: resp = requests.get(url=url,params=params).json() From fa53a44fbdbc80e78bb27924de5feb6035b9fb05 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 14 Jul 2020 16:45:22 +0800 Subject: [PATCH 086/240] fix echo --- worker/echo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/echo.py b/worker/echo.py index 49d4161..3486136 100644 --- a/worker/echo.py +++ b/worker/echo.py @@ -8,7 +8,7 @@ class Ans(StdAns): if self.uid != 1318000868: for sakuya in ['十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: - if sakuya in keyword: + if sakuya in self.raw_msg['message']: return "不许你们说咲夜!!" r = random.randint(1,3) From c6ffdcb091760b5c8d3a8d876d7981325a011fa0 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 14 Jul 2020 16:49:15 +0800 Subject: [PATCH 087/240] =?UTF-8?q?add=20=E5=8F=A3=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/echo.py | 2 +- worker/emmm.py | 2 +- worker/pixiv.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/echo.py b/worker/echo.py index 3486136..7cbebcc 100644 --- a/worker/echo.py +++ b/worker/echo.py @@ -7,7 +7,7 @@ class Ans(StdAns): return '不加参数是坏文明!' if self.uid != 1318000868: - for sakuya in ['十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: + for sakuya in ['口关夜','十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: if sakuya in self.raw_msg['message']: return "不许你们说咲夜!!" diff --git a/worker/emmm.py b/worker/emmm.py index d461b49..491a8b6 100644 --- a/worker/emmm.py +++ b/worker/emmm.py @@ -12,7 +12,7 @@ class Ans(StdAns): def GETMSG(self): if self.parms: if self.uid != 1318000868: - for sakuya in ['十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: + for sakuya in ['口关夜','十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: if sakuya in self.parms[0]: return "咲夜是最完美的!!" return '咱也不知道' + self.parms[0] + '是啥呢~' diff --git a/worker/pixiv.py b/worker/pixiv.py index 9e71e50..caa4511 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -24,7 +24,7 @@ class Ans(StdAns): else: keyword = self.raw_msg['message'][7:] if self.uid != 1318000868: - for sakuya in ['十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: + for sakuya in ['口关夜','十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: if sakuya in keyword: return "不许你们看咲夜的涩图!!" params['keyword'] = keyword From 5a11375c9dd6ae5c043e7cc8765c1129b3eb81d9 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 14 Jul 2020 17:04:09 +0800 Subject: [PATCH 088/240] update mysakyta --- worker/echo.py | 10 ++++------ worker/emmm.py | 10 +++++----- worker/pixiv.py | 10 +++++----- zzcore.py | 13 ++++++++++++- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/worker/echo.py b/worker/echo.py index 7cbebcc..4ac5437 100644 --- a/worker/echo.py +++ b/worker/echo.py @@ -1,15 +1,13 @@ import random -from zzcore import StdAns +from zzcore import StdAns, mysakuya class Ans(StdAns): def GETMSG(self): if len(self.parms) < 2: return '不加参数是坏文明!' - - if self.uid != 1318000868: - for sakuya in ['口关夜','十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: - if sakuya in self.raw_msg['message']: - return "不许你们说咲夜!!" + + if mysakuya(self,self.raw_msg['message']) == False: + return "不许你们说咲夜!!" r = random.randint(1,3) if r == 1: diff --git a/worker/emmm.py b/worker/emmm.py index 491a8b6..e591451 100644 --- a/worker/emmm.py +++ b/worker/emmm.py @@ -1,4 +1,4 @@ -from zzcore import StdAns +from zzcore import StdAns, mysakuya class Ans(StdAns): @@ -11,10 +11,10 @@ class Ans(StdAns): def GETMSG(self): if self.parms: - if self.uid != 1318000868: - for sakuya in ['口关夜','十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: - if sakuya in self.parms[0]: - return "咲夜是最完美的!!" + + if mysakuya(self, self.parms[0]) == False: + return "咲夜是最完美的!!" + return '咱也不知道' + self.parms[0] + '是啥呢~' else: return '汝再调戏咱,咱可就生气了!!' diff --git a/worker/pixiv.py b/worker/pixiv.py index caa4511..b376309 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -1,4 +1,4 @@ -from zzcore import StdAns +from zzcore import StdAns, mysakuya import requests from config import LOLIKEY @@ -23,10 +23,10 @@ class Ans(StdAns): else: keyword = self.raw_msg['message'][7:] - if self.uid != 1318000868: - for sakuya in ['口关夜','十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: - if sakuya in keyword: - return "不许你们看咲夜的涩图!!" + + if mysakuya(self, keyword) == False: + return "不许你们看咲夜的涩图!!" + params['keyword'] = keyword try: resp = requests.get(url=url,params=params).json() diff --git a/zzcore.py b/zzcore.py index 1f37c15..8138e59 100644 --- a/zzcore.py +++ b/zzcore.py @@ -61,4 +61,15 @@ class StdAns(): data = { 'message_id' : msgid, } - requests.post(url = url, data = json.dumps(data),headers = Headers) \ No newline at end of file + requests.post(url = url, data = json.dumps(data),headers = Headers) + + +def mysakuya(self, words): + if self.uid == 1318000868: + return True + + if ('咲' in words and '夜' in words) or ('口关' in words and '夜' in words) or ('十' in words and '六' in words and '夜' in words) or ('1' in words and '6' in words and '夜' in words): + return False + for sakuya in ['口关夜','十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: + if sakuya in words: + return False \ No newline at end of file From 5cae26681b703133f8f97baf09658f63c6583f1b Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 14 Jul 2020 17:11:33 +0800 Subject: [PATCH 089/240] update emmm mysakuya --- worker/emmm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/emmm.py b/worker/emmm.py index e591451..d327b83 100644 --- a/worker/emmm.py +++ b/worker/emmm.py @@ -12,7 +12,7 @@ class Ans(StdAns): def GETMSG(self): if self.parms: - if mysakuya(self, self.parms[0]) == False: + if mysakuya(self, self.raw_msg['message']) == False: return "咲夜是最完美的!!" return '咱也不知道' + self.parms[0] + '是啥呢~' From 57560a99a4079001c0a5ba96cc89a55eb655b05c Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 14 Jul 2020 17:17:18 +0800 Subject: [PATCH 090/240] update mysakuya --- zzcore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zzcore.py b/zzcore.py index 8138e59..c51dd81 100644 --- a/zzcore.py +++ b/zzcore.py @@ -68,7 +68,7 @@ def mysakuya(self, words): if self.uid == 1318000868: return True - if ('咲' in words and '夜' in words) or ('口关' in words and '夜' in words) or ('十' in words and '六' in words and '夜' in words) or ('1' in words and '6' in words and '夜' in words): + if ('咲' in words and '夜' in words) or ('关' in words and '夜' in words) or ('十' in words and '六' in words and '夜' in words) or ('1' in words and '6' in words and '夜' in words): return False for sakuya in ['口关夜','十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: if sakuya in words: From bfcb5b11f653ad5e69eeb0ac60a91c9f666b931f Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 14 Jul 2020 17:23:11 +0800 Subject: [PATCH 091/240] update zzcore mysakuya --- zzcore.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zzcore.py b/zzcore.py index c51dd81..c70562b 100644 --- a/zzcore.py +++ b/zzcore.py @@ -72,4 +72,6 @@ def mysakuya(self, words): return False for sakuya in ['口关夜','十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: if sakuya in words: - return False \ No newline at end of file + return False + + return True \ No newline at end of file From e4f369dc5040115edb345c609deae89c67c0adf7 Mon Sep 17 00:00:00 2001 From: SiHuan <49349784+Si-Huan@users.noreply.github.com> Date: Wed, 15 Jul 2020 19:43:33 +0800 Subject: [PATCH 092/240] add uos peixun group --- worker/mc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/mc.py b/worker/mc.py index c789289..7970eb9 100644 --- a/worker/mc.py +++ b/worker/mc.py @@ -3,7 +3,7 @@ import re from subprocess import getoutput,call class Ans(StdAns): - AllowGroup = [959613860, 125733077, 204097403] + AllowGroup = [959613860, 125733077, 204097403, 1140391080] def GETMSG(self): if len(self.parms) < 2: return '不加参数是坏文明!' From 7a357717edd7a9a5d1fcc7d0bd665ca84ecb54e0 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 2 Aug 2020 16:42:41 +0800 Subject: [PATCH 093/240] add getgroups and broadcast --- worker/broadcast.py | 13 +++++++++++++ zzcore.py | 8 ++++++++ 2 files changed, 21 insertions(+) create mode 100644 worker/broadcast.py diff --git a/worker/broadcast.py b/worker/broadcast.py new file mode 100644 index 0000000..6da5b7e --- /dev/null +++ b/worker/broadcast.py @@ -0,0 +1,13 @@ +from zzcore import StdAns + +class Ans(StdAns): + AllowUser = [1318000868] + + def GETMSG(self): + groups = self.getgroups() + + msg = "" + for g in groups: + msg += g["groupname"] + + retuen msg diff --git a/zzcore.py b/zzcore.py index c70562b..ae49acc 100644 --- a/zzcore.py +++ b/zzcore.py @@ -63,6 +63,14 @@ class StdAns(): } requests.post(url = url, data = json.dumps(data),headers = Headers) + def getgroups(self): + url = APIURL + "get_group_list" + Headers = { + 'content-type': 'application/json', + 'Authorization':'Bearer ' + AUTHORIZATION + } + + return requests.get(url = url,headers = Headers).json()['data'] def mysakuya(self, words): if self.uid == 1318000868: From 60f96bd2aff825151ed6e4461e25676ac1455cb1 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 2 Aug 2020 16:44:49 +0800 Subject: [PATCH 094/240] fix broadcast --- worker/broadcast.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/broadcast.py b/worker/broadcast.py index 6da5b7e..0a1ad54 100644 --- a/worker/broadcast.py +++ b/worker/broadcast.py @@ -10,4 +10,4 @@ class Ans(StdAns): for g in groups: msg += g["groupname"] - retuen msg + return msg From a2cd23b90785f1ac9795c8b4acfcfb8cfb8594d2 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 2 Aug 2020 16:52:42 +0800 Subject: [PATCH 095/240] fix broadcast --- worker/broadcast.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/broadcast.py b/worker/broadcast.py index 0a1ad54..6c7d3d6 100644 --- a/worker/broadcast.py +++ b/worker/broadcast.py @@ -6,8 +6,8 @@ class Ans(StdAns): def GETMSG(self): groups = self.getgroups() - msg = "" - for g in groups: - msg += g["groupname"] + msg = groups + # for g in groups: + # msg += g["groupname"] return msg From 2e4f3678bc5d50dd17cc63e1361a229cf5cdec4f Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 2 Aug 2020 16:55:35 +0800 Subject: [PATCH 096/240] fix broadcast --- worker/broadcast.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/broadcast.py b/worker/broadcast.py index 6c7d3d6..51d892d 100644 --- a/worker/broadcast.py +++ b/worker/broadcast.py @@ -6,8 +6,8 @@ class Ans(StdAns): def GETMSG(self): groups = self.getgroups() - msg = groups - # for g in groups: - # msg += g["groupname"] + msg = "" + for g in groups: + msg += g["group_name"] return msg From 1816a73ed8951206138b3c0a52f6ee1e63f529b7 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 2 Aug 2020 16:56:26 +0800 Subject: [PATCH 097/240] fix broadcast --- worker/broadcast.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/broadcast.py b/worker/broadcast.py index 51d892d..99d51cb 100644 --- a/worker/broadcast.py +++ b/worker/broadcast.py @@ -8,6 +8,6 @@ class Ans(StdAns): msg = "" for g in groups: - msg += g["group_name"] + msg += g["group_name"] + "\n" return msg From 4e1d3b7c18f46ab55b2de0c67f9729ce1c497e9c Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 2 Aug 2020 17:04:09 +0800 Subject: [PATCH 098/240] fix broadcast --- worker/broadcast.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/worker/broadcast.py b/worker/broadcast.py index 99d51cb..3a993e5 100644 --- a/worker/broadcast.py +++ b/worker/broadcast.py @@ -5,9 +5,13 @@ class Ans(StdAns): def GETMSG(self): groups = self.getgroups() + text = self.raw_msg['message'][11:] + gid = self.gid - msg = "" for g in groups: - msg += g["group_name"] + "\n" + self.gid = g['group_id'] + self.sendmsg(text) + + self.gid = gid - return msg + return "Broadcast done." From 420c4ae712512555cdd5603d190ad339c550cc48 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 2 Aug 2020 21:54:55 +0800 Subject: [PATCH 099/240] =?UTF-8?q?=E5=85=BC=E5=AE=B9=20go-cqhttp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zzcore.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/zzcore.py b/zzcore.py index ae49acc..bed2c5c 100644 --- a/zzcore.py +++ b/zzcore.py @@ -39,29 +39,24 @@ class StdAns(): def sendmsg(self,msg): url = APIURL + "send_msg" - Headers = { - 'content-type': 'application/json', - 'Authorization':'Bearer ' + AUTHORIZATION - } - + data = { + 'access_token' : AUTHORIZATION, 'message_type' : 'group', 'group_id' : self.gid, 'message': msg } - return requests.post(url = url, data = json.dumps(data),headers = Headers).json()['data']['message_id'] + return requests.get(url = url, params=data).json()['data']['message_id'] def delmsg(self,msgid): url = APIURL + "delete_msg" - Headers = { - 'content-type': 'application/json', - 'Authorization':'Bearer ' + AUTHORIZATION - } + data = { + 'access_token' : AUTHORIZATION, 'message_id' : msgid, } - requests.post(url = url, data = json.dumps(data),headers = Headers) + requests.get(url = url, params=data) def getgroups(self): url = APIURL + "get_group_list" From fe4ee8e04191b7b90a526c0537c70161ab9ccefa Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 2 Aug 2020 21:57:54 +0800 Subject: [PATCH 100/240] add redis req --- req.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/req.txt b/req.txt index 7e172e6..f0400ac 100644 --- a/req.txt +++ b/req.txt @@ -17,6 +17,7 @@ mccabe==0.6.1 more-itertools==8.2.0 pycodestyle==2.5.0 pylint==2.4.4 +redis==3.5.3 requests==2.23.0 six==1.14.0 typed-ast==1.4.1 From 46df8a59f9edec2819f2bd7cdb1aa4f6e313b8b0 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 2 Aug 2020 23:13:31 +0800 Subject: [PATCH 101/240] update zzrouter --- route.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/route.py b/route.py index 43fb494..879bc06 100644 --- a/route.py +++ b/route.py @@ -2,6 +2,9 @@ from worker import emmm def ZZRouter(data): + if data['message'][0] != '/': + return + uid = data['user_id'] gid = data['group_id'] role = data['sender']['role'] From 4d6db364bd5251efcb3242fc2cdc791735f0a34c Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 2 Aug 2020 23:44:45 +0800 Subject: [PATCH 102/240] update pixiv --- worker/mc.py | 1 + worker/pixiv.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/worker/mc.py b/worker/mc.py index 7970eb9..7691d81 100644 --- a/worker/mc.py +++ b/worker/mc.py @@ -4,6 +4,7 @@ from subprocess import getoutput,call class Ans(StdAns): AllowGroup = [959613860, 125733077, 204097403, 1140391080] + AllowUser = [1318000868] def GETMSG(self): if len(self.parms) < 2: return '不加参数是坏文明!' diff --git a/worker/pixiv.py b/worker/pixiv.py index b376309..e649d5d 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -22,8 +22,7 @@ class Ans(StdAns): return msg else: - keyword = self.raw_msg['message'][7:] - + keyword = self.parms[1] if mysakuya(self, keyword) == False: return "不许你们看咲夜的涩图!!" @@ -32,6 +31,9 @@ class Ans(StdAns): resp = requests.get(url=url,params=params).json() picurl = resp['data'][0]['url'] msg = '[CQ:at,qq=' + str(self.uid) + ']' + '咱帮你🔍 ' + keyword + ' 找到了这个\n' + picurl + + if len(self.parms) > 2 and self.parms[2] == 'p' : + msg = '[CQ:image,file=' + picurl + ']' # .replace('https://i.pixiv.cat', 'https://pximg.sihuan.workers.dev') # msg = picurl.replace('https://i.pixiv.cat', 'https://original.img.cheerfun.dev') except Exception as e: From b13971be672f555db9872a4d07c6fe202744575e Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 3 Aug 2020 11:56:59 +0800 Subject: [PATCH 103/240] update music --- worker/music.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/music.py b/worker/music.py index 2979974..18c68ae 100644 --- a/worker/music.py +++ b/worker/music.py @@ -7,11 +7,11 @@ class Ans(StdAns): return '不加参数是坏文明!' # url = 'https://api.imjad.cn/cloudmusic/' - # url = 'https://music.jeeas.cn/v1/search' - url = 'http://mc.sakuya.love:3000/search' + url = 'https://music.jeeas.cn/v1/search' + # url = 'http://mc.sakuya.love:3000/search' params = { 'limit': 1, - 'keywords':self.raw_msg['message'][6:], + 's':self.raw_msg['message'][6:], } try: resp = requests.get(url=url,params=params).json() From 0011945c570c481e92f0cbd53846d9434a5016aa Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 3 Aug 2020 12:04:06 +0800 Subject: [PATCH 104/240] update zzrouter --- route.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/route.py b/route.py index 879bc06..54fb6de 100644 --- a/route.py +++ b/route.py @@ -2,9 +2,9 @@ from worker import emmm def ZZRouter(data): - if data['message'][0] != '/': + if data['post_type'] != 'message' or data['message_type'] != 'group' or data['message'][0] != '/': return - + uid = data['user_id'] gid = data['group_id'] role = data['sender']['role'] From 69257ae1927da82bbd75880c88619f56daa3c060 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 3 Aug 2020 12:34:00 +0800 Subject: [PATCH 105/240] update music --- worker/music.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/worker/music.py b/worker/music.py index 18c68ae..3c7244c 100644 --- a/worker/music.py +++ b/worker/music.py @@ -15,9 +15,10 @@ class Ans(StdAns): } try: resp = requests.get(url=url,params=params).json() - # print(resp) + print(resp) musicid = resp['result']['songs'][0]['id'] - msg = '[CQ:music,type=163,id='+ str(musicid)+']' + musicname = resp['result']['songs'][0]['name'] + msg = '[CQ:share,url=https://music.163.com/song/' + str(musicid) + '/,title=' + str(musicname) + ']' except Exception as e: print(e) msg = '什么东西坏掉了,大概是网易云吧...不可能是咱!' From df6bdb0820e85db15c965f5c26dc64cdfa7df723 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 3 Aug 2020 12:34:53 +0800 Subject: [PATCH 106/240] update music --- worker/music.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/music.py b/worker/music.py index 3c7244c..734c942 100644 --- a/worker/music.py +++ b/worker/music.py @@ -15,7 +15,7 @@ class Ans(StdAns): } try: resp = requests.get(url=url,params=params).json() - print(resp) + # print(resp) musicid = resp['result']['songs'][0]['id'] musicname = resp['result']['songs'][0]['name'] msg = '[CQ:share,url=https://music.163.com/song/' + str(musicid) + '/,title=' + str(musicname) + ']' From 7178ce3b8b880475cb1b02e43f5bec48b5518498 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 3 Aug 2020 15:28:59 +0800 Subject: [PATCH 107/240] add pixiv and lsp --- test.py | 2 +- worker/lsp.py | 42 ++++++++++++++++ worker/pixiv.py | 126 ++++++++++++++++++++++++++++++++++++------------ 3 files changed, 139 insertions(+), 31 deletions(-) create mode 100644 worker/lsp.py diff --git a/test.py b/test.py index 4edd64d..7d905b8 100644 --- a/test.py +++ b/test.py @@ -19,7 +19,7 @@ while(inp): Ans_ = emmm.Ans de(Ans_) try: - Ans = Ans_(parms,uid=0,gid=0,role='owner',raw_msg={'message':'/' + inp}) + Ans = Ans_(parms,uid=0,gid=0,role='owner',raw_msg={'message':'/' + inp, 'message_id' : '1001'}) Message = Ans.GETMSG() except Exception as e: Message = ' Error:\n'+str(e) diff --git a/worker/lsp.py b/worker/lsp.py new file mode 100644 index 0000000..e649d5d --- /dev/null +++ b/worker/lsp.py @@ -0,0 +1,42 @@ +from zzcore import StdAns, mysakuya +import requests + +from config import LOLIKEY + +class Ans(StdAns): + AllowGroup = [973510746, 805197917,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 204097403, 247022495, 474907856] + def GETMSG(self): + url = 'https://api.lolicon.app/setu/' + params = { + 'apikey': LOLIKEY, + } + + if len(self.parms) < 2: + try: + resp = requests.get(url=url,params=params).json() + picurl = resp['data'][0]['url'] + msg = picurl + except Exception as e: + print(e) + msg = '什么东西坏掉了,大概是Pixiv吧...不可能是咱!' + return msg + + else: + keyword = self.parms[1] + if mysakuya(self, keyword) == False: + return "不许你们看咲夜的涩图!!" + + params['keyword'] = keyword + try: + resp = requests.get(url=url,params=params).json() + picurl = resp['data'][0]['url'] + msg = '[CQ:at,qq=' + str(self.uid) + ']' + '咱帮你🔍 ' + keyword + ' 找到了这个\n' + picurl + + if len(self.parms) > 2 and self.parms[2] == 'p' : + msg = '[CQ:image,file=' + picurl + ']' + # .replace('https://i.pixiv.cat', 'https://pximg.sihuan.workers.dev') + # 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坏掉了' + return msg diff --git a/worker/pixiv.py b/worker/pixiv.py index e649d5d..f5fc362 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -1,42 +1,108 @@ -from zzcore import StdAns, mysakuya -import requests +from zzcore import StdAns + +from datetime import timedelta, datetime +import requests +import random -from config import LOLIKEY class Ans(StdAns): - AllowGroup = [973510746, 805197917,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 204097403, 247022495, 474907856] - def GETMSG(self): - url = 'https://api.lolicon.app/setu/' - params = { - 'apikey': LOLIKEY, - } - if len(self.parms) < 2: + def GETMSG(self): + + if len(self.parms) < 2: try: - resp = requests.get(url=url,params=params).json() - picurl = resp['data'][0]['url'] - msg = picurl + illust = rsearch('') except Exception as e: - print(e) - msg = '什么东西坏掉了,大概是Pixiv吧...不可能是咱!' + # print(e) + illust = {} + + elif self.parms[1] == 'help': + msg = '/pixiv 获取昨日随机日榜\n/pixiv [关键词] 使用关键词搜索,不可以有空格哦\n/pixiv id [插画id] 获取指定插画,不可以是漫画(\n/pixiv help 展示本 help' return msg + elif self.parms[1] == 'id' : + try: + id = int(self.parms[2]) + illust = getbyid(id) + except Exception as e: + illust = {} + else: - keyword = self.parms[1] - if mysakuya(self, keyword) == False: - return "不许你们看咲夜的涩图!!" - - params['keyword'] = keyword try: - resp = requests.get(url=url,params=params).json() - picurl = resp['data'][0]['url'] - msg = '[CQ:at,qq=' + str(self.uid) + ']' + '咱帮你🔍 ' + keyword + ' 找到了这个\n' + picurl - - if len(self.parms) > 2 and self.parms[2] == 'p' : - msg = '[CQ:image,file=' + picurl + ']' - # .replace('https://i.pixiv.cat', 'https://pximg.sihuan.workers.dev') - # msg = picurl.replace('https://i.pixiv.cat', 'https://original.img.cheerfun.dev') + illust = rsearch(self.parms[1]) except Exception as e: - print(e) - msg = '[CQ:at,qq=' + str(self.uid) + ']咱没查到 ' + keyword + ' 也有可能是Pixiv坏掉了' + illust = {} + + if illust == {}: + msg = '[CQ:reply,id={}] 看起来什么东西出错了 >_<\n稍后再试试吧'.format(str(self.raw_msg['message_id'])) + else : + imgid = str(illust['id']) + + imgtitle = illust['title'] + imgo = illust['imageUrls'][0]['original'].replace('https://i.pximg.net','https://i.pixiv.cat') + imgl = illust['imageUrls'][0]['large'].replace('https://i.pximg.net','https://i.pixiv.cat') + if self.parms[len(self.parms)-1] == 'o': + imgl = imgo + + msg = '[CQ:reply,id={}]咱帮你🔍找到了这个[CQ:image,file={}]\nid {}\ntitle {}\nurl {}'.format(str(self.raw_msg['message_id']), imgl, imgid, imgtitle, imgo) + # .replace('https://i.pixiv.cat', 'https://pximg.sihuan.workers.dev') + # msg = picurl.replace('https://i.pixiv.cat', 'https://original.img.cheerfun.dev' return msg + +def rsearch(s): + + r = random.randint(0, 233) + + if s == '': + url = 'https://api.pixivic.com/ranks' + yesterday = datetime.today() + timedelta(-1) + + params = { + 'date' : yesterday.strftime('%Y-%m-%d') , + 'mode' : 'day', + 'pageSize' : 1, + 'page' : r, + } + + else: + url = 'https://api.pixivic.com/illustrations' + params = { + 'keyword': s, + 'illustType': 'illust', + 'searchType': 'autoTranslate', + 'pageSize': 1, + 'page': r + } + + for _ in range(3): + print(r) + resp = requests.get(url=url, params=params).json() + if 'data' in resp : + if resp['data'][0]['type'] != 'illust': + params['page'] += 1 + continue + + return resp['data'][0] + params['page'] = int(params['page']/2) + + return {} + + +def getbyid(id): + + url = 'https://api.imjad.cn/pixiv/v2/' + params = { + 'type': 'illust', + 'id': id, + } + + resp = requests.get(url=url, params=params).json() + + if 'illust' in resp and resp['illust']['type'] == 'illust': + resp['illust']['imageUrls'] = [{ + 'large': resp['illust']['image_urls']['large'], + 'original': resp['illust']['meta_single_page']['original_image_url'] + }] + return resp['illust'] + + return {} From b3bce7cd334f92a3caf10f2406c3251014a127e4 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 3 Aug 2020 22:10:17 +0800 Subject: [PATCH 108/240] =?UTF-8?q?=E8=B0=81=E6=9D=A5=E8=B0=81=E5=85=88?= =?UTF-8?q?=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- route.py | 6 ++++++ zzcore.py | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/route.py b/route.py index 54fb6de..8198a59 100644 --- a/route.py +++ b/route.py @@ -1,7 +1,13 @@ from worker import emmm +from zzcore import DM def ZZRouter(data): + + if '[CQ:image,file=a854b2390d427b02fc26cae49d508a75.image]' in data['raw_message'] and data['user_id'] != 1318000868: + DM(data['message_id']) + + if data['post_type'] != 'message' or data['message_type'] != 'group' or data['message'][0] != '/': return diff --git a/zzcore.py b/zzcore.py index bed2c5c..3c86f72 100644 --- a/zzcore.py +++ b/zzcore.py @@ -77,4 +77,13 @@ def mysakuya(self, words): if sakuya in words: return False - return True \ No newline at end of file + return True + + +def DM(msgid): + url = APIURL + "delete_msg" + data = { + 'access_token' : AUTHORIZATION, + 'message_id' : msgid, + } + requests.get(url = url, params=data) \ No newline at end of file From 0c7a3d3a34b7470350d3d3147802f5507fd2a5e5 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 3 Aug 2020 22:20:12 +0800 Subject: [PATCH 109/240] add filter --- route.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/route.py b/route.py index 8198a59..f1f1d2a 100644 --- a/route.py +++ b/route.py @@ -4,7 +4,7 @@ from zzcore import DM def ZZRouter(data): - if '[CQ:image,file=a854b2390d427b02fc26cae49d508a75.image]' in data['raw_message'] and data['user_id'] != 1318000868: + if ('[CQ:image,file=a854b2390d427b02fc26cae49d508a75.image]' in data['raw_message'] or '[CQ:image,file=6a507d12d1542cbed37af4776a1cd066.image]' in data['raw_message']) and data['user_id'] != 1318000868: DM(data['message_id']) From f59adacdcf819bbdf0e7f405697acab7472ffd4a Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 3 Aug 2020 23:17:56 +0800 Subject: [PATCH 110/240] =?UTF-8?q?update=20=E8=B0=81=E5=85=88=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- route.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/route.py b/route.py index f1f1d2a..751b5e0 100644 --- a/route.py +++ b/route.py @@ -1,14 +1,23 @@ from worker import emmm from zzcore import DM +from config import DAAPI def ZZRouter(data): - if ('[CQ:image,file=a854b2390d427b02fc26cae49d508a75.image]' in data['raw_message'] or '[CQ:image,file=6a507d12d1542cbed37af4776a1cd066.image]' in data['raw_message']) and data['user_id'] != 1318000868: - DM(data['message_id']) - - if data['post_type'] != 'message' or data['message_type'] != 'group' or data['message'][0] != '/': + 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 uid = data['user_id'] From 4d6fb1fcee60a8192dddf05bbf8d25dddac09d22 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 3 Aug 2020 23:20:13 +0800 Subject: [PATCH 111/240] =?UTF-8?q?update=20=E8=B0=81=E5=85=88=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- route.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/route.py b/route.py index 751b5e0..2d1d278 100644 --- a/route.py +++ b/route.py @@ -2,10 +2,14 @@ from worker import emmm from zzcore import DM from config import DAAPI +import requests + def ZZRouter(data): 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( From d456dbd5bcd601b39bdeb598a15a71d1a986c9f1 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 4 Aug 2020 13:33:07 +0800 Subject: [PATCH 112/240] 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 From f144321c9437bbbf24cced2e0873433ff75b8bcb Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 4 Aug 2020 13:42:26 +0800 Subject: [PATCH 113/240] update lsp --- worker/lsp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/lsp.py b/worker/lsp.py index 990200a..200df08 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEY class Ans(StdAns): - AllowGroup = [973510746, 805197917,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 204097403, 247022495, 474907856] + AllowGroup = [ 805197917,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 204097403, 247022495, 474907856] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From 58b3a156ecde05af484f98b0f6c7cb6df44f2850 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 4 Aug 2020 13:45:15 +0800 Subject: [PATCH 114/240] update pixiv --- worker/pixiv.py | 1 + 1 file changed, 1 insertion(+) diff --git a/worker/pixiv.py b/worker/pixiv.py index f5fc362..ac6117d 100644 --- a/worker/pixiv.py +++ b/worker/pixiv.py @@ -6,6 +6,7 @@ import random class Ans(StdAns): + NotAllowGroup = [973510746] def GETMSG(self): From 0b701a7b335691e3f0ea43b1dd509f433329c690 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 4 Aug 2020 21:42:24 +0800 Subject: [PATCH 115/240] add hhsh --- worker/hhsh.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 worker/hhsh.py diff --git a/worker/hhsh.py b/worker/hhsh.py new file mode 100644 index 0000000..ec886f3 --- /dev/null +++ b/worker/hhsh.py @@ -0,0 +1,27 @@ +from zzcore import StdAns, mysakuya +import requests + +class Ans(StdAns): + def GETMSG(self): + if len(self.parms) < 2: + return '不加参数是坏文明!' + + if mysakuya(self, self.raw_msg['message']) == False: + return "不许你们说咲夜!!" + + msg = f"[CQ:reply,id={self.raw_msg['message_id']}]" + r = nbnhhsh(self.raw_msg['message'][6:]) + for i in r: + msg += f"{i['name']} {str(i['trans'])[1:-1]}\n" + + return msg + + +def nbnhhsh(text): + url = 'https://lab.magiconch.com/api/nbnhhsh/guess' + data = { + 'text': text, + } + + r = requests.post(url=url, data=data).json() + return r \ No newline at end of file From 2656a182aa946553a4b7af81de3efed81916b70a Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 4 Aug 2020 21:48:48 +0800 Subject: [PATCH 116/240] update hhsh --- worker/hhsh.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/worker/hhsh.py b/worker/hhsh.py index ec886f3..97df0ef 100644 --- a/worker/hhsh.py +++ b/worker/hhsh.py @@ -10,9 +10,8 @@ class Ans(StdAns): return "不许你们说咲夜!!" msg = f"[CQ:reply,id={self.raw_msg['message_id']}]" - r = nbnhhsh(self.raw_msg['message'][6:]) - for i in r: - msg += f"{i['name']} {str(i['trans'])[1:-1]}\n" + r = nbnhhsh(self.parms[1]) + msg += f'''{(str(r['trans'])[1:-1]).replace("'","").replace(","," ")}''' return msg @@ -24,4 +23,4 @@ def nbnhhsh(text): } r = requests.post(url=url, data=data).json() - return r \ No newline at end of file + return r[0] \ No newline at end of file From efefa846b3aca190b7aba9e0742cdde40ecec994 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 4 Aug 2020 22:00:28 +0800 Subject: [PATCH 117/240] add wyy --- worker/wyy.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 worker/wyy.py diff --git a/worker/wyy.py b/worker/wyy.py new file mode 100644 index 0000000..0bf0a3c --- /dev/null +++ b/worker/wyy.py @@ -0,0 +1,15 @@ +from zzcore import StdAns, mysakuya +import requests + +class Ans(StdAns): + def GETMSG(self): + msg = f"[CQ:reply,id={self.raw_msg['message_id']}]" + try: + msg += wyy() + except: + msg += '可能是网抑云坏掉了,可不是咱!' + return msg + +def wyy(): + r = requests.get(url='http://api.heerdev.top:4995/nemusic/random').json() + return r['text'] \ No newline at end of file From 62ee6ff4505286d27d24e4d085530bdc7fd8dbb9 Mon Sep 17 00:00:00 2001 From: DD6181S03 Date: Wed, 5 Aug 2020 21:03:48 +0800 Subject: [PATCH 118/240] update madoka quote --- data/madoka/quote.db | Bin 0 -> 24576 bytes worker/madoka.py | 45 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 data/madoka/quote.db create mode 100644 worker/madoka.py diff --git a/data/madoka/quote.db b/data/madoka/quote.db new file mode 100644 index 0000000000000000000000000000000000000000..1fe3c99d404aa3b5d6db4d5e2cdc8e775c47184b GIT binary patch literal 24576 zcmeHPS!`q1d8S5-N1Bo3Y1)kIB$hnRq;|)43^;vp8>Aj%U`!J)V^5nn4G_5Pv{}YU zT~C0v0a{*aBejs!h}ua}BazytjMX^BhlBf2qFMS9co_jC*VxUEuhZJtV@BEi{ zXc>M8kT`B|jq#W~Jj?%o|8max|Nr>aYhU{2tsA|6`Q5*Ha}|acnEk1 zcnEk1cnEk1cnEk1cnEk1cnEw*2;i1B_aQCyb1w7p>9+HiE;YS&>-9godE>1&Z{o)K z^|x-k`Mn$8`SX)sTb_I6%Cpz6^j?4V@|Ujkp6L7NcV2(v#^V_I7zl{{oJ9Q6yT8?O z-}&?Bn~W=(%{RaI-CJN0f1P>{OBZz8h2BRy+AnMSUwHPF z*LuHr<+a{t|M>b#S6{@i7p}Z`{c&`>b>nYuU1-04+rNT8=1f@s z$yEzQG^*69%I;SSertZu8riakHt@MxEUNgL8JsbvrmeYte0}F=RBaDf{rh&_sP&c2 zojYbcq$1;1I4{%Mm06Wt;Ha6Lv|wqK3#i-zSD74^#@b=Un$N2EAo#rY3*uF#>HB0? zt8ehJ9(7o-RwAIHTJl#9gKB)~oueeb7Gq{S2yVc=+L)`&?5cqf*uqa{VcndY!cRa# z6*Erb^m;9wL8CPgw&zFCSS=5tGZ?KF=ZV2gPNmk>e7QC>DtHj8LflSQe(Vo)d=MS> z(k3uekxjx99aEWUSx=20saOg>k&cFTNJJfM+kIt~O3GL>1Brc#4r z=GGl+zECrUAZ&ETgtfqO^>9Rm#z<^r13X#Dj5!y;gw{$)1vhQ~s5;nbBrtIGY^!ge zxd-czif|s&U|BPEtd9EZ$_y=OdL6uRg?t1gTd_HNXxBbSnu#>pAqs1C44j)&leMmoGx?yH#=H=p{rCB+Dc^>Mki8%PEZnBb%bh64BSBi*0(D|)Btc9 z-+;!T1Mv+Gk>2S=J6ptT=KQf$iU^nJPXe<;Dm%-0Dl_QN2*Z1Sot4>usJo(zgz%>Z z*6^zk1ARp!ft+46C-cCvHoXT&#zw8&m<>CEmPQfS&|Zc&)bKnyxC=E-1wD4A+Pb4A zGUo0w7nRAk?$nI2YI&lzyHGt!afz|LYH19+iP>K<`y;XwVHIcN$Q=S(Q2~lYQvyAs z2IrFYY6xJ0HC6BCjN*nBm8lvX?5->BV+R&K2LPu>vvXPOKIH$|C%^5YYM{0C_F$CtIZirUfncNO<5heD}jW@R-m}bhKh?a20lL zK;6FW>^*Ws7=-sqsqC)XDE?A320jTCS+Q*`iHbQgKvuM=nj>*DG$W)@?O?5OzleooFIlE6Eui7Kvb45ekgS&MjE6 zq-;$hH9{~vELM&U)gAI2Lz;;YpX^&&%FuShOhiG(--Pum0u`WPL5AaqJ z=BQz9jjQY-iGed&S+kbLsGY@mEM%|tt027`eRh0=3PMo&ti?T*h?rp>)SUL%p^D7l zC$vyZ`E4;JOrk1%Fo{Od1UgzfjjK|sq<^@FoZZ{YrB2=5&2O11zwv^ox%2Z{|dw}~yLHd#@r ze!Vj9Db8u4FG8Rf56tN$ZbLW*6|!o0U0ehSJWOJXp#W&w`utpmbK*(Mbw4y8IXy0o zT1(u{U_m_L?UkSn+|8q_bd-T*0j63?fm*Og4-=b#a>zntT3>|(7y<^by>mwmFMu#m zjx&+tI{-}mPyvMSQ=I; z-Z~CL^)y~1R%pF(fljQ@)cq4*_fNWiB-bkMZw~eBI5HzRtn3|9bZOXMS|%srLVB|LgYl(?7Ux zyQS3fV)OqrPj*jrcXqwg^_kB9?VRuYd}qhm#j_7~{9DH#w6~mo_cSy5pX(r?~`L$-yWA0agz>QBLybWY9o4`XqPqy;A+9Hh9z>+AbkN)m zAUZ9PcnLis4rop;o3}GaDyrzHl?h>#q<9ectCpkH(uA3as7&~0AVxG**#hh#n%1{Djt4~*9s40VnikyJPIid;TI>ZndZJXxnc#|Rn7 z)ag-Ku!9ladN~UyksP6$(^XS3XLbp6BO6-(;LeV?K8h8924d+*a=BSjtc2niD{)9+ zV%1DZreZe9A7(5&G=^-7IXR9F7=EwaA7;BwjmTIvUbZVy^bv7FDI~qXydUy`^$df% zG%}jzRNgLUQKtZLbTnj43@~7aH(8T1u&-8_>t~|!IA|LCz}WekI~3#yM{W-b6DA!y zXQlz6`gjoK7%Dhtm$xKOfe$LPf^3U}7iv(T*ttUtlu4ZS_qBjS^psya?EPVU0r@JW zi#_t&(xQwADm~Cu$_gZ@BPn%}Cb*R34WjW(v=nd45aPP#w{sar=?hW*(dh#U%|Ay~ z)wv6@ms&NEWSw4@yr^9{un$mX!~&7G{c#FsBqy?Z+n;c=K1^%|6A-Vg&gGB}3+7?Q z$k6etquPJqSR&&)Ib`^9MfQi9O$Yn>rwzbBty5B+eDhBS{gwG z0Tj}81kass@%>$oQ>RuJ9cyEB*#%~3{K*WbRb*OzqHOE9-uO6N*YE4xQzc>N3}@kb znz(L)hG0$WL8c`&hf*8ll%+G=BmJZLwO!a7LqH#i|Dk9wPh7;r@x zA^w8kr;@T1Rsio%d{l%n4XYEB=!tpAAlx<_lcb@gCPH^W&w8JGa0QC{lA`F9A+QY;E##YO5 zd(YW6FbU19Zx?^)nowAW(u!587zRq+VGY_B$&shblDJ@%+D7h8`Z!5?U8BSTgG`F% zgbW<&5Gvd+^dtsVOlQQ&rp_5lDG3Op?Xe`u5Wt*dZ=C=Y3EH`|vx^KbI6doXVm$FN z$*JnRs93J}JBnv2BYp{WBgl@b2|s<&VAwR)D2C}pmfcN`+he*iL8nQff|!H_g}F&< zGl_B_U=Oj`xk)vD?21{6%&4z0hNC$vw1jdo48+n_Ko_6o3nW0-t~IK)@xX8BN)CG@ zP2C*d#Z1P9@Z7 zW@jKIVcf;>!P=a)Hnl&~Wpa(Ay?PFoaGsVxmIn`NiCIj<^8(yZbQFbxs80ZB)@IHe z9jEG{7;cl$SzBu;(8LFGlIM%YNsXuP2fts&5o8EVu?tE)lQA%*az{9MFjF5-l3Em{ z9`3LV20y{C_eU@dG^tvMQLV+JrbE_fR;*kbH%s-9`No!M4yVyyPGVvM>IiEMm}%CM zI5iHr1UV~DQ0Gu0)KHrT!Wyam`))v?EfRF2B-7qoR;eKY9s3Iia$PEiX`6FW*eI{l zM;#fWEtn+>Sim{LX?Q^a`5Z9pY~jS($p3!ip2GhM&fFiVCBN}0Zbld1QzV6&+({PL zvRp7c2(6&=(S?XKnV8n;p%`NsODF>h>EUie@X5$^8v-O{RA8UQ4x%HXu z?e3dhM_qr~^$`J)o6jR~)za1Qte-o`IltDYm4S`^8%(!+<0%mG(mAL87ncTO4o6&jHDKQ5 zAxX{wIBesvG4 zk>o*BS9Aj);3D+lP%ov!=5)GxG>yY=wi-XC=NvSeAE`|?0rRoY)b{^VC#7R2y6_bAF(gD@R;fL@d#-wYr zDPOs+6l1u$fe+4dJdK{b=i^F+@>O|Taj=H7KJL}EAs+WdxFC^0)?X#?_+HqM`fNaj zm>iZ9vA*p`s4rHV<4Y920zyekDMA&sU)Vvp}U$CnpA^6U=$x?9r>|VZE4z^Nm^05O*OoT z$PdM(#R&GGtXPF17J1zCKABgGDXTQ=tR?Zrg`Bm?=X)YLY5_dN3hrWfb%y|E5|)6% zVZ1wHzzT29>YkB|i|M0gTN4j`p=WkVj8mxAt_#^{{ar}7{hR~Vd>Ic2S@(~M=}ElJ z(Bew(n*LR56$V{|B8W9Z7r>|Z1UMqZ)WjsD&YBGCg|%QH=d?S#(M~XlaB}VPx9~si zGG0ALvFjiQHLl@$iJovx^k(`cn2up2<%O6yZMtigG|Mw7KB9qvQD(4AS{5JN;j>np zryp(c{S}r9LppFAtb^8W2*kQfxQ_-jfyTAVH-3jV7{-|BG7z@Xu`GFv=4LBsUMTBE zX}u0F$ZV9Cey67AXB2|)fTG}#w1X&huvaUVkOuhnXRyrkJ%}~bG69uMSjk=5erD1R z?6}y<1_;B~?_PB_C9(m6VA_l-Q9oD$Pg=DeI1B5~jf*{bvBme2^CqT#2iGr7(`9T= zq*C4r)`>G-`ZQc(cMq!VwT=bds~97}$W$cK@*qQAdRbfW_`I=U%?^x#t%D?aPC)qd zYdQ2lBt(X3viaN$jq-Gh9!Wo|6pk-%F^l^gps|rd+?Pk%ISH~S7BHT87{>U8OHS-v;-1 Date: Wed, 5 Aug 2020 21:32:35 +0800 Subject: [PATCH 119/240] fix madaka --- worker/madoka.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/madoka.py b/worker/madoka.py index 0d05a92..6035fa6 100644 --- a/worker/madoka.py +++ b/worker/madoka.py @@ -7,7 +7,7 @@ n = {'madoka': '鹿目圆', 'homura': '晓美焰', 'sayaka': '美树沙耶香', def getQuote(name='random'): - conn = sqlite3.connect('../data/madoka/quote.db') + conn = sqlite3.connect('./data/madoka/quote.db') cursor = conn.cursor() msg = '' try: From 7c85ffa984450a53fa4b7e8fe61ac11df2e89544 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 11 Aug 2020 10:24:28 +0800 Subject: [PATCH 120/240] =?UTF-8?q?=E5=9B=9E=E6=BB=9A=20router=20=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E5=8D=87=E7=A8=B3=E5=AE=9A=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- route.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/route.py b/route.py index 2d1d278..54fb6de 100644 --- a/route.py +++ b/route.py @@ -1,27 +1,8 @@ from worker import emmm -from zzcore import DM -from config import DAAPI - -import requests def ZZRouter(data): - 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 uid = data['user_id'] From d0f1a51e7ca2130befe72254e4e65cc63d5c5842 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 11 Aug 2020 22:52:59 +0800 Subject: [PATCH 121/240] =?UTF-8?q?add=20=E5=85=AD=E5=A4=9C=20my=20sakuya?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zzcore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zzcore.py b/zzcore.py index 3c86f72..da88478 100644 --- a/zzcore.py +++ b/zzcore.py @@ -73,7 +73,7 @@ def mysakuya(self, words): if ('咲' in words and '夜' in words) or ('关' in words and '夜' in words) or ('十' in words and '六' in words and '夜' in words) or ('1' in words and '6' in words and '夜' in words): return False - for sakuya in ['口关夜','十六夜咲夜','十六夜','十六','咲夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: + for sakuya in ['口关夜','十六夜咲夜','十六夜','十六','咲夜', '夜咲', '六夜','Sakuya','sakuya','Izayoi Sakuya','Izayoi','izayoi','izayoi sakuya']: if sakuya in words: return False From 54acb29f01ee48d9258396cd84bce7d27d23ed5b Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 12 Aug 2020 11:04:27 +0800 Subject: [PATCH 122/240] lsp add 973510746 --- worker/lsp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/lsp.py b/worker/lsp.py index 200df08..990200a 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEY class Ans(StdAns): - AllowGroup = [ 805197917,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 204097403, 247022495, 474907856] + AllowGroup = [973510746, 805197917,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 204097403, 247022495, 474907856] def GETMSG(self): url = 'https://api.lolicon.app/setu/' params = { From ce475517bcfd8ec60c15765b0ccea3db3744a34a Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 12 Aug 2020 19:31:57 +0800 Subject: [PATCH 123/240] add var HOST --- main.py | 5 ++--- sample_config.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index d031539..ac335eb 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,5 @@ from flask import Flask, request -from config import PORT +from config import HOST, PORT from route import ZZRouter app = Flask(__name__) @@ -9,5 +9,4 @@ def whenmsg(): ZZRouter(request.get_json()) return '' -app.run(host='0.0.0.0',port = PORT, debug=True) - +app.run(host= HOST,port = PORT, debug=True) \ No newline at end of file diff --git a/sample_config.py b/sample_config.py index 381f5b2..56baf85 100644 --- a/sample_config.py +++ b/sample_config.py @@ -4,6 +4,6 @@ APIURL = 'http://127.0.0.1:5700/' AUTHORIZATION = '' -PORT = 5580 - +HOST = '0.0.0.0' +PORT = 5580 \ No newline at end of file From b8a485dfeb03a2b6d5d72f4aab6457bce3b00541 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 12 Aug 2020 19:33:15 +0800 Subject: [PATCH 124/240] update req.txt --- req.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/req.txt b/req.txt index f0400ac..2026441 100644 --- a/req.txt +++ b/req.txt @@ -3,6 +3,8 @@ autopep8==1.5 certifi==2019.11.28 chardet==3.0.4 Click==7.0 +entrypoints==0.3 +flake8==3.7.9 Flask==1.1.1 idna==2.9 importlib-metadata==1.5.0 @@ -16,8 +18,9 @@ MarkupSafe==1.1.1 mccabe==0.6.1 more-itertools==8.2.0 pycodestyle==2.5.0 +pyflakes==2.1.1 pylint==2.4.4 -redis==3.5.3 +redis==3.4.1 requests==2.23.0 six==1.14.0 typed-ast==1.4.1 From 23fd67f31cc3e4e9c6f83ebf2ba4f920773209d6 Mon Sep 17 00:00:00 2001 From: "2920233418@qq.com" <2920233418@qq.com> Date: Sat, 15 Aug 2020 23:18:30 +0800 Subject: [PATCH 125/240] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8D=81=E8=BF=9E?= =?UTF-8?q?=EF=BC=8C=E5=8D=95=E6=8A=BD=E4=B8=A4=E4=B8=AA=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pcr.char | 6 +++++ worker/pcr.py | 67 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 worker/pcr.char diff --git a/worker/pcr.char b/worker/pcr.char new file mode 100644 index 0000000..9912ffe --- /dev/null +++ b/worker/pcr.char @@ -0,0 +1,6 @@ +3* +镜华 真步 初音 伊绪 璃乃 亚里莎 杏奈 咲恋 伊莉亚 妮侬 莫妮卡 静流 姬塔 佩可莉姆(夏日) 秋乃 真琴 望 纯 +2* +雪 千歌 美里 栞 铃奈 茜里 深月 铃 美冬 真阳 忍 美美 惠理子 珠希 绫音 纺希 香织 空花 宫子 +1* +优衣 碧 美咲 凯露 铃莓 依里 可可萝 由加莉 怜 胡桃 未奏希 日和莉 佩可莉姆 莉玛 \ No newline at end of file diff --git a/worker/pcr.py b/worker/pcr.py index b63e893..81b6db4 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -1,7 +1,9 @@ import json from zzcore import StdAns +from random import randint, choice +from time import sleep -AllowCMD = ['登记','申请出刀','报刀','挂树','查树','进度','查刀','新的一天','血量','boss','初始化','求助','迁移','踢人'] +AllowCMD = ['登记','申请出刀','报刀','挂树','查树','进度','查刀','新的一天','血量','boss','初始化','求助','迁移','踢人','单抽','十连'] status = { 'all_player':{ @@ -275,6 +277,69 @@ class Ans(StdAns): on_tree_players = on_tree_players + nowdata['all_player'][str(p)]['id'] + '\n' return '救命[CQ:at,qq=3178302597][CQ:at,qq=3430357110]\n' + on_tree_players + '都在🌳上' + if cmd == '单抽' or cmd == '十连': + times = 1 if cmd == '单抽' else 9 + try: + with open('pcr.char', 'r+', encoding='utf-8') as f: + characters = f.readlines() + except: + return '好像角色名单没有加载呢。。。' + star3 = characters[1].replace('\n','').split(' ') + star3 = [each for each in star3 if each] + star2 = characters[3].replace('\n', '').split(' ') + star2 = [each for each in star2 if each] + star1 = characters[5].replace('\n', '').split(' ') + star1 = [each for each in star1 if each] + resultStar = [] + resultName = [] + for each in range(times): + code = randint(1,200) + if code <= 5: + resultStar.append(3) + resultName.append(choice(star3)) + elif code <= 41: + resultStar.append(2) + resultName.append(choice(star2)) + else: + resultStar.append(1) + resultName.append(choice(star1)) + if times == 9: + code = randint(1, 200) + if code <= 5: + resultStar.append(3) + resultName.append(choice(star3)) + else: + resultStar.append(2) + resultName.append(choice(star2)) + stones = 0 + colors = '' + for each in range(len(resultStar)): + if resultStar[each] == 3: + stones = stones + 50 + color = '彩' + elif resultStar[each] == 2: + stones = stones + 10 + color = '金' + else: + stones = stones + 1 + color = '银' + if each == 4:colors = colors + color + '\n' + else:colors = colors + color + ' ' + name = '' + for each in range(len(resultName)): + if each == 4:name = name + '\n' + else:name = name + resultName[each] + ' ' + name = name + '\n母猪石 +{} /xyx'.format(stones) + self.sendmsg(colors) + sleep(3) + self.sendmsg(name) + if stones <= 19:msg = '非洲酋长,吃在下一拜!' + elif stones < 59:msg = '非洲血统。。。玄不改非,不过648可以改命。' + elif stones < 100:msg = '运气不错,再接再厉!' + elif stones < 150:msg = '捕获一只野生欧洲人!' + else :msg = '欧皇啊!恐怖如斯/wosl' + return msg + def bossname(num): From b8a80008129a9bfa1930563ab943b50617941d9a Mon Sep 17 00:00:00 2001 From: "2920233418@qq.com" <2920233418@qq.com> Date: Sun, 16 Aug 2020 00:00:05 +0800 Subject: [PATCH 126/240] =?UTF-8?q?=E4=BF=AE=E6=94=B9char=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pcr.char => data/pcr/char | 0 worker/pcr.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename worker/pcr.char => data/pcr/char (100%) diff --git a/worker/pcr.char b/data/pcr/char similarity index 100% rename from worker/pcr.char rename to data/pcr/char diff --git a/worker/pcr.py b/worker/pcr.py index 81b6db4..d708327 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -280,7 +280,7 @@ class Ans(StdAns): if cmd == '单抽' or cmd == '十连': times = 1 if cmd == '单抽' else 9 try: - with open('pcr.char', 'r+', encoding='utf-8') as f: + with open('./data/pcr/char', 'r+', encoding='utf-8') as f: characters = f.readlines() except: return '好像角色名单没有加载呢。。。' From a9e9a28af62fb9af08940d0f3c9df8b2b3dbcb00 Mon Sep 17 00:00:00 2001 From: "2920233418@qq.com" <2920233418@qq.com> Date: Sun, 16 Aug 2020 08:00:04 +0800 Subject: [PATCH 127/240] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug=EF=BC=8C=E5=8A=A0?= =?UTF-8?q?=E5=85=A5emoji=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pcr.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/worker/pcr.py b/worker/pcr.py index d708327..398f2e0 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -1,7 +1,6 @@ import json from zzcore import StdAns from random import randint, choice -from time import sleep AllowCMD = ['登记','申请出刀','报刀','挂树','查树','进度','查刀','新的一天','血量','boss','初始化','求助','迁移','踢人','单抽','十连'] @@ -327,18 +326,13 @@ class Ans(StdAns): else:colors = colors + color + ' ' name = '' for each in range(len(resultName)): - if each == 4:name = name + '\n' + if each == 4:name = name + resultName[each] + '\n' else:name = name + resultName[each] + ' ' - name = name + '\n母猪石 +{} /xyx'.format(stones) + name = name + '\n母猪石 +{} [CQ:face,id=108]'.format(stones) self.sendmsg(colors) - sleep(3) self.sendmsg(name) - if stones <= 19:msg = '非洲酋长,吃在下一拜!' - elif stones < 59:msg = '非洲血统。。。玄不改非,不过648可以改命。' - elif stones < 100:msg = '运气不错,再接再厉!' - elif stones < 150:msg = '捕获一只野生欧洲人!' - else :msg = '欧皇啊!恐怖如斯/wosl' - return msg + if stones == 19:return '非酋在上,请受我一拜[CQ:face,id=0][CQ:face,id=118]' + elif stones > 157:return '欧皇![CQ:face,id=23]啊我酸了' From e78563fdca2a7a62cd82f6e56c1362e5dd32a306 Mon Sep 17 00:00:00 2001 From: "2920233418@qq.com" <2920233418@qq.com> Date: Sun, 16 Aug 2020 08:27:08 +0800 Subject: [PATCH 128/240] =?UTF-8?q?=E5=8A=A0=E5=85=A5up=E6=9C=BA=E5=88=B6?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/pcr/char | 12 +++++++----- worker/pcr.py | 19 ++++++++++++++----- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/data/pcr/char b/data/pcr/char index 9912ffe..fc30e6a 100644 --- a/data/pcr/char +++ b/data/pcr/char @@ -1,6 +1,8 @@ -3* -镜华 真步 初音 伊绪 璃乃 亚里莎 杏奈 咲恋 伊莉亚 妮侬 莫妮卡 静流 姬塔 佩可莉姆(夏日) 秋乃 真琴 望 纯 -2* +3* 2.5% +镜华 真步 初音 伊绪 璃乃 亚里莎 杏奈 咲恋 伊莉亚 妮侬 莫妮卡 静流 姬塔 秋乃 真琴 望 纯 +2* 18% 雪 千歌 美里 栞 铃奈 茜里 深月 铃 美冬 真阳 忍 美美 惠理子 珠希 绫音 纺希 香织 空花 宫子 -1* -优衣 碧 美咲 凯露 铃莓 依里 可可萝 由加莉 怜 胡桃 未奏希 日和莉 佩可莉姆 莉玛 \ No newline at end of file +1* 79.5% +优衣 碧 美咲 凯露 铃莓 依里 可可萝 由加莉 怜 胡桃 未奏希 日和莉 佩可莉姆 莉玛 +up 0.7% +佩可莉姆(夏日) \ No newline at end of file diff --git a/worker/pcr.py b/worker/pcr.py index 398f2e0..0c40fb8 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -276,6 +276,7 @@ class Ans(StdAns): on_tree_players = on_tree_players + nowdata['all_player'][str(p)]['id'] + '\n' return '救命[CQ:at,qq=3178302597][CQ:at,qq=3430357110]\n' + on_tree_players + '都在🌳上' + if cmd == '单抽' or cmd == '十连': times = 1 if cmd == '单抽' else 9 try: @@ -289,24 +290,32 @@ class Ans(StdAns): star2 = [each for each in star2 if each] star1 = characters[5].replace('\n', '').split(' ') star1 = [each for each in star1 if each] + up = characters[7].replace('\n', '').split(' ') + up = [each for each in up if each] resultStar = [] resultName = [] for each in range(times): - code = randint(1,200) - if code <= 5: + code = randint(1,1000) + if code <= 18: resultStar.append(3) resultName.append(choice(star3)) - elif code <= 41: + elif code <= 25: + resultStar.append(3) + resultName.append(choice(up)) + elif code <= 205: resultStar.append(2) resultName.append(choice(star2)) else: resultStar.append(1) resultName.append(choice(star1)) if times == 9: - code = randint(1, 200) - if code <= 5: + code = randint(1, 1000) + if code <= 18: resultStar.append(3) resultName.append(choice(star3)) + elif code <= 25: + resultStar.append(3) + resultName.append(choice(up)) else: resultStar.append(2) resultName.append(choice(star2)) From 6f2ddcae9e5fbd1fdf8ce441fdc107b4acb6cd43 Mon Sep 17 00:00:00 2001 From: "2920233418@qq.com" <2920233418@qq.com> Date: Sun, 16 Aug 2020 18:50:48 +0800 Subject: [PATCH 129/240] =?UTF-8?q?=E6=8A=BD=E5=8D=A1@=E4=BA=BA=EF=BC=8Ccl?= =?UTF-8?q?ass=E5=86=85=E5=8A=A0=E5=85=A5=E6=98=B5=E7=A7=B0=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- route.py | 5 +++-- worker/pcr.py | 2 +- zzcore.py | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 1dc8a82..69ed991 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ env __pycache__ .vscode -config.py \ No newline at end of file +config.py +.idea \ No newline at end of file diff --git a/route.py b/route.py index 54fb6de..71ad234 100644 --- a/route.py +++ b/route.py @@ -9,7 +9,8 @@ def ZZRouter(data): gid = data['group_id'] role = data['sender']['role'] parms = str.split(data['message'][1:]) - print(uid, gid, role, parms) + nickname = data['sender']['nickname'] + print(uid, gid, role, parms, nickname) if parms == []: parms[0] = 'help' worker = parms[0] @@ -20,7 +21,7 @@ def ZZRouter(data): except: Ans_ = emmm.Ans - Ans = Ans_(parms, uid, gid, role, data) + Ans = Ans_(parms, uid, gid, role, data, nickname) Message = Ans.CheckPermission() if Message == 0: Message = Ans.GETMSG() diff --git a/worker/pcr.py b/worker/pcr.py index 0c40fb8..f3adcb1 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -320,7 +320,7 @@ class Ans(StdAns): resultStar.append(2) resultName.append(choice(star2)) stones = 0 - colors = '' + colors = '@{}\n'.format(self.nickname) for each in range(len(resultStar)): if resultStar[each] == 3: stones = stones + 50 diff --git a/zzcore.py b/zzcore.py index da88478..af1da0b 100644 --- a/zzcore.py +++ b/zzcore.py @@ -12,12 +12,13 @@ class StdAns(): UserNotAllow = '汝不被允许呢.' RoleNotAllow = '汝的角色不被允许哦.' - def __init__(self,parms,uid,gid,role,raw_msg): + def __init__(self,parms,uid,gid,role,raw_msg,nickname): self.parms = parms self.uid = uid self.gid = gid self.role = role self.raw_msg = raw_msg + self.nickname = nickname def DATAGET(self): return r.hgetall(self.parms[0]) From 678c13b48be7a372c34c6f9488fc925923b588c1 Mon Sep 17 00:00:00 2001 From: "2920233418@qq.com" <2920233418@qq.com> Date: Sun, 16 Aug 2020 19:11:44 +0800 Subject: [PATCH 130/240] new --- .gitignore | 3 ++- route.py | 3 +-- zzcore.py | 9 ++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 69ed991..2e3c5c9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ env __pycache__ .vscode config.py -.idea \ No newline at end of file +.idea +test.py \ No newline at end of file diff --git a/route.py b/route.py index 71ad234..cd1f13e 100644 --- a/route.py +++ b/route.py @@ -9,8 +9,7 @@ def ZZRouter(data): gid = data['group_id'] role = data['sender']['role'] parms = str.split(data['message'][1:]) - nickname = data['sender']['nickname'] - print(uid, gid, role, parms, nickname) + print(uid, gid, role, parms) if parms == []: parms[0] = 'help' worker = parms[0] diff --git a/zzcore.py b/zzcore.py index af1da0b..a00dc6d 100644 --- a/zzcore.py +++ b/zzcore.py @@ -1,8 +1,8 @@ -import requests, json, redis +import requests, json#, redis from config import APIURL, ALLWORKERS, AUTHORIZATION from worker import emmm -pool = redis.ConnectionPool(host='127.0.0.1', port=6379, decode_responses=True) -r = redis.Redis(connection_pool=pool) +# pool = redis.ConnectionPool(host='127.0.0.1', port=6379, decode_responses=True) +# r = redis.Redis(connection_pool=pool) class StdAns(): AllowGroup = [] @@ -12,13 +12,12 @@ class StdAns(): UserNotAllow = '汝不被允许呢.' RoleNotAllow = '汝的角色不被允许哦.' - def __init__(self,parms,uid,gid,role,raw_msg,nickname): + def __init__(self,parms,uid,gid,role,raw_msg): self.parms = parms self.uid = uid self.gid = gid self.role = role self.raw_msg = raw_msg - self.nickname = nickname def DATAGET(self): return r.hgetall(self.parms[0]) From 8ee7534de12f2db6213afdec9a27cb0b64e1d2e3 Mon Sep 17 00:00:00 2001 From: "2920233418@qq.com" <2920233418@qq.com> Date: Sun, 16 Aug 2020 19:13:19 +0800 Subject: [PATCH 131/240] new --- route.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/route.py b/route.py index cd1f13e..54fb6de 100644 --- a/route.py +++ b/route.py @@ -20,7 +20,7 @@ def ZZRouter(data): except: Ans_ = emmm.Ans - Ans = Ans_(parms, uid, gid, role, data, nickname) + Ans = Ans_(parms, uid, gid, role, data) Message = Ans.CheckPermission() if Message == 0: Message = Ans.GETMSG() From b90f1235a81f20acc680cd136da6e564861849a4 Mon Sep 17 00:00:00 2001 From: "2920233418@qq.com" <2920233418@qq.com> Date: Sun, 16 Aug 2020 20:13:41 +0800 Subject: [PATCH 132/240] =?UTF-8?q?=E6=96=B0=E5=A2=9E@?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pcr.py | 2 +- zzcore.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/worker/pcr.py b/worker/pcr.py index f3adcb1..f6d498e 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -320,7 +320,7 @@ class Ans(StdAns): resultStar.append(2) resultName.append(choice(star2)) stones = 0 - colors = '@{}\n'.format(self.nickname) + colors = '[CQ:at,qq={}]\n'.format(self.uid) for each in range(len(resultStar)): if resultStar[each] == 3: stones = stones + 50 diff --git a/zzcore.py b/zzcore.py index a00dc6d..da88478 100644 --- a/zzcore.py +++ b/zzcore.py @@ -1,8 +1,8 @@ -import requests, json#, redis +import requests, json, redis from config import APIURL, ALLWORKERS, AUTHORIZATION from worker import emmm -# pool = redis.ConnectionPool(host='127.0.0.1', port=6379, decode_responses=True) -# r = redis.Redis(connection_pool=pool) +pool = redis.ConnectionPool(host='127.0.0.1', port=6379, decode_responses=True) +r = redis.Redis(connection_pool=pool) class StdAns(): AllowGroup = [] From dd5678498339e2fca109390f16ab6cf71e3d5870 Mon Sep 17 00:00:00 2001 From: "2920233418@qq.com" <2920233418@qq.com> Date: Sun, 16 Aug 2020 20:16:35 +0800 Subject: [PATCH 133/240] new --- worker/pcr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pcr.py b/worker/pcr.py index f6d498e..c7d97a6 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -335,7 +335,7 @@ class Ans(StdAns): else:colors = colors + color + ' ' name = '' for each in range(len(resultName)): - if each == 4:name = name + resultName[each] + '\n' + if each == 4: name = name + resultName[each] + '\n' else:name = name + resultName[each] + ' ' name = name + '\n母猪石 +{} [CQ:face,id=108]'.format(stones) self.sendmsg(colors) From 30ebf9508cc1d73c0dda3f9afc89d3fcefa99dd2 Mon Sep 17 00:00:00 2001 From: "2920233418@qq.com" <2920233418@qq.com> Date: Sun, 16 Aug 2020 20:18:04 +0800 Subject: [PATCH 134/240] =?UTF-8?q?=E6=96=B0=E5=A2=9E@?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pcr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pcr.py b/worker/pcr.py index c7d97a6..c7c90c8 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -337,7 +337,7 @@ class Ans(StdAns): for each in range(len(resultName)): if each == 4: name = name + resultName[each] + '\n' else:name = name + resultName[each] + ' ' - name = name + '\n母猪石 +{} [CQ:face,id=108]'.format(stones) + name = name + '\n母猪石+{} [CQ:face,id=108]'.format(stones) self.sendmsg(colors) self.sendmsg(name) if stones == 19:return '非酋在上,请受我一拜[CQ:face,id=0][CQ:face,id=118]' From 4c7543d491fa33ed3db00df41972557e1734e8d6 Mon Sep 17 00:00:00 2001 From: "2920233418@qq.com" <2920233418@qq.com> Date: Sun, 16 Aug 2020 20:20:09 +0800 Subject: [PATCH 135/240] =?UTF-8?q?=E6=96=B0=E5=A2=9E@?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pcr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/pcr.py b/worker/pcr.py index c7c90c8..c7d97a6 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -337,7 +337,7 @@ class Ans(StdAns): for each in range(len(resultName)): if each == 4: name = name + resultName[each] + '\n' else:name = name + resultName[each] + ' ' - name = name + '\n母猪石+{} [CQ:face,id=108]'.format(stones) + name = name + '\n母猪石 +{} [CQ:face,id=108]'.format(stones) self.sendmsg(colors) self.sendmsg(name) if stones == 19:return '非酋在上,请受我一拜[CQ:face,id=0][CQ:face,id=118]' From 07da6d8d799561735b3e3fb25f80791a7f9328ed Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 16 Aug 2020 23:08:22 +0800 Subject: [PATCH 136/240] add shzyhxjzg --- worker/shzyhxjzg.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 worker/shzyhxjzg.py diff --git a/worker/shzyhxjzg.py b/worker/shzyhxjzg.py new file mode 100644 index 0000000..f7f9014 --- /dev/null +++ b/worker/shzyhxjzg.py @@ -0,0 +1,6 @@ +from zzcore import StdAns + +class Ans(StdAns): + def GETMSG(self): + msg = "富强 民主 文明 和谐\n自由 平等 诚信 友善\n爱国 敬业 诚信 友善" + return msg From a58e1954b75de5d809bcb260fa5f88444e97ccdf Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 16 Aug 2020 23:11:22 +0800 Subject: [PATCH 137/240] fix typo --- worker/shzyhxjzg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/shzyhxjzg.py b/worker/shzyhxjzg.py index f7f9014..8916d65 100644 --- a/worker/shzyhxjzg.py +++ b/worker/shzyhxjzg.py @@ -2,5 +2,5 @@ from zzcore import StdAns class Ans(StdAns): def GETMSG(self): - msg = "富强 民主 文明 和谐\n自由 平等 诚信 友善\n爱国 敬业 诚信 友善" + msg = "富强 民主 文明 和谐\n自由 平等 公正 法制\n爱国 敬业 诚信 友善" return msg From 76a0548dea8a2f5a2ef1b5dad73916dc5680588d Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 17 Aug 2020 10:40:46 +0800 Subject: [PATCH 138/240] zzcore add mid && update lsp to support more key --- route.py | 3 +- test.py | 4 +-- worker/lsp.py | 96 +++++++++++++++++++++++++++++++++------------------ zzcore.py | 5 +-- 4 files changed, 70 insertions(+), 38 deletions(-) diff --git a/route.py b/route.py index 54fb6de..868efa1 100644 --- a/route.py +++ b/route.py @@ -8,6 +8,7 @@ def ZZRouter(data): uid = data['user_id'] gid = data['group_id'] role = data['sender']['role'] + mid = data['message_id'] parms = str.split(data['message'][1:]) print(uid, gid, role, parms) if parms == []: @@ -20,7 +21,7 @@ def ZZRouter(data): except: Ans_ = emmm.Ans - Ans = Ans_(parms, uid, gid, role, data) + Ans = Ans_(parms, uid, gid, role, mid, data) Message = Ans.CheckPermission() if Message == 0: Message = Ans.GETMSG() diff --git a/test.py b/test.py index 7d905b8..8902ccc 100644 --- a/test.py +++ b/test.py @@ -19,9 +19,9 @@ while(inp): Ans_ = emmm.Ans de(Ans_) try: - Ans = Ans_(parms,uid=0,gid=0,role='owner',raw_msg={'message':'/' + inp, 'message_id' : '1001'}) + Ans = Ans_(parms,uid=0,gid=0,role='owner',mid=1001, raw_msg={'message':'/' + inp, 'message_id' : '1001'}) Message = Ans.GETMSG() except Exception as e: Message = ' Error:\n'+str(e) print(Message) - inp = input('>') \ No newline at end of file + inp = input('>') diff --git a/worker/lsp.py b/worker/lsp.py index 990200a..432a51b 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -1,47 +1,77 @@ from zzcore import StdAns, mysakuya import requests -from config import LOLIKEY +from config import LOLIKEYS class Ans(StdAns): AllowGroup = [973510746, 805197917,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 204097403, 247022495, 474907856] def GETMSG(self): - url = 'https://api.lolicon.app/setu/' - params = { - 'apikey': LOLIKEY, - } - 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 = 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吧...不可能是咱!' - return msg + keys = LOLIKEYS + + try: + nowkey = int(self.DATAGET()['nowkey']) + except: + nowkey = 0 + if len(self.parms) < 2: + keyword = '' else: keyword = self.parms[1] if mysakuya(self, keyword) == False: return "不许你们看咲夜的涩图!!" - params['keyword'] = keyword - try: - resp = requests.get(url=url,params=params).json() - picurl = resp['data'][0]['url'] - 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 + ']' - # .replace('https://i.pixiv.cat', 'https://pximg.sihuan.workers.dev') - # msg = picurl.replace('https://i.pixiv.cat', 'https://original.img.cheerfun.dev') - except Exception as e: - print(e) - msg = '[CQ:reply,id=' + str(self.raw_msg['message_id']) + ']咱没查到 ' + keyword + ' 也有可能是Pixiv坏掉了' - return msg + code, quota, picurl = getsetu(keys[nowkey], keyword) + + msg = '' + if code == -1 or code == -2: + msg += f'>_< 天啦喽,loli 不见了 Code:{code}' + elif code == 3: + msg += '咱没查到,也有可能是Pixiv坏掉惹' + elif code == 0: + if len(self.parms) < 2 or (len(self.parms > 2) and self.parms[2] == 'p'): + msg += f'[CQ:image,file={picurl}]' + else: + msg += f'[CQ:reply,id={self.mid}]咱帮你🔍{keyword}找到了这个\n{picurl}' + + if quota == 0: + nowkey = (nowkey+1)%(len(keys)) + if code == 429: + msg += f'>_< 已经没有 loli 啦,帮你换到了key{nowkey},再试一下吧' + else: + msg += f'额度用光了,下次将使用 key{nowkey}' + self.DATASET({'nowkey':nowkey}) + return msg + + +def getsetu(apikey, keyword = ''): + url = 'https://api.lolicon.app/setu/' + params = { + 'apikey': apikey, + } + if keyword != '': + params['keyword'] = keyword + + try: + resp = requests.get(url=url,params=params).json() + except: + return -1, -1 ,'' + + #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}秒' + if resp['code'] == 0: + quota = resp['quota'] + try: + picurl = resp['data'][0]['url'] + code = 0 + except: + picurl = '' + code = -3 + return code, quota, picurl + elif resp['code'] == 429: + return 429, 0, '' + else: + return -2, -1, '' diff --git a/zzcore.py b/zzcore.py index da88478..6117918 100644 --- a/zzcore.py +++ b/zzcore.py @@ -12,11 +12,12 @@ class StdAns(): UserNotAllow = '汝不被允许呢.' RoleNotAllow = '汝的角色不被允许哦.' - def __init__(self,parms,uid,gid,role,raw_msg): + def __init__(self,parms,uid,gid,role,mid,raw_msg): self.parms = parms self.uid = uid self.gid = gid self.role = role + self.mid = mid self.raw_msg = raw_msg def DATAGET(self): @@ -86,4 +87,4 @@ def DM(msgid): 'access_token' : AUTHORIZATION, 'message_id' : msgid, } - requests.get(url = url, params=data) \ No newline at end of file + requests.get(url = url, params=data) From ee9adff99b59103521f12ce32c1f156d2416d803 Mon Sep 17 00:00:00 2001 From: "2920233418@qq.com" <2920233418@qq.com> Date: Wed, 19 Aug 2020 14:39:38 +0800 Subject: [PATCH 139/240] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=8D=A1=E6=B1=A0,=E6=96=B0=E5=A2=9E=E8=A7=92=E8=89=B2,?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=A7=92=E8=89=B2,=E8=AE=BE=E7=BD=AEup?= =?UTF-8?q?=E5=9B=9B=E6=9D=A1=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 +- data/pcr/char | 4 +- worker/pcr.py | 109 +++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 100 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 2e3c5c9..d0d0d2b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ __pycache__ .vscode config.py .idea -test.py \ No newline at end of file +test.py +push.cmd +data \ No newline at end of file diff --git a/data/pcr/char b/data/pcr/char index fc30e6a..02112e6 100644 --- a/data/pcr/char +++ b/data/pcr/char @@ -1,8 +1,8 @@ 3* 2.5% -镜华 真步 初音 伊绪 璃乃 亚里莎 杏奈 咲恋 伊莉亚 妮侬 莫妮卡 静流 姬塔 秋乃 真琴 望 纯 +镜华 真步 初音 伊绪 璃乃 亚里莎 杏奈 咲恋 伊莉亚 妮侬 莫妮卡 静流 姬塔 秋乃 真琴 望 纯 佩可莉姆(夏日) 2* 18% 雪 千歌 美里 栞 铃奈 茜里 深月 铃 美冬 真阳 忍 美美 惠理子 珠希 绫音 纺希 香织 空花 宫子 1* 79.5% -优衣 碧 美咲 凯露 铃莓 依里 可可萝 由加莉 怜 胡桃 未奏希 日和莉 佩可莉姆 莉玛 +优衣 碧 美咲 凯露 铃莓 依里 可可萝 由加莉 怜 胡桃 未奏希 日和莉 佩可莉姆 莉玛 up 0.7% 佩可莉姆(夏日) \ No newline at end of file diff --git a/worker/pcr.py b/worker/pcr.py index c7d97a6..13f714d 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -2,7 +2,7 @@ import json from zzcore import StdAns from random import randint, choice -AllowCMD = ['登记','申请出刀','报刀','挂树','查树','进度','查刀','新的一天','血量','boss','初始化','求助','迁移','踢人','单抽','十连'] +AllowCMD = ['登记','申请出刀','报刀','挂树','查树','进度','查刀','新的一天','血量','boss','初始化','求助','迁移','踢人','单抽','十连','查看卡池','查看池子','新增角色','删除角色','设置up'] status = { 'all_player':{ @@ -276,22 +276,24 @@ class Ans(StdAns): on_tree_players = on_tree_players + nowdata['all_player'][str(p)]['id'] + '\n' return '救命[CQ:at,qq=3178302597][CQ:at,qq=3430357110]\n' + on_tree_players + '都在🌳上' + path = './data/pcr/char' + try: + with open(path, 'r+', encoding='utf-8') as f: + characters = f.readlines() + except: + return '好像角色名单没有加载呢。。。' + star3 = characters[1].replace('\n','').split(' ') + star3 = [each for each in star3 if each] + star2 = characters[3].replace('\n', '').split(' ') + star2 = [each for each in star2 if each] + star1 = characters[5].replace('\n', '').split(' ') + star1 = [each for each in star1 if each] + up = characters[7].replace('\n', '').split(' ') + up = [each for each in up if each] + if cmd == '单抽' or cmd == '十连': times = 1 if cmd == '单抽' else 9 - try: - with open('./data/pcr/char', 'r+', encoding='utf-8') as f: - characters = f.readlines() - except: - return '好像角色名单没有加载呢。。。' - star3 = characters[1].replace('\n','').split(' ') - star3 = [each for each in star3 if each] - star2 = characters[3].replace('\n', '').split(' ') - star2 = [each for each in star2 if each] - star1 = characters[5].replace('\n', '').split(' ') - star1 = [each for each in star1 if each] - up = characters[7].replace('\n', '').split(' ') - up = [each for each in up if each] resultStar = [] resultName = [] for each in range(times): @@ -343,6 +345,85 @@ class Ans(StdAns): if stones == 19:return '非酋在上,请受我一拜[CQ:face,id=0][CQ:face,id=118]' elif stones > 157:return '欧皇![CQ:face,id=23]啊我酸了' + if cmd == '查看卡池' or cmd == '查看池子': + return '3★\n' + '、'.join(star3) + '\n2★\n' + '、'.join(star2) + '\n1★\n' + '、'.join( + star1) + '\n★UP★\n' + '、'.join(up) + + if cmd == '新增角色': + if self.uid == 2920233418 or self.uid == 1318000868: + if len(self.parms) != 4: + return '请使用句式:/pcr 新增角色 3 镜华' + try: + star = int(self.parms[2]) + except: + return '请使用句式:/pcr 新增角色 3 镜华' + name = self.parms[3] + if star == 3: + star3.append(name) + elif star == 2: + star2.append(name) + elif star == 1: + star1.append(name) + else: + return '请输入正确的星级' + char = '3* 2.5%\n{}\n2* 18%\n{}\n1* 79.5%\n{}\nup 0.7%\n{}'.format(' '.join(star3), ' '.join(star2), + ' '.join(star1), ' '.join(up)) + try: + with open(path, 'w+', encoding='utf-8') as f: + f.write(char) + except: + return '好像角色名单没有加载呢。。。' + return '添加新角色{}★ {} 成功[CQ:face,id=144][CQ:face,id=144]'.format(star, name) + else: + return '抱歉,您没有使用这条命令的权柄' + + if cmd == '删除角色': + if self.uid == 2920233418 or self.uid == 1318000868: + if len(self.parms) != 4: + return '请使用句式:/pcr 删除角色 3 镜华' + try: + star = int(self.parms[2]) + except: + return '请使用句式:/pcr 删除角色 3 镜华' + name = self.parms[3] + try: + if star == 3: + star3.remove(name) + elif star == 2: + star2.remove(name) + elif star == 1: + star1.remove(name) + else: + return '请输入正确的星级' + except: + return '没有找到对应的角色' + char = '3* 2.5%\n{}\n2* 18%\n{}\n1* 79.5%\n{}\nup 0.7%\n{}'.format(' '.join(star3), ' '.join(star2), + ' '.join(star1), ' '.join(up)) + try: + with open(path, 'w+', encoding='utf-8') as f: + f.write(char) + except: + return '好像角色名单没有加载呢。。。' + return '删除角色{}★ {} 成功'.format(star, name) + else: + return '抱歉,您没有使用这条命令的权柄' + + if cmd == '设置up': + if self.uid == 2920233418 or self.uid == 1318000868: + if len(self.parms) != 3: + return '请使用句式:/pcr 设置up 镜华(多位角色请用中文逗号隔开)' + name = self.parms[2] + up = [each for each in name.split(',') if each] + char = '3* 2.5%\n{}\n2* 18%\n{}\n1* 79.5%\n{}\nup 0.7%\n{}'.format(' '.join(star3), ' '.join(star2), + ' '.join(star1), ' '.join(up)) + try: + with open(path, 'w+', encoding='utf-8') as f: + f.write(char) + except: + return '好像角色名单没有加载呢。。。' + return '已成功将{}设为★UP★角色'.format(name) + else: + return '抱歉,您没有使用这条命令的权柄' def bossname(num): From 84940b5bfd4e3e26960bd97c62c41274b206b836 Mon Sep 17 00:00:00 2001 From: "2920233418@qq.com" <2920233418@qq.com> Date: Wed, 19 Aug 2020 14:47:49 +0800 Subject: [PATCH 140/240] char -> char.list --- .gitignore | 3 +-- data/pcr/{char => char.list} | 0 worker/pcr.py | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) rename data/pcr/{char => char.list} (100%) diff --git a/.gitignore b/.gitignore index d0d0d2b..1ce7f3e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,4 @@ __pycache__ config.py .idea test.py -push.cmd -data \ No newline at end of file +push.cmd \ No newline at end of file diff --git a/data/pcr/char b/data/pcr/char.list similarity index 100% rename from data/pcr/char rename to data/pcr/char.list diff --git a/worker/pcr.py b/worker/pcr.py index 13f714d..4816ab3 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -276,7 +276,7 @@ class Ans(StdAns): on_tree_players = on_tree_players + nowdata['all_player'][str(p)]['id'] + '\n' return '救命[CQ:at,qq=3178302597][CQ:at,qq=3430357110]\n' + on_tree_players + '都在🌳上' - path = './data/pcr/char' + path = './data/pcr/char.list' try: with open(path, 'r+', encoding='utf-8') as f: characters = f.readlines() From 641f4741717c89346fa3e90e1d626e1574bf9093 Mon Sep 17 00:00:00 2001 From: "2920233418@qq.com" <2920233418@qq.com> Date: Wed, 19 Aug 2020 14:48:49 +0800 Subject: [PATCH 141/240] .ignore add char.list --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1ce7f3e..320616b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ __pycache__ config.py .idea test.py -push.cmd \ No newline at end of file +push.cmd +data/pcr/char.list \ No newline at end of file From 5dbce1adb85960f98ffab433cc924ab1c53a9a1d Mon Sep 17 00:00:00 2001 From: "2920233418@qq.com" <2920233418@qq.com> Date: Wed, 19 Aug 2020 15:03:04 +0800 Subject: [PATCH 142/240] change the allowans --- worker/pcr.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/pcr.py b/worker/pcr.py index 4816ab3..d9a9d4d 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -350,7 +350,7 @@ class Ans(StdAns): star1) + '\n★UP★\n' + '、'.join(up) if cmd == '新增角色': - if self.uid == 2920233418 or self.uid == 1318000868: + if self.role in ['owner','admin']: if len(self.parms) != 4: return '请使用句式:/pcr 新增角色 3 镜华' try: @@ -378,7 +378,7 @@ class Ans(StdAns): return '抱歉,您没有使用这条命令的权柄' if cmd == '删除角色': - if self.uid == 2920233418 or self.uid == 1318000868: + if self.role in ['owner','admin']: if len(self.parms) != 4: return '请使用句式:/pcr 删除角色 3 镜华' try: @@ -409,7 +409,7 @@ class Ans(StdAns): return '抱歉,您没有使用这条命令的权柄' if cmd == '设置up': - if self.uid == 2920233418 or self.uid == 1318000868: + if self.role in ['owner','admin']: if len(self.parms) != 3: return '请使用句式:/pcr 设置up 镜华(多位角色请用中文逗号隔开)' name = self.parms[2] From 759635597a3ae6210733ede9eca012acc3235974 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 20 Aug 2020 18:57:31 +0800 Subject: [PATCH 143/240] add oj --- worker/oj.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 worker/oj.py diff --git a/worker/oj.py b/worker/oj.py new file mode 100644 index 0000000..547398b --- /dev/null +++ b/worker/oj.py @@ -0,0 +1,10 @@ +from zzcore import StdAns + +class Ans(StdAns): + def GETMSG(self): + msg = 'https://openjudge.sakuya.love/' + try: + msg += '?'+ str(self.parms[1]) + except: + msg += '\n可以在命令里加上题号直接搜索哦.' + return msg From b8b421c120b2e8db6a4ce588d0afa2fbff242d60 Mon Sep 17 00:00:00 2001 From: weilinfox Date: Fri, 21 Aug 2020 10:57:38 +0800 Subject: [PATCH 144/240] fix music --- worker/music.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/worker/music.py b/worker/music.py index 734c942..04df6ba 100644 --- a/worker/music.py +++ b/worker/music.py @@ -7,11 +7,12 @@ class Ans(StdAns): return '不加参数是坏文明!' # url = 'https://api.imjad.cn/cloudmusic/' - url = 'https://music.jeeas.cn/v1/search' + # url = 'https://music.jeeas.cn/v1/search' # url = 'http://mc.sakuya.love:3000/search' + url = 'http://inuyasha.love:8001/search' params = { 'limit': 1, - 's':self.raw_msg['message'][6:], + 'keywords':self.raw_msg['message'][6:], } try: resp = requests.get(url=url,params=params).json() From d3184ebb775a454ef183fe2da17e78bcc0fd11a5 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 21 Aug 2020 11:20:27 +0800 Subject: [PATCH 145/240] bing use mkt zh-CN --- worker/bing.py | 1 + 1 file changed, 1 insertion(+) diff --git a/worker/bing.py b/worker/bing.py index f291aeb..0626aed 100644 --- a/worker/bing.py +++ b/worker/bing.py @@ -12,6 +12,7 @@ class Ans(StdAns): params = { 'q':self.raw_msg['message'][5:], 'count': 1, + 'mkt': 'zh-CN' } headers = { 'Ocp-Apim-Subscription-Key': BINGKEY, From 5c890fbe3fd9ac25716775a5d1ab5048b77b0126 Mon Sep 17 00:00:00 2001 From: Kontor Date: Fri, 21 Aug 2020 11:26:21 +0800 Subject: [PATCH 146/240] QQMusic Mod (Experimental) --- worker/qymusic.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 worker/qymusic.py diff --git a/worker/qymusic.py b/worker/qymusic.py new file mode 100644 index 0000000..57ffcea --- /dev/null +++ b/worker/qymusic.py @@ -0,0 +1,36 @@ +from zzcore import StdAns +import requests + +class Ans(StdAns): + def GETMSG(self): + if len(self.parms) < 2: + return '歌名都不指定就能搜到歌了?' + url = 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp' + params = { + 'ct': 24, + 'qqmusic_ver': 1298, + 'new_json': 1, + 'remoteplace': 'txt.yqq.song', + 'searchid': '', + 't': 0, + 'aggr': 1, + 'cr': 1, + 'catZhida': 1, + 'loseless': 0, + 'flag_qc': 0, + 'p': 1, + 'n': 20, + 'w':self.raw_msg['message'][8:], + } + try: + resp = requests.get(url=url,params=params) + resp = re.match("callback%((.+)%)", resp).json() + if resp['data']['song']['totalnum'] == 0: + return '辣鸡曲库没这首,或者你的关键词有问题' + mid = resp['data']['song']['list'][0]['mid'] + mname = resp['data']['song']['list'][0]['name'] + msg = '[CQ:share,url=https://y.qq.com/n/yqq/song/' + str(mid) + '.html,title=' + str(mname) + ']' + except Exception as e: + print(e) + msg = '辣鸡q音,太弟弟了(' + return msg From 8333e8c741eb997f5f0c2fba3e5b5f3cef514327 Mon Sep 17 00:00:00 2001 From: weilinfox Date: Fri, 21 Aug 2020 12:04:15 +0800 Subject: [PATCH 147/240] try to fix qymusic --- worker/qymusic.py | 66 ++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/worker/qymusic.py b/worker/qymusic.py index 57ffcea..e1119b8 100644 --- a/worker/qymusic.py +++ b/worker/qymusic.py @@ -1,36 +1,38 @@ from zzcore import StdAns import requests +import re class Ans(StdAns): - def GETMSG(self): - if len(self.parms) < 2: - return '歌名都不指定就能搜到歌了?' - url = 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp' - params = { - 'ct': 24, - 'qqmusic_ver': 1298, - 'new_json': 1, - 'remoteplace': 'txt.yqq.song', - 'searchid': '', - 't': 0, - 'aggr': 1, - 'cr': 1, - 'catZhida': 1, - 'loseless': 0, - 'flag_qc': 0, - 'p': 1, - 'n': 20, - 'w':self.raw_msg['message'][8:], - } - try: - resp = requests.get(url=url,params=params) - resp = re.match("callback%((.+)%)", resp).json() - if resp['data']['song']['totalnum'] == 0: - return '辣鸡曲库没这首,或者你的关键词有问题' - mid = resp['data']['song']['list'][0]['mid'] - mname = resp['data']['song']['list'][0]['name'] - msg = '[CQ:share,url=https://y.qq.com/n/yqq/song/' + str(mid) + '.html,title=' + str(mname) + ']' - except Exception as e: - print(e) - msg = '辣鸡q音,太弟弟了(' - return msg + def GETMSG(self): + if len(self.parms) < 2: + return '歌名都不指定就能搜到歌了?' + url = 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp' + params = { + 'ct': 24, + 'qqmusic_ver': 1298, + 'new_json': 1, + 'remoteplace': 'txt.yqq.song', + 'searchid': '', + 't': 0, + 'aggr': 1, + 'cr': 1, + 'catZhida': 1, + 'loseless': 0, + 'flag_qc': 0, + 'p': 1, + 'n': 20, + 'w':self.raw_msg['message'][8:], + } + try: + resp = requests.get(url=url,params=params) + # print(resp) + resp = re.match("callback%((.+)%)", resp).json() + if resp['data']['song']['totalnum'] == 0: + return '辣鸡曲库没这首,或者你的关键词有问题' + mid = resp['data']['song']['list'][0]['mid'] + mname = resp['data']['song']['list'][0]['name'] + msg = '[CQ:share,url=https://y.qq.com/n/yqq/song/' + str(mid) + '.html,title=' + str(mname) + ']' + except Exception as e: + print(e) + msg = '辣鸡q音,太弟弟了(' + return msg From 22574c925b98175557f4d887abe744385a322faa Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 21 Aug 2020 12:16:10 +0800 Subject: [PATCH 148/240] test run --- worker/run.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 worker/run.py diff --git a/worker/run.py b/worker/run.py new file mode 100644 index 0000000..94a9859 --- /dev/null +++ b/worker/run.py @@ -0,0 +1,53 @@ +import json +from zzcore import StdAns +from config import GLOTTOKEN + +LANGS = { + 'assembly': {'filename': 'main.assembly', 'url': 'https://run.glot.io/languages/assembly'}, + 'ats': {'filename': 'main.ats', 'url': 'https://run.glot.io/languages/ats'}, + 'bash': {'filename': 'main.bash', 'url': 'https://run.glot.io/languages/bash'}, + 'c': {'filename': 'main.c', 'url': 'https://run.glot.io/languages/c'}, + 'clojure': {'filename': 'main.clojure', 'url': 'https://run.glot.io/languages/clojure'}, + 'cobol': {'filename': 'main.cobol', 'url': 'https://run.glot.io/languages/cobol'}, + 'coffeescript': {'filename': 'main.coffeescript', 'url': 'https://run.glot.io/languages/coffeescript'}, + 'cpp': {'filename': 'main.cpp', 'url': 'https://run.glot.io/languages/cpp'}, + 'crystal': {'filename': 'main.crystal', 'url': 'https://run.glot.io/languages/crystal'}, + 'csharp': {'filename': 'main.csharp', 'url': 'https://run.glot.io/languages/csharp'}, + 'd': {'filename': 'main.d', 'url': 'https://run.glot.io/languages/d'}, + 'elixir': {'filename': 'main.elixir', 'url': 'https://run.glot.io/languages/elixir'}, + 'elm': {'filename': 'main.elm', 'url': 'https://run.glot.io/languages/elm'}, + 'erlang': {'filename': 'main.erlang', 'url': 'https://run.glot.io/languages/erlang'}, + 'fsharp': {'filename': 'main.fsharp', 'url': 'https://run.glot.io/languages/fsharp'}, + 'go': {'filename': 'main.go', 'url': 'https://run.glot.io/languages/go'}, + 'groovy': {'filename': 'main.groovy', 'url': 'https://run.glot.io/languages/groovy'}, + 'haskell': {'filename': 'main.haskell', 'url': 'https://run.glot.io/languages/haskell'}, + 'idris': {'filename': 'main.idris', 'url': 'https://run.glot.io/languages/idris'}, + 'java': {'filename': 'main.java', 'url': 'https://run.glot.io/languages/java'}, + 'javascript': {'filename': 'main.javascript', 'url': 'https://run.glot.io/languages/javascript'}, + 'julia': {'filename': 'main.julia', 'url': 'https://run.glot.io/languages/julia'}, + 'kotlin': {'filename': 'main.kotlin', 'url': 'https://run.glot.io/languages/kotlin'}, + 'lua': {'filename': 'main.lua', 'url': 'https://run.glot.io/languages/lua'}, + 'mercury': {'filename': 'main.mercury', 'url': 'https://run.glot.io/languages/mercury'}, + 'nim': {'filename': 'main.nim', 'url': 'https://run.glot.io/languages/nim'}, + 'ocaml': {'filename': 'main.ocaml', 'url': 'https://run.glot.io/languages/ocaml'}, + 'perl': {'filename': 'main.perl', 'url': 'https://run.glot.io/languages/perl'}, + 'perl6': {'filename': 'main.perl6', 'url': 'https://run.glot.io/languages/perl6'}, + 'php': {'filename': 'main.php', 'url': 'https://run.glot.io/languages/php'}, + 'python': {'filename': 'main.python', 'url': 'https://run.glot.io/languages/python'}, + 'ruby': {'filename': 'main.ruby', 'url': 'https://run.glot.io/languages/ruby'}, + 'rust': {'filename': 'main.rust', 'url': 'https://run.glot.io/languages/rust'}, + 'scala': {'filename': 'main.scala', 'url': 'https://run.glot.io/languages/scala'}, + 'swift': {'filename': 'main.swift', 'url': 'https://run.glot.io/languages/swift'}, + 'typescript': {'filename': 'main.typescript', 'url': 'https://run.glot.io/languages/typescript'} + } + +class Ans(StdAns): + + def GETMSG(self): + if len(self.parms) < 3: + return '''Usage: +/run + +''' + msg = f'{self.parms[0]}//{self.parms[1]}//{self.parms[2]}' + return msg From 4b7d08db56899eaf9b000e9807dc634f01f43e7c Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 21 Aug 2020 12:55:55 +0800 Subject: [PATCH 149/240] add run to run code online --- worker/run.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/worker/run.py b/worker/run.py index 94a9859..4fd1af6 100644 --- a/worker/run.py +++ b/worker/run.py @@ -1,4 +1,5 @@ import json +import requests from zzcore import StdAns from config import GLOTTOKEN @@ -48,6 +49,36 @@ class Ans(StdAns): return '''Usage: /run + +支持的语言:assembly ats bash c clojure cobol coffeescript cpp crystal csharp d elixir elm erlang fsharp go groovy haskell idris java javascript julia kotlin lua mercury nim ocaml perl perl6 php python ruby rust scala swift typescript ''' - msg = f'{self.parms[0]}//{self.parms[1]}//{self.parms[2]}' + lang = self.parms[1] + i = 6 + len(lang) + content = self.raw_msg['message'][i:] + try : + langconfig = LANGS[lang] + name = langconfig['filename'] + url = langconfig['url'] + '/latest' + except : + return f'不支持的语言 {lang}' + + msg = glot(name, content, url) return msg + + + +def glot(name, content, url): + headers = { + 'Authorization': f'Token {GLOTTOKEN}', + 'Content-type': 'application/json', + } + + data = { + "files": [{ + "name": name, + "content": content, + }] + } + resp = requests.post(url=url, headers=headers, json=data).json() + r = f"stdout:\n{resp['stdout']}\nstderr:\n{resp['stderr']}\nerror:\n{resp['error']}" + return r \ No newline at end of file From cc75c2a5decba16de810b5552e46e861d43e88a3 Mon Sep 17 00:00:00 2001 From: weilinfox Date: Fri, 21 Aug 2020 13:22:33 +0800 Subject: [PATCH 150/240] fix qymusic --- worker/qymusic.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/qymusic.py b/worker/qymusic.py index e1119b8..44ffa08 100644 --- a/worker/qymusic.py +++ b/worker/qymusic.py @@ -1,6 +1,6 @@ from zzcore import StdAns import requests -import re +import json class Ans(StdAns): def GETMSG(self): @@ -24,9 +24,9 @@ class Ans(StdAns): 'w':self.raw_msg['message'][8:], } try: - resp = requests.get(url=url,params=params) + resp = requests.get(url=url,params=params).text + resp = json.loads(list(resp.split('callback('))[1][:-1]) # print(resp) - resp = re.match("callback%((.+)%)", resp).json() if resp['data']['song']['totalnum'] == 0: return '辣鸡曲库没这首,或者你的关键词有问题' mid = resp['data']['song']['list'][0]['mid'] From 37f995d2afe08df6f915e2c4165834276b4bd6e0 Mon Sep 17 00:00:00 2001 From: weilinfox Date: Fri, 21 Aug 2020 14:12:52 +0800 Subject: [PATCH 151/240] make qymusic kawaii --- worker/qymusic.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/qymusic.py b/worker/qymusic.py index 44ffa08..fc39aad 100644 --- a/worker/qymusic.py +++ b/worker/qymusic.py @@ -5,7 +5,7 @@ import json class Ans(StdAns): def GETMSG(self): if len(self.parms) < 2: - return '歌名都不指定就能搜到歌了?' + return '不加参数是坏文明!' url = 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp' params = { 'ct': 24, @@ -28,11 +28,11 @@ class Ans(StdAns): resp = json.loads(list(resp.split('callback('))[1][:-1]) # print(resp) if resp['data']['song']['totalnum'] == 0: - return '辣鸡曲库没这首,或者你的关键词有问题' + return '啊嘞嘞好像没有诶qaq' mid = resp['data']['song']['list'][0]['mid'] mname = resp['data']['song']['list'][0]['name'] msg = '[CQ:share,url=https://y.qq.com/n/yqq/song/' + str(mid) + '.html,title=' + str(mname) + ']' except Exception as e: print(e) - msg = '辣鸡q音,太弟弟了(' + msg = '什么东西坏掉了,大概是疼讯吧...不可能是咱!' return msg From 9fe9e578fd62919657bd4e26461a3060bc85b690 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sat, 22 Aug 2020 22:19:58 +0800 Subject: [PATCH 152/240] sdust jiyuan xiansheng no emm --- worker/emmm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/emmm.py b/worker/emmm.py index d327b83..614494f 100644 --- a/worker/emmm.py +++ b/worker/emmm.py @@ -2,7 +2,7 @@ from zzcore import StdAns, mysakuya class Ans(StdAns): - NotAllowGroup = [204097403] + NotAllowGroup = [204097403, 1107535671] def CheckPermission(self): if self.gid in self.NotAllowGroup: From aaa93d3afebad7a92587705b8fb502807317708a Mon Sep 17 00:00:00 2001 From: SiHuan <49349784+Si-Huan@users.noreply.github.com> Date: Sun, 23 Aug 2020 04:10:37 +0800 Subject: [PATCH 153/240] test CQ music --- worker/qymusic.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/worker/qymusic.py b/worker/qymusic.py index fc39aad..771a521 100644 --- a/worker/qymusic.py +++ b/worker/qymusic.py @@ -30,8 +30,9 @@ class Ans(StdAns): if resp['data']['song']['totalnum'] == 0: return '啊嘞嘞好像没有诶qaq' mid = resp['data']['song']['list'][0]['mid'] - mname = resp['data']['song']['list'][0]['name'] - msg = '[CQ:share,url=https://y.qq.com/n/yqq/song/' + str(mid) + '.html,title=' + str(mname) + ']' + msg = f'[CQ:music,type=qq,id={mid}]' + # mname = resp['data']['song']['list'][0]['name'] + # msg = '[CQ:share,url=https://y.qq.com/n/yqq/song/' + str(mid) + '.html,title=' + str(mname) + ']' except Exception as e: print(e) msg = '什么东西坏掉了,大概是疼讯吧...不可能是咱!' From 47e8de7bea9fc65b83ed6c847b77d579afa889f1 Mon Sep 17 00:00:00 2001 From: SiHuan <49349784+Si-Huan@users.noreply.github.com> Date: Sun, 23 Aug 2020 04:14:43 +0800 Subject: [PATCH 154/240] fix qq music id --- worker/qymusic.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/worker/qymusic.py b/worker/qymusic.py index 771a521..a616040 100644 --- a/worker/qymusic.py +++ b/worker/qymusic.py @@ -29,8 +29,9 @@ class Ans(StdAns): # print(resp) if resp['data']['song']['totalnum'] == 0: return '啊嘞嘞好像没有诶qaq' - mid = resp['data']['song']['list'][0]['mid'] - msg = f'[CQ:music,type=qq,id={mid}]' + # mid = resp['data']['song']['list'][0]['mid'] + id = resp['data']['song']['list'][0]['id'] + msg = f'[CQ:music,type=qq,id={id}]' # mname = resp['data']['song']['list'][0]['name'] # msg = '[CQ:share,url=https://y.qq.com/n/yqq/song/' + str(mid) + '.html,title=' + str(mname) + ']' except Exception as e: From 1beaa79155ac6cc1097a64cd9045492aea482fff Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 23 Aug 2020 04:23:11 +0800 Subject: [PATCH 155/240] qymusic fix cq music id --- worker/qymusic.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/qymusic.py b/worker/qymusic.py index a616040..3d59627 100644 --- a/worker/qymusic.py +++ b/worker/qymusic.py @@ -29,9 +29,9 @@ class Ans(StdAns): # print(resp) if resp['data']['song']['totalnum'] == 0: return '啊嘞嘞好像没有诶qaq' - # mid = resp['data']['song']['list'][0]['mid'] - id = resp['data']['song']['list'][0]['id'] - msg = f'[CQ:music,type=qq,id={id}]' + mid = resp['data']['song']['list'][0]['mid'] + # id = resp['data']['song']['list'][0]['id'] + msg = f'[CQ:music,type=qq,id={mid}]' # mname = resp['data']['song']['list'][0]['name'] # msg = '[CQ:share,url=https://y.qq.com/n/yqq/song/' + str(mid) + '.html,title=' + str(mname) + ']' except Exception as e: From ccb6b3d3cf5dd11a4d7fe3e58934f1ba968a041d Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 25 Aug 2020 16:54:00 +0800 Subject: [PATCH 156/240] pip install pydub --- req.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/req.txt b/req.txt index 2026441..762ff19 100644 --- a/req.txt +++ b/req.txt @@ -18,6 +18,7 @@ MarkupSafe==1.1.1 mccabe==0.6.1 more-itertools==8.2.0 pycodestyle==2.5.0 +pydub==0.24.1 pyflakes==2.1.1 pylint==2.4.4 redis==3.4.1 From 767aa34fc05eba5403c03163279c978f34a9cba6 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 25 Aug 2020 18:00:20 +0800 Subject: [PATCH 157/240] add talk --- worker/talk.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 worker/talk.py diff --git a/worker/talk.py b/worker/talk.py new file mode 100644 index 0000000..43e2580 --- /dev/null +++ b/worker/talk.py @@ -0,0 +1,41 @@ +from zzcore import StdAns + +from pydub import AudioSegment +from base64 import b64encode +import requests, io + +class Ans(StdAns): + def GETMSG(self): + if len(self.parms) < 2: + text = "想让我说点什么呢?" + else: + text = self.raw_msg['message'][5:] + + try: + b = tts(text) + msg = f'[CQ:record,file=base64://{str(b)}]' + except: + msg = '什么东西坏掉了,...咱不能说话了!' + return msg + +def tts(text): + url = "https://tts.baidu.com/text2audio" + params = { + 'cuid': 'baike', + 'lan': 'zh', + 'ctp': 1, + 'pdt': 301, + 'vol': 5, + 'rate': 32, + 'per': 5118, + 'tex': text, + } + + r = requests.get(url=url, params=params) + s = io.BytesIO(r.content) + r.close() + # s.seek(0,0) + song = AudioSegment.from_mp3(s) + amr = song.export(format="amr", parameters=["-ar", "8000"]) + b = b64encode(amr.read()).decode("utf-8") + return b \ No newline at end of file From 39903420c4f007c6e495181028401b1b4d077cb0 Mon Sep 17 00:00:00 2001 From: SiHuan <49349784+Si-Huan@users.noreply.github.com> Date: Tue, 25 Aug 2020 22:34:51 +0800 Subject: [PATCH 158/240] use music cq code --- worker/music.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/music.py b/worker/music.py index 04df6ba..6cb0b54 100644 --- a/worker/music.py +++ b/worker/music.py @@ -18,8 +18,8 @@ class Ans(StdAns): resp = requests.get(url=url,params=params).json() # print(resp) musicid = resp['result']['songs'][0]['id'] - musicname = resp['result']['songs'][0]['name'] - msg = '[CQ:share,url=https://music.163.com/song/' + str(musicid) + '/,title=' + str(musicname) + ']' + # musicname = resp['result']['songs'][0]['name'] + msg = f'[CQ:music,type=163,id={musicid}]' except Exception as e: print(e) msg = '什么东西坏掉了,大概是网易云吧...不可能是咱!' From 121ac9ea19660c573e5c153528337df6b1e1fd4c Mon Sep 17 00:00:00 2001 From: SiHuan <49349784+Si-Huan@users.noreply.github.com> Date: Tue, 25 Aug 2020 22:54:48 +0800 Subject: [PATCH 159/240] Update qymusic.py --- worker/qymusic.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/qymusic.py b/worker/qymusic.py index 3d59627..a616040 100644 --- a/worker/qymusic.py +++ b/worker/qymusic.py @@ -29,9 +29,9 @@ class Ans(StdAns): # print(resp) if resp['data']['song']['totalnum'] == 0: return '啊嘞嘞好像没有诶qaq' - mid = resp['data']['song']['list'][0]['mid'] - # id = resp['data']['song']['list'][0]['id'] - msg = f'[CQ:music,type=qq,id={mid}]' + # mid = resp['data']['song']['list'][0]['mid'] + id = resp['data']['song']['list'][0]['id'] + msg = f'[CQ:music,type=qq,id={id}]' # mname = resp['data']['song']['list'][0]['name'] # msg = '[CQ:share,url=https://y.qq.com/n/yqq/song/' + str(mid) + '.html,title=' + str(mname) + ']' except Exception as e: From 0492c053e119e68a80a5e921c36a80745648ef2d Mon Sep 17 00:00:00 2001 From: SiHuan <49349784+Si-Huan@users.noreply.github.com> Date: Tue, 25 Aug 2020 22:55:53 +0800 Subject: [PATCH 160/240] Update qymusic.py --- worker/qymusic.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/qymusic.py b/worker/qymusic.py index a616040..3d59627 100644 --- a/worker/qymusic.py +++ b/worker/qymusic.py @@ -29,9 +29,9 @@ class Ans(StdAns): # print(resp) if resp['data']['song']['totalnum'] == 0: return '啊嘞嘞好像没有诶qaq' - # mid = resp['data']['song']['list'][0]['mid'] - id = resp['data']['song']['list'][0]['id'] - msg = f'[CQ:music,type=qq,id={id}]' + mid = resp['data']['song']['list'][0]['mid'] + # id = resp['data']['song']['list'][0]['id'] + msg = f'[CQ:music,type=qq,id={mid}]' # mname = resp['data']['song']['list'][0]['name'] # msg = '[CQ:share,url=https://y.qq.com/n/yqq/song/' + str(mid) + '.html,title=' + str(mname) + ']' except Exception as e: From 7ae5ed6a88311e14848c0fb93660030fd9141afb Mon Sep 17 00:00:00 2001 From: Czy <651525974@qq.com> Date: Fri, 28 Aug 2020 21:32:41 +0800 Subject: [PATCH 161/240] weather --- worker/weather.py | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 worker/weather.py diff --git a/worker/weather.py b/worker/weather.py new file mode 100644 index 0000000..9015450 --- /dev/null +++ b/worker/weather.py @@ -0,0 +1,57 @@ +import random +import requests +import datetime + +class Ans(object): + """docstring for Ans""" + def __init__(self): + super(Ans).__init__() + + def GETMSG(self): + try: + return self.get_weather() + except Exception as e: + return "啊哦,出错了" + + def get_weather(self): + ran = random.randint(0, 9999999999) + url = "https://api.caiyunapp.com/v2/Y2FpeXVuIGFuZHJpb2QgYXBp/120.127164,36.000129/weather?lang=zh_CN&device_id={}".format(ran) + res = requests.get(url).json() + msg = "XZZ为您播报近期天气\n-------------------------------------\n" + msg += "日期 | 温度 | 湿度 | 天气 |\n-------------------------------------" + result = res["result"]["daily"] + now = datetime.datetime.now() + weather_summary = { + "CLEAR_DAY": "晴", + "CLEAR_NIGHT": "晴", + "CLOUD_DAY_WIDGET": "多云转晴", + "CLOUDY": "阴", + "HAZE": "霾", + "HAZE_WIDGET": "霾", + "PARTLY_CLOUD_NIGHT": "多云转晴", + "PARTLY_CLOUD_NIGHT_WIDGET": "多云转晴", + "PARTLY_CLOUD_WIDGET": "阴", + "PARTLY_CLOUDY_DAY": "多云转晴", + "PARTLY_CLOUDY_NIGHT": "多云转晴", + "RAIN": "雨", + "RAIN_HEAVY": "大雨", + "RAIN_LIGHT": "小雨", + "RAIN_MIDDLE": "中雨", + "RAIN_NORMAL_WIDGET": "大雨", + "SNOW": "雪", + "SNOW_WIDGET": "雪", + "SUNSHINE_NIGHT_WIDGET": "晴", + "SUNSHINE_WIDGET": "晴", + "WIND": "晴", + } + for i in range(5): + msg += "\n" + msg += "{} | ".format((now + datetime.timedelta(days=i)).strftime("%Y-%m-%d")) + msg += "{} | ".format(format(result["temperature"][i]["avg"], ".2f")) + msg += "{} | ".format(format(result["humidity"][i]["avg"], ".2f")) + msg += "{} | ".format(weather_summary[result["skycon"][i]["value"]]) + return msg + +if __name__ == "__main__": + Ans().GETMSG() + \ No newline at end of file From c6cf9597e7618e44dd315580e10c6e0cf1fa8135 Mon Sep 17 00:00:00 2001 From: Czy <651525974@qq.com> Date: Fri, 28 Aug 2020 21:43:15 +0800 Subject: [PATCH 162/240] Inherit the base class --- worker/weather.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/worker/weather.py b/worker/weather.py index 9015450..5eb3efc 100644 --- a/worker/weather.py +++ b/worker/weather.py @@ -1,11 +1,10 @@ import random import requests import datetime +from zzcore import StdAns -class Ans(object): +class Ans(StdAns): """docstring for Ans""" - def __init__(self): - super(Ans).__init__() def GETMSG(self): try: From d80e51d8e9dd9ecfbd9d3c5d7231db05738b0a48 Mon Sep 17 00:00:00 2001 From: SiHuan <49349784+Si-Huan@users.noreply.github.com> Date: Wed, 9 Sep 2020 17:03:11 +0800 Subject: [PATCH 163/240] Update lsp.py --- worker/lsp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/lsp.py b/worker/lsp.py index 432a51b..d3c68d3 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEYS class Ans(StdAns): - AllowGroup = [973510746, 805197917,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 204097403, 247022495, 474907856] + AllowGroup = [973510746, 805197917,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 247022495, 474907856] def GETMSG(self): keys = LOLIKEYS From 47f21f80365d2af36573731f0386d9c84e792b14 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 13 Sep 2020 18:12:38 +0800 Subject: [PATCH 164/240] add zhaoan --- .gitignore | 3 ++- req.txt | 21 +++++++++++++++ worker/zhaoan.py | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 worker/zhaoan.py diff --git a/.gitignore b/.gitignore index 320616b..0ea55b8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ config.py .idea test.py push.cmd -data/pcr/char.list \ No newline at end of file +data/pcr/char.list +venv \ No newline at end of file diff --git a/req.txt b/req.txt index 762ff19..df00370 100644 --- a/req.txt +++ b/req.txt @@ -1,31 +1,52 @@ astroid==2.3.3 autopep8==1.5 +backcall==0.2.0 certifi==2019.11.28 chardet==3.0.4 Click==7.0 +decorator==4.4.2 entrypoints==0.3 flake8==3.7.9 Flask==1.1.1 idna==2.9 importlib-metadata==1.5.0 inflect==4.1.0 +ipykernel==5.3.4 +ipython==7.18.1 +ipython-genutils==0.2.0 isort==4.3.21 itsdangerous==1.1.0 jaraco.itertools==5.0.0 +jedi==0.17.2 Jinja2==2.11.1 +jupyter-client==6.1.7 +jupyter-core==4.6.3 lazy-object-proxy==1.4.3 MarkupSafe==1.1.1 mccabe==0.6.1 more-itertools==8.2.0 +parso==0.7.1 +pexpect==4.8.0 +pickleshare==0.7.5 +prompt-toolkit==3.0.7 +ptyprocess==0.6.0 pycodestyle==2.5.0 pydub==0.24.1 pyflakes==2.1.1 +Pygments==2.7.0 pylint==2.4.4 +python-dateutil==2.8.1 +pyzmq==19.0.2 redis==3.4.1 requests==2.23.0 six==1.14.0 +sxtwl==1.1.0 +toml==0.10.1 +tornado==6.0.4 +traitlets==5.0.4 typed-ast==1.4.1 urllib3==1.25.8 +wcwidth==0.2.5 Werkzeug==1.0.0 wolframalpha==4.0.0 wrapt==1.11.2 diff --git a/worker/zhaoan.py b/worker/zhaoan.py new file mode 100644 index 0000000..6738192 --- /dev/null +++ b/worker/zhaoan.py @@ -0,0 +1,68 @@ +from zzcore import StdAns +import requests +import sxtwl +from datetime import datetime +from config import HFWEATHERKEY + + +class Ans(StdAns): + def GETMSG(self): + msg = f'早上好,今天是{calendar()}\n\n' + msg += getWeather() + '\n\n' + t = requests.get('https://v1.hitokoto.cn/?c=k&encode=text').text + msg += t + return msg + + +def getWeather(id='101120206'): + def wemoji(text): + if '雪' in text: + return text + '🌨' + if '雨' in text: + return text + '🌧️' + if '阴' in text: + return text + '⛅' + if '云' in text: + return text + '🌤' + if '晴' in text: + return text + '☀️' + return text + + url = 'https://devapi.heweather.net/v7/weather/3d' + params = { + 'location': id, + 'key': HFWEATHERKEY, + } + r = requests.get(url=url, params=params).json() + tdw = r['daily'][0] + ndw = r['daily'][1] + weather = f"今日日间{wemoji(tdw['textDay'])},温度{tdw['tempMin']}~{tdw['tempMax']}℃,{tdw['windDirDay']}{tdw['windScaleDay']}级;夜间{wemoji(tdw['textNight'])},{tdw['windDirNight']}{tdw['windScaleNight']}级。明日日间{wemoji(ndw['textDay'])},温度{ndw['tempMin']}~{ndw['tempMax']}℃。" + if float(tdw['precip']) > 0: + weather += '\n记得收好衣服,出门带伞~' + + return weather + + +def calendar(): + + ymc = ["十一", "十二", "正", "二", "三", "四", "五", "六", "七", "八", "九", "十"] + rmc = ["初一", "初二", "初三", "初四", "初五", "初六", "初七", "初八", "初九", "初十", "十一", "十二", "十三", "十四", "十五", + "十六", "十七", "十八", "十九", "二十", "廿一", "廿二", "廿三", "廿四", "廿五", "廿六", "廿七", "廿八", "廿九", "三十", "卅一"] + zmc = ["一", "二", "三", "四", "五", "六", "天"] + nowdate = datetime.now() + y = nowdate.year + m = nowdate.month + d = nowdate.day + zc = int(nowdate.strftime("%W")) - 34 + + z = zmc[nowdate.weekday()] + + lunar = sxtwl.Lunar() + lunarday = lunar.getDayBySolar(y, m, d) + + lunardaychinese = f"{ymc[lunarday.Lmc]}月{rmc[lunarday.Ldi]}日" + if lunarday.Lleap: + lunardaychinese = "闰" + lunardaychinese + + cal = f"{y}月{d}日,农历{lunardaychinese},本学期第{zc}周,星期{z}" + return cal From 58722e5a7cd81f2eb04d9c2721965b53b8b5066e Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 13 Sep 2020 18:22:32 +0800 Subject: [PATCH 165/240] delete sb filter --- route.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/route.py b/route.py index 868efa1..1faa2d4 100644 --- a/route.py +++ b/route.py @@ -2,9 +2,6 @@ from worker import emmm def ZZRouter(data): - if data['post_type'] != 'message' or data['message_type'] != 'group' or data['message'][0] != '/': - return - uid = data['user_id'] gid = data['group_id'] role = data['sender']['role'] From ccd3f9709877cc82c647c20963eb3ecd2a3eb0b8 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 13 Sep 2020 19:07:34 +0800 Subject: [PATCH 166/240] =?UTF-8?q?zhaoan=20,=20to=20=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/zhaoan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/zhaoan.py b/worker/zhaoan.py index 6738192..0475606 100644 --- a/worker/zhaoan.py +++ b/worker/zhaoan.py @@ -64,5 +64,5 @@ def calendar(): if lunarday.Lleap: lunardaychinese = "闰" + lunardaychinese - cal = f"{y}月{d}日,农历{lunardaychinese},本学期第{zc}周,星期{z}" + cal = f"{y}月{d}日,农历{lunardaychinese},本学期第{zc}周,星期{z}" return cal From b5a9c65de2f40fec6330fe9bc86db1341b2c40f6 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 13 Sep 2020 19:08:51 +0800 Subject: [PATCH 167/240] fix zhaoan --- worker/zhaoan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/zhaoan.py b/worker/zhaoan.py index 0475606..18b6e84 100644 --- a/worker/zhaoan.py +++ b/worker/zhaoan.py @@ -64,5 +64,5 @@ def calendar(): if lunarday.Lleap: lunardaychinese = "闰" + lunardaychinese - cal = f"{y}月{d}日,农历{lunardaychinese},本学期第{zc}周,星期{z}" + cal = f"{m}月{d}日,农历{lunardaychinese},本学期第{zc}周,星期{z}" return cal From 4655bcc487823e5c104b72df9f3f5a2d80c6fbb7 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 18 Sep 2020 22:18:59 +0800 Subject: [PATCH 168/240] 46jxd wyy --- worker/wyy.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/worker/wyy.py b/worker/wyy.py index 0bf0a3c..3380a21 100644 --- a/worker/wyy.py +++ b/worker/wyy.py @@ -1,5 +1,6 @@ from zzcore import StdAns, mysakuya -import requests +# import requests +import random class Ans(StdAns): def GETMSG(self): @@ -11,5 +12,7 @@ class Ans(StdAns): return msg def wyy(): - r = requests.get(url='http://api.heerdev.top:4995/nemusic/random').json() - return r['text'] \ No newline at end of file + # r = requests.get(url='http://api.heerdev.top:4995/nemusic/random').json() + # return r['text'] + zyy = ["生而为人,为人民服务。", "治世良药,天下赤潮。", "共产主义真好,如果有第二次,我依旧会奉献出全部。", "日推到这首国际歌的同志,一定很进步吧。", "陌生人,如果你刷到这条评论,就参加革命吧。", "温柔吗?革命烈士拿命换的。", "我今天被通缉了,陌生人能替我交个党费吗?", "这么晚还在看毛选的同志,一定心怀理想吧。", "我爱你,就像社会主义初级阶段,没有期限。", "我才五年级,老马讲什么都听不懂了,因为他坚持奋斗福报走资理论。", "自己有多开心,马恩知道,列毛知道,你也一定会知道。", "当你感到孤独的时候,去聆听国际歌,你会找到你的同志的。", "君埋泉下泥销骨,我寄人间建设社会主义现代化。", "生而为人民服务,死而佑华夏千秋。", "听党指挥的你一定很温柔吧。", "在将来,社会上所有人会平等对待每一个人。", "火药是用来做烟火的,锤子是到工厂干活用的镰刀是做农活用的,希望你们能听懂我在说什么。", "爸爸说他不回来吃饭了,因为那是他最后的斗争了。", "有的人8岁就入了党,80岁还在为共产主义事业奋斗。", "你相信吗?也许在另一个平行时空上,地球插满了红旗。", "我能够想到最浪漫的事,就是和你一起建设社会主义。", "是什么让你参加了革命?是那些饥寒交迫的人。", "很喜欢《人间革命》中的一句话,全世界无产者联合起来!", "我想过最浪漫的事情,就是和你在一起,一起做资本主义的掘墓人,一起把资本家吊在路灯上。", "我喜欢你,从初级阶段直到共产主义!", "我认识的人很多,而且我的同志遍布五湖四海。", "你说革命,革命不是请客吃饭,不能那样雅致,那样从容不迫。", "我是七个孩子的父亲(七子之歌)。", "奋斗了三十年他终究还是离开了我们,但他还在我们身边。", "《人间革命》里有这样一句话:仅一夜之间,我的心判若两人。他自工农红军中来,原来只为给我一场社会的大改造。你来时红旗漫卷,我久病难医,你走时换了人间,我自主独立。", "是什么原因让你参加革命啊?这共产主义实现真正实现的时候一定很幸福吧。", "我通过了你的入党申请,现在我们可以开始为全人类解放的伟大事业共同奋斗了。", "上帝为什么要造亚当和夏娃,因为三个人才能成立党支部。", "你走以后,中国梦由我辈当起。", "资产阶级的白鸽不会亲吻乌鸦,世间没有跨阶级的爱。", "我说起风了,不是指天气。", "江姐在我出生前就走了。", "人间值得。", "中国真好,下次还来。"] + return random.choice(zyy) \ No newline at end of file From 547d573eded2297e10791797b99446d24aef3276 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 18 Sep 2020 22:22:10 +0800 Subject: [PATCH 169/240] 46j --- worker/zhaoan.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worker/zhaoan.py b/worker/zhaoan.py index 18b6e84..dc8f6a2 100644 --- a/worker/zhaoan.py +++ b/worker/zhaoan.py @@ -9,7 +9,8 @@ class Ans(StdAns): def GETMSG(self): msg = f'早上好,今天是{calendar()}\n\n' msg += getWeather() + '\n\n' - t = requests.get('https://v1.hitokoto.cn/?c=k&encode=text').text + # t = requests.get('https://v1.hitokoto.cn/?c=k&encode=text').text + t = ("预祝大家四六级考试顺利。") msg += t return msg From 08978a189067c0d171b9d6771fbdfd6e44c06b80 Mon Sep 17 00:00:00 2001 From: SiHuan <49349784+Si-Huan@users.noreply.github.com> Date: Sun, 20 Sep 2020 23:24:48 +0800 Subject: [PATCH 170/240] Update zhaoan.py --- worker/zhaoan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/zhaoan.py b/worker/zhaoan.py index dc8f6a2..df98571 100644 --- a/worker/zhaoan.py +++ b/worker/zhaoan.py @@ -9,8 +9,8 @@ class Ans(StdAns): def GETMSG(self): msg = f'早上好,今天是{calendar()}\n\n' msg += getWeather() + '\n\n' - # t = requests.get('https://v1.hitokoto.cn/?c=k&encode=text').text - t = ("预祝大家四六级考试顺利。") + t = requests.get('https://v1.hitokoto.cn/?c=k&encode=text').text + # t = ("预祝大家四六级考试顺利。") msg += t return msg From 992e337cb45a61f0abf09ca3730f4b7d2fe1cea1 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sat, 24 Oct 2020 18:43:39 +0800 Subject: [PATCH 171/240] add 106 door --- worker/106.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 worker/106.py diff --git a/worker/106.py b/worker/106.py new file mode 100644 index 0000000..41619d6 --- /dev/null +++ b/worker/106.py @@ -0,0 +1,10 @@ +import requests +from zzcore import StdAns + +class Ans(StdAns): + AllowGroup = [959613860] + def GETMSG(self): + seconds = int(requests.get("http://127.0.0.1:8095/").text) + m, s = divmod(seconds, 60) + h, m = divmod(m, 60) + return f'{h}小时{m}分钟{s}秒前有人来过。' \ No newline at end of file From 6f33254e75163e826ab807625f60564089514e35 Mon Sep 17 00:00:00 2001 From: MocyRee <50027802+MocyRee@users.noreply.github.com> Date: Sun, 25 Oct 2020 19:04:17 +0800 Subject: [PATCH 172/240] Update 106.py --- worker/106.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/106.py b/worker/106.py index 41619d6..daf366e 100644 --- a/worker/106.py +++ b/worker/106.py @@ -2,9 +2,9 @@ import requests from zzcore import StdAns class Ans(StdAns): - AllowGroup = [959613860] + AllowGroup = [959613860, 983250332] def GETMSG(self): seconds = int(requests.get("http://127.0.0.1:8095/").text) m, s = divmod(seconds, 60) h, m = divmod(m, 60) - return f'{h}小时{m}分钟{s}秒前有人来过。' \ No newline at end of file + return f'{h}小时{m}分钟{s}秒前有人来过。' From 1fb0bd23d4da0d7c57609918737cf5eff2152257 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 29 Oct 2020 22:26:11 +0800 Subject: [PATCH 173/240] lsp add lingxiao group --- worker/lsp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/lsp.py b/worker/lsp.py index d3c68d3..a1d99e7 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -4,7 +4,7 @@ import requests from config import LOLIKEYS class Ans(StdAns): - AllowGroup = [973510746, 805197917,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 247022495, 474907856] + AllowGroup = [973510746, 805197917,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 247022495, 474907856, 940333876] def GETMSG(self): keys = LOLIKEYS From a6fba1675ee32a5c1828b1e3f9087f02c6722370 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 30 Oct 2020 10:13:44 +0800 Subject: [PATCH 174/240] fix lsp keyword search --- worker/lsp.py | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/worker/lsp.py b/worker/lsp.py index a1d99e7..bd7b688 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -3,12 +3,15 @@ import requests from config import LOLIKEYS + class Ans(StdAns): - AllowGroup = [973510746, 805197917,343700338,125733077,1084566280,920863253,798595664,655057127,196268763, 247022495, 474907856, 940333876] + AllowGroup = [973510746, 805197917, 343700338, 125733077, 1084566280, + 920863253, 798595664, 655057127, 196268763, 247022495, 474907856, 940333876] + def GETMSG(self): keys = LOLIKEYS - + try: nowkey = int(self.DATAGET()['nowkey']) except: @@ -20,43 +23,43 @@ class Ans(StdAns): keyword = self.parms[1] if mysakuya(self, keyword) == False: return "不许你们看咲夜的涩图!!" - + code, quota, picurl = getsetu(keys[nowkey], keyword) - + msg = '' if code == -1 or code == -2: msg += f'>_< 天啦喽,loli 不见了 Code:{code}' elif code == 3: msg += '咱没查到,也有可能是Pixiv坏掉惹' elif code == 0: - if len(self.parms) < 2 or (len(self.parms > 2) and self.parms[2] == 'p'): + if len(self.parms) < 2 or (len(self.parms) > 2 and self.parms[2] == 'p'): msg += f'[CQ:image,file={picurl}]' else: msg += f'[CQ:reply,id={self.mid}]咱帮你🔍{keyword}找到了这个\n{picurl}' - + if quota == 0: - nowkey = (nowkey+1)%(len(keys)) + nowkey = (nowkey+1) % (len(keys)) if code == 429: msg += f'>_< 已经没有 loli 啦,帮你换到了key{nowkey},再试一下吧' else: msg += f'额度用光了,下次将使用 key{nowkey}' - self.DATASET({'nowkey':nowkey}) + self.DATASET({'nowkey': nowkey}) return msg - - -def getsetu(apikey, keyword = ''): + + +def getsetu(apikey, keyword=''): url = 'https://api.lolicon.app/setu/' params = { 'apikey': apikey, } if keyword != '': params['keyword'] = keyword - + try: - resp = requests.get(url=url,params=params).json() + resp = requests.get(url=url, params=params).json() except: - return -1, -1 ,'' - + return -1, -1, '' + #quota = str(resp['quota']) #seconds = resp['quota_min_ttl'] #m, s = divmod(seconds, 60) @@ -74,4 +77,5 @@ def getsetu(apikey, keyword = ''): elif resp['code'] == 429: return 429, 0, '' else: + # print(resp['code']) return -2, -1, '' From b9b7d96e856a359f8915e39b3895b622e1d7f1eb Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 18 Dec 2020 21:03:30 +0800 Subject: [PATCH 175/240] add remote mc --- data/mc/rmc/go.mod | 3 ++ data/mc/rmc/main.go | 64 +++++++++++++++++++++++++++++++++ sample_config.py | 4 ++- worker/mc.py | 88 +++++++++++++++++++++++++++++---------------- 4 files changed, 128 insertions(+), 31 deletions(-) create mode 100644 data/mc/rmc/go.mod create mode 100644 data/mc/rmc/main.go diff --git a/data/mc/rmc/go.mod b/data/mc/rmc/go.mod new file mode 100644 index 0000000..e40a8ab --- /dev/null +++ b/data/mc/rmc/go.mod @@ -0,0 +1,3 @@ +module rmc + +go 1.15 diff --git a/data/mc/rmc/main.go b/data/mc/rmc/main.go new file mode 100644 index 0000000..224aabe --- /dev/null +++ b/data/mc/rmc/main.go @@ -0,0 +1,64 @@ +package main + +import ( + "bytes" + "fmt" + "io/ioutil" + "log" + "net/http" + "os/exec" +) + +func checkErr(err error) { + if err != nil { + fmt.Println(err) + } +} + +func handleStatus(writer http.ResponseWriter, request *http.Request) { + cmd := exec.Command("papermc", "status") + var out bytes.Buffer + cmd.Stdout = &out + err := cmd.Run() + if err != nil { + fmt.Fprintf(writer, "Error") + return + } + fmt.Fprintf(writer, out.String()) +} + +func handleList(writer http.ResponseWriter, request *http.Request) { + cmd := exec.Command("papermc", "command", "list") + var out bytes.Buffer + cmd.Stdout = &out + err := cmd.Run() + if err != nil { + fmt.Fprintf(writer, "Error") + return + } + fmt.Fprintf(writer, out.String()) +} + +func handleSay(writer http.ResponseWriter, request *http.Request) { + saywhat, _ := ioutil.ReadAll(request.Body) + cmd := exec.Command("papermc", "command", "say", string(saywhat)) + var out bytes.Buffer + cmd.Stdout = &out + err := cmd.Run() + if err != nil { + fmt.Fprintf(writer, "Error") + return + } + fmt.Fprintf(writer, "0") +} + +func main() { + http.HandleFunc("/status", handleStatus) + http.HandleFunc("/list", handleList) + http.HandleFunc("/say", handleSay) + fmt.Println("Running at port 58941 ...") + err := http.ListenAndServe("172.26.66.2:58941", nil) + if err != nil { + log.Fatal("ListenAndServe: ", err.Error()) + } +} diff --git a/sample_config.py b/sample_config.py index 56baf85..5bd18c1 100644 --- a/sample_config.py +++ b/sample_config.py @@ -6,4 +6,6 @@ AUTHORIZATION = '' HOST = '0.0.0.0' -PORT = 5580 \ No newline at end of file +PORT = 5580 + +REMOTE_MC_URL = '' \ No newline at end of file diff --git a/worker/mc.py b/worker/mc.py index 7691d81..66f2f4a 100644 --- a/worker/mc.py +++ b/worker/mc.py @@ -1,7 +1,9 @@ from zzcore import StdAns -import re +import re, requests from subprocess import getoutput,call +from config import REMOTE_MC_URL + class Ans(StdAns): AllowGroup = [959613860, 125733077, 204097403, 1140391080] AllowUser = [1318000868] @@ -13,39 +15,65 @@ class Ans(StdAns): if cmd in AllowCmd: if cmd == 'status': - output = getoutput('spigot status') - p = re.compile(r'processes = ([0-9]*) \(') - prsnum = re.findall(p,output)[0] - p = re.compile(r' \((.*?)\)',re.S) - prsnames = re.findall(p,output)[0].split(', ') - p = re.compile(r'Total memory usage = (.*)$') - memory = re.findall(p,output)[0] - msg = '咱的MC服务器现在有 ' - for prsname in prsnames: - msg = msg + prsname + ' ' - msg = msg + '这' + prsnum +'个进程,\n一共占用了' + memory +'内存呢。' + msg = getStatus() elif cmd == 'list': - output = getoutput('spigot command list') - p = re.compile(r'There are (.*?)[ of a max]', re.S) - online = re.findall(p,output)[0] - if online == '0': - msg = '咱看着没有人在线哎\n_(-ω-`_)⌒)_' - else: - msg = '有' + online + '个小伙伴在线!' - p = re.compile(r'online: (.*?)[\n>]', re.S) - players = re.findall(p,output)[0].split(', ') - for player in players: - msg = msg + '\n' + player + msg = getList() elif cmd == 'say': saywhat = self.raw_msg['message'][8:] - if not saywhat: - return '汝让咱say what?o(≧口≦)o' - shellcmd = ['spigot','command','say',saywhat] - if call(shellcmd) == 0: - msg = '咱已经把消息传过去了。' - else: - msg = '٩(ŏ﹏ŏ、)۶竟然失败了,汝是不是让我发送奇怪的话过去!' + msg = say(saywhat) else: msg = '汝是不是在mc后面添加了奇怪的参数,咱可只知道 status list 和 say。' return msg + +def getStatus(): + if REMOTE_MC_URL: + output = requests.post(f'{REMOTE_MC_URL}/status') + else: + output = getoutput('papermc status') + + p = re.compile(r'processes = ([0-9]*) \(') + prsnum = re.findall(p,output)[0] + p = re.compile(r' \((.*?)\)',re.S) + prsnames = re.findall(p,output)[0].split(', ') + p = re.compile(r'Total memory usage = (.*)$') + memory = re.findall(p,output)[0] + msg = '咱的MC服务器现在有 ' + for prsname in prsnames: + msg = msg + prsname + ' ' + msg = msg + '这' + prsnum +'个进程,\n一共占用了' + memory +'内存呢。' + return msg + + +def getList(): + if REMOTE_MC_URL: + output = requests.post(f'{REMOTE_MC_URL}/list') + else: + output = getoutput('papermc command list') + + p = re.compile(r'There are (.*?)[ of a max]', re.S) + online = re.findall(p,output)[0] + if online == '0': + msg = '咱看着没有人在线哎\n_(-ω-`_)⌒)_' + else: + msg = '有' + online + '个小伙伴在线!' + p = re.compile(r'online: (.*?)[\n>]', re.S) + players = re.findall(p,output)[0].split(', ') + for player in players: + msg = msg + '\n' + player + return msg + +def say(saywhat): + if not saywhat: + return '汝让咱say what?o(≧口≦)o' + + if REMOTE_MC_URL: + code = requests.post(f'{REMOTE_MC_URL}/say',data=saywhat) + else: + shellcmd = ['papermc','command','say',saywhat] + code = call(shellcmd) + if code == 0: + msg = '咱已经把消息传过去了。' + else: + msg = '٩(ŏ﹏ŏ、)۶竟然失败了,汝是不是让我发送奇怪的话过去!' + return msg \ No newline at end of file From 32c407cfff156667740c76f2e742a0d92da661f8 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 18 Dec 2020 21:07:22 +0800 Subject: [PATCH 176/240] fix remote mc --- worker/mc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/mc.py b/worker/mc.py index 66f2f4a..3cb1b89 100644 --- a/worker/mc.py +++ b/worker/mc.py @@ -28,7 +28,7 @@ class Ans(StdAns): def getStatus(): if REMOTE_MC_URL: - output = requests.post(f'{REMOTE_MC_URL}/status') + output = requests.post(f'{REMOTE_MC_URL}/status').text else: output = getoutput('papermc status') @@ -47,7 +47,7 @@ def getStatus(): def getList(): if REMOTE_MC_URL: - output = requests.post(f'{REMOTE_MC_URL}/list') + output = requests.post(f'{REMOTE_MC_URL}/list').text else: output = getoutput('papermc command list') @@ -68,7 +68,7 @@ def say(saywhat): return '汝让咱say what?o(≧口≦)o' if REMOTE_MC_URL: - code = requests.post(f'{REMOTE_MC_URL}/say',data=saywhat) + code = requests.post(f'{REMOTE_MC_URL}/say',data=saywhat).text else: shellcmd = ['papermc','command','say',saywhat] code = call(shellcmd) From b16b749b95ab110451ef27db6de0a87691ac1dfb Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 18 Dec 2020 21:08:31 +0800 Subject: [PATCH 177/240] fix fix remote mc --- worker/mc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/mc.py b/worker/mc.py index 3cb1b89..381cd8c 100644 --- a/worker/mc.py +++ b/worker/mc.py @@ -72,7 +72,7 @@ def say(saywhat): else: shellcmd = ['papermc','command','say',saywhat] code = call(shellcmd) - if code == 0: + if code == '0': msg = '咱已经把消息传过去了。' else: msg = '٩(ŏ﹏ŏ、)۶竟然失败了,汝是不是让我发送奇怪的话过去!' From 6db834d42fc76a9841308b519e87f14e87ecf6b3 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 18 Dec 2020 21:11:18 +0800 Subject: [PATCH 178/240] fix mc allow user --- worker/mc.py | 1 - 1 file changed, 1 deletion(-) diff --git a/worker/mc.py b/worker/mc.py index 381cd8c..5a36c1a 100644 --- a/worker/mc.py +++ b/worker/mc.py @@ -6,7 +6,6 @@ from config import REMOTE_MC_URL class Ans(StdAns): AllowGroup = [959613860, 125733077, 204097403, 1140391080] - AllowUser = [1318000868] def GETMSG(self): if len(self.parms) < 2: return '不加参数是坏文明!' From 0921a5912228f8976f07de350eae983ce53fdcab Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sat, 26 Dec 2020 20:09:56 +0800 Subject: [PATCH 179/240] add rss --- worker/rss.py | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 worker/rss.py diff --git a/worker/rss.py b/worker/rss.py new file mode 100644 index 0000000..8039316 --- /dev/null +++ b/worker/rss.py @@ -0,0 +1,107 @@ +from zzcore import StdAns + +import feedparser, json + +allowCMD = ['sub','unsub','list','get'] + +allSub = [ + { + 'url' : 'https://farseerfc.me/feeds/atom.xml', + 'title' : 'Farseerfc的小窩', + 'lastUpdated' : 'Sat, 12 Dec 2020 22:55:52 +0800', + } +] + +class Ans(StdAns): + + def push(self,title,posttitle,posturl): + msg = f'{title}\n{posttitle} {posturl}' + self.sendmsg(msg) + + def GETMSG(self): + + if len(self.parms) < 2: + return '不加参数是坏文明!' + + gid = str(self.gid) + cmd = self.parms[1] + if cmd not in allowCMD: + return f'咱不知道 {cmd} 是什么东西 ●﹏●' + + try: + nowdata = json.loads(self.DATAGET()[gid]) + except: + nowdata ={ + 'allSub' : {}, + 'status' : False, + } + + if cmd == 'sub': + if len(self.parms) < 3: + return '汝想订阅什么呢?' + + suburl = self.parms[2] + try: + d = feedparser.parse(suburl) + title = d.feed.title + lastUpdated = d.feed.updated + + except: + return "咱好像没能成功订阅 (╥_╥)" + + newsub = { + 'url': suburl, + 'title': title, + 'lastUpdated' : lastUpdated, + } + + nowdata['allSub'][suburl] = newsub + + msg = f'《{title}》订阅成功' + + elif cmd == 'unsub': + if len(self.parms) < 3: + return '汝想退订什么呢?' + + suburl = self.parms[2] + if suburl not in nowdata['allSub'].keys(): + return '汝没有订阅过这个!' + + unsub = nowdata['allSub'].pop(suburl) + + msg = f'《{unsub.title}》已退订' + + elif cmd == 'list': + msg = '订阅列表' + + for sub in nowdata['allSub']: + msg += f'\n{sub.title} {sub.url}' + + elif cmd == 'enable': + nowdata['status'] = True + self.DATASET({gid:json.dumps(nowdata)}) + self.sendmsg("订阅已启用,咱会每隔五分钟抓去订阅,有新内容就会推送哦") + while(nowdata['status']): + nowdata = json.loads(self.DATAGET()[gid]) + for sub in nowdata['allSub']: + try: + d = feedparser.parse(sub['url']) + except: + self.sendmsg(f"咱抓取不到 《{sub['title']}》!") + continue + if d.feed.updated == sub['lastUpdated']: + continue + + newfeedtitle = d.entries[0].title + newfeedlink = d.entries[0].link + self.push(sub['title'], newfeedtitle, newfeedlink) + nowdata['allSub'][sub['url']]['lastUpdated'] = d.feed.updated + self.DATASET({gid:json.dumps(nowdata)}) + + elif cmd == 'disable': + nowdata['status'] = False + msg = '咱不会再推送了!' + + self.DATASET({gid:json.dumps(nowdata)}) + return msg + \ No newline at end of file From 8693914a869fb6d4a9f731c3d52ac9f6daa2ba4f Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sat, 26 Dec 2020 20:17:57 +0800 Subject: [PATCH 180/240] fix rss --- worker/rss.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/worker/rss.py b/worker/rss.py index 8039316..61a844b 100644 --- a/worker/rss.py +++ b/worker/rss.py @@ -2,15 +2,15 @@ from zzcore import StdAns import feedparser, json -allowCMD = ['sub','unsub','list','get'] +allowCMD = ['sub','unsub','list','disable'] -allSub = [ - { - 'url' : 'https://farseerfc.me/feeds/atom.xml', - 'title' : 'Farseerfc的小窩', - 'lastUpdated' : 'Sat, 12 Dec 2020 22:55:52 +0800', - } -] +# allSub = { +# 'https://farseerfc.me/feeds/atom.xml' : { +# 'url' : 'https://farseerfc.me/feeds/atom.xml', +# 'title' : 'Farseerfc的小窩', +# 'lastUpdated' : 'Sat, 12 Dec 2020 22:55:52 +0800', +# } +# } class Ans(StdAns): @@ -75,7 +75,7 @@ class Ans(StdAns): msg = '订阅列表' for sub in nowdata['allSub']: - msg += f'\n{sub.title} {sub.url}' + msg += f"\n{sub['title']} {sub['url']}" elif cmd == 'enable': nowdata['status'] = True From 5960a4eef985fc9adb3905336a89b7eb538ad203 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sat, 26 Dec 2020 20:21:39 +0800 Subject: [PATCH 181/240] fix rss --- worker/rss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/rss.py b/worker/rss.py index 61a844b..44f1b57 100644 --- a/worker/rss.py +++ b/worker/rss.py @@ -69,7 +69,7 @@ class Ans(StdAns): unsub = nowdata['allSub'].pop(suburl) - msg = f'《{unsub.title}》已退订' + msg = f"《{unsub['title']}》已退订" elif cmd == 'list': msg = '订阅列表' From 4494986292b23193f19e6ab61781f7c1273675a0 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sat, 26 Dec 2020 20:25:34 +0800 Subject: [PATCH 182/240] fix rss --- worker/rss.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/rss.py b/worker/rss.py index 44f1b57..59375cd 100644 --- a/worker/rss.py +++ b/worker/rss.py @@ -74,7 +74,7 @@ class Ans(StdAns): elif cmd == 'list': msg = '订阅列表' - for sub in nowdata['allSub']: + for sub in nowdata['allSub'].values(): msg += f"\n{sub['title']} {sub['url']}" elif cmd == 'enable': @@ -83,7 +83,7 @@ class Ans(StdAns): self.sendmsg("订阅已启用,咱会每隔五分钟抓去订阅,有新内容就会推送哦") while(nowdata['status']): nowdata = json.loads(self.DATAGET()[gid]) - for sub in nowdata['allSub']: + for sub in nowdata['allSub'].values(): try: d = feedparser.parse(sub['url']) except: From 9ea6965985ec6f852ce3e2fc317baaf8ed0b7bef Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sat, 26 Dec 2020 20:31:53 +0800 Subject: [PATCH 183/240] fix rss --- worker/rss.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/rss.py b/worker/rss.py index 59375cd..36c561e 100644 --- a/worker/rss.py +++ b/worker/rss.py @@ -44,7 +44,7 @@ class Ans(StdAns): try: d = feedparser.parse(suburl) title = d.feed.title - lastUpdated = d.feed.updated + lastUpdated = d.entries[0].published except: return "咱好像没能成功订阅 (╥_╥)" @@ -89,13 +89,13 @@ class Ans(StdAns): except: self.sendmsg(f"咱抓取不到 《{sub['title']}》!") continue - if d.feed.updated == sub['lastUpdated']: + if d.entries[0].published == sub['lastUpdated']: continue newfeedtitle = d.entries[0].title newfeedlink = d.entries[0].link self.push(sub['title'], newfeedtitle, newfeedlink) - nowdata['allSub'][sub['url']]['lastUpdated'] = d.feed.updated + nowdata['allSub'][sub['url']]['lastUpdated'] = d.entries[0].published self.DATASET({gid:json.dumps(nowdata)}) elif cmd == 'disable': From 678edc243a448334fe096e7d0b1feab83e3ada84 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sat, 26 Dec 2020 20:33:25 +0800 Subject: [PATCH 184/240] fix rss --- worker/rss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/rss.py b/worker/rss.py index 36c561e..a1679e6 100644 --- a/worker/rss.py +++ b/worker/rss.py @@ -2,7 +2,7 @@ from zzcore import StdAns import feedparser, json -allowCMD = ['sub','unsub','list','disable'] +allowCMD = ['sub','unsub','list','disable', 'enable'] # allSub = { # 'https://farseerfc.me/feeds/atom.xml' : { From d9b976d9c68271188ad763012abfe9de1633d3c8 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sat, 26 Dec 2020 20:36:04 +0800 Subject: [PATCH 185/240] fix rss --- worker/rss.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/worker/rss.py b/worker/rss.py index a1679e6..7566f60 100644 --- a/worker/rss.py +++ b/worker/rss.py @@ -1,6 +1,6 @@ from zzcore import StdAns -import feedparser, json +import feedparser, json, time allowCMD = ['sub','unsub','list','disable', 'enable'] @@ -80,7 +80,7 @@ class Ans(StdAns): elif cmd == 'enable': nowdata['status'] = True self.DATASET({gid:json.dumps(nowdata)}) - self.sendmsg("订阅已启用,咱会每隔五分钟抓去订阅,有新内容就会推送哦") + self.sendmsg("订阅已启用,咱会每隔五分钟抓取订阅,有新内容就会推送哦") while(nowdata['status']): nowdata = json.loads(self.DATAGET()[gid]) for sub in nowdata['allSub'].values(): @@ -97,6 +97,7 @@ class Ans(StdAns): self.push(sub['title'], newfeedtitle, newfeedlink) nowdata['allSub'][sub['url']]['lastUpdated'] = d.entries[0].published self.DATASET({gid:json.dumps(nowdata)}) + time.sleep() elif cmd == 'disable': nowdata['status'] = False From 3016375ee0edad10d5066c76dafd8b621616a6b3 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sat, 26 Dec 2020 20:47:52 +0800 Subject: [PATCH 186/240] fix rss --- worker/rss.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/worker/rss.py b/worker/rss.py index 7566f60..7c82b09 100644 --- a/worker/rss.py +++ b/worker/rss.py @@ -99,6 +99,8 @@ class Ans(StdAns): self.DATASET({gid:json.dumps(nowdata)}) time.sleep() + return '订阅已经真的停了!' + elif cmd == 'disable': nowdata['status'] = False msg = '咱不会再推送了!' From 0aa5d90994158d8acaf1679591250eca8f26d71d Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sat, 26 Dec 2020 21:56:08 +0800 Subject: [PATCH 187/240] fix rss --- worker/rss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/rss.py b/worker/rss.py index 7c82b09..3f0b0ea 100644 --- a/worker/rss.py +++ b/worker/rss.py @@ -97,7 +97,7 @@ class Ans(StdAns): self.push(sub['title'], newfeedtitle, newfeedlink) nowdata['allSub'][sub['url']]['lastUpdated'] = d.entries[0].published self.DATASET({gid:json.dumps(nowdata)}) - time.sleep() + time.sleep(5000) return '订阅已经真的停了!' From 5989d46349bb08a5279fc38c5d4397afafd631ee Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sat, 26 Dec 2020 22:40:31 +0800 Subject: [PATCH 188/240] fix rss --- worker/rss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/rss.py b/worker/rss.py index 3f0b0ea..90546b9 100644 --- a/worker/rss.py +++ b/worker/rss.py @@ -97,7 +97,7 @@ class Ans(StdAns): self.push(sub['title'], newfeedtitle, newfeedlink) nowdata['allSub'][sub['url']]['lastUpdated'] = d.entries[0].published self.DATASET({gid:json.dumps(nowdata)}) - time.sleep(5000) + time.sleep(300) return '订阅已经真的停了!' From 78d33c4ef556dbe918b682ee09f08c4f7bb788e6 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 13 Jan 2021 09:50:36 +0800 Subject: [PATCH 189/240] update zhaoan --- worker/zhaoan.py | 8 ++++---- zaoan.py | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 zaoan.py diff --git a/worker/zhaoan.py b/worker/zhaoan.py index df98571..678e2f7 100644 --- a/worker/zhaoan.py +++ b/worker/zhaoan.py @@ -46,7 +46,7 @@ def getWeather(id='101120206'): def calendar(): - ymc = ["十一", "十二", "正", "二", "三", "四", "五", "六", "七", "八", "九", "十"] + ymc = ["冬", "腊", "正", "二", "三", "四", "五", "六", "七", "八", "九", "十"] rmc = ["初一", "初二", "初三", "初四", "初五", "初六", "初七", "初八", "初九", "初十", "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十", "廿一", "廿二", "廿三", "廿四", "廿五", "廿六", "廿七", "廿八", "廿九", "三十", "卅一"] zmc = ["一", "二", "三", "四", "五", "六", "天"] @@ -54,16 +54,16 @@ def calendar(): y = nowdate.year m = nowdate.month d = nowdate.day - zc = int(nowdate.strftime("%W")) - 34 + zc = int(nowdate.strftime("%W")) - 1 z = zmc[nowdate.weekday()] lunar = sxtwl.Lunar() lunarday = lunar.getDayBySolar(y, m, d) - lunardaychinese = f"{ymc[lunarday.Lmc]}月{rmc[lunarday.Ldi]}日" + lunardaychinese = f"{ymc[lunarday.Lmc]}月{rmc[lunarday.Ldi]}" if lunarday.Lleap: lunardaychinese = "闰" + lunardaychinese - cal = f"{m}月{d}日,农历{lunardaychinese},本学期第{zc}周,星期{z}" + cal = f"{m}月{d}日,{lunardaychinese},寒假第{zc}周,星期{z}" return cal diff --git a/zaoan.py b/zaoan.py new file mode 100644 index 0000000..80b40f3 --- /dev/null +++ b/zaoan.py @@ -0,0 +1,36 @@ +import requests +import json + +url = 'http://127.0.0.1:5580/' +headers = {'Content-Type': 'application/json'} + +gids = [743539576, 959613860, 1107535671] + +data = { + "anonymous": "None", + "font": 1501544, + "group_id": 959613860, + "message": "/zhaoan", + "message_id": 2071, + "message_type": "group", + "post_type": "message", + "raw_message": "/zhaoan", + "self_id": 161795000, + "sender": { + "age": 18, + "area": "济宁", + "card": "", + "level": "活跃", + "nickname": "SiHuan", + "role": "owner", + "sex": "unknown", + "title": "", + "user_id": 1318000000 + }, + "sub_type": "normal", + "time": 1582805370, + "user_id": 1318000000 +} +for gid in gids: + data['group_id'] = gid + requests.post(url=url, headers=headers, data=json.dumps(data)) \ No newline at end of file From ae6fc2c290345b91b6b50d3a20ee8b15cb826dd8 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 13 Jan 2021 09:52:31 +0800 Subject: [PATCH 190/240] rm zaoan script --- zaoan.py | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 zaoan.py diff --git a/zaoan.py b/zaoan.py deleted file mode 100644 index 80b40f3..0000000 --- a/zaoan.py +++ /dev/null @@ -1,36 +0,0 @@ -import requests -import json - -url = 'http://127.0.0.1:5580/' -headers = {'Content-Type': 'application/json'} - -gids = [743539576, 959613860, 1107535671] - -data = { - "anonymous": "None", - "font": 1501544, - "group_id": 959613860, - "message": "/zhaoan", - "message_id": 2071, - "message_type": "group", - "post_type": "message", - "raw_message": "/zhaoan", - "self_id": 161795000, - "sender": { - "age": 18, - "area": "济宁", - "card": "", - "level": "活跃", - "nickname": "SiHuan", - "role": "owner", - "sex": "unknown", - "title": "", - "user_id": 1318000000 - }, - "sub_type": "normal", - "time": 1582805370, - "user_id": 1318000000 -} -for gid in gids: - data['group_id'] = gid - requests.post(url=url, headers=headers, data=json.dumps(data)) \ No newline at end of file From 1d186058493832bad2e82767e28e4d612804c8d6 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 14 Jan 2021 09:47:58 +0800 Subject: [PATCH 191/240] update zhaoan --- worker/zhaoan.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/worker/zhaoan.py b/worker/zhaoan.py index 678e2f7..085f02c 100644 --- a/worker/zhaoan.py +++ b/worker/zhaoan.py @@ -36,8 +36,9 @@ def getWeather(id='101120206'): } r = requests.get(url=url, params=params).json() tdw = r['daily'][0] - ndw = r['daily'][1] - weather = f"今日日间{wemoji(tdw['textDay'])},温度{tdw['tempMin']}~{tdw['tempMax']}℃,{tdw['windDirDay']}{tdw['windScaleDay']}级;夜间{wemoji(tdw['textNight'])},{tdw['windDirNight']}{tdw['windScaleNight']}级。明日日间{wemoji(ndw['textDay'])},温度{ndw['tempMin']}~{ndw['tempMax']}℃。" + # ndw = r['daily'][1] + # weather = f"今日日间{wemoji(tdw['textDay'])},温度{tdw['tempMin']}~{tdw['tempMax']}℃,{tdw['windDirDay']}{tdw['windScaleDay']}级;夜间{wemoji(tdw['textNight'])},{tdw['windDirNight']}{tdw['windScaleNight']}级。明日日间{wemoji(ndw['textDay'])},温度{ndw['tempMin']}~{ndw['tempMax']}℃。" + weather = f"今日日间{wemoji(tdw['textDay'])},温度{tdw['tempMin']}~{tdw['tempMax']}℃,{tdw['windDirDay']}{tdw['windScaleDay']}级;夜间{wemoji(tdw['textNight'])},{tdw['windDirNight']}{tdw['windScaleNight']}级。" if float(tdw['precip']) > 0: weather += '\n记得收好衣服,出门带伞~' @@ -51,6 +52,8 @@ def calendar(): "十六", "十七", "十八", "十九", "二十", "廿一", "廿二", "廿三", "廿四", "廿五", "廿六", "廿七", "廿八", "廿九", "三十", "卅一"] zmc = ["一", "二", "三", "四", "五", "六", "天"] nowdate = datetime.now() + kaoyandate = datetime(2021,12,26) + djs = (kaoyandate - nowdate).days y = nowdate.year m = nowdate.month d = nowdate.day @@ -65,5 +68,5 @@ def calendar(): if lunarday.Lleap: lunardaychinese = "闰" + lunardaychinese - cal = f"{m}月{d}日,{lunardaychinese},寒假第{zc}周,星期{z}" + cal = f"{m}月{d}日,{lunardaychinese},寒假第{zc}周,星期{z}\n距离 2022 考研还有 {djs} 天" return cal From 22362ff46e34b57f9ed4f7b4ffd6f24509adcc0d Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 14 Jan 2021 09:50:41 +0800 Subject: [PATCH 192/240] update zhaoan --- worker/zhaoan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/zhaoan.py b/worker/zhaoan.py index 085f02c..bac6518 100644 --- a/worker/zhaoan.py +++ b/worker/zhaoan.py @@ -53,7 +53,7 @@ def calendar(): zmc = ["一", "二", "三", "四", "五", "六", "天"] nowdate = datetime.now() kaoyandate = datetime(2021,12,26) - djs = (kaoyandate - nowdate).days + djs = (kaoyandate - nowdate).days - 1 y = nowdate.year m = nowdate.month d = nowdate.day From d6dc0962c6a0c3038a62055c622ecfadd2ed9cd1 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 14 Jan 2021 09:54:53 +0800 Subject: [PATCH 193/240] update zhaoan --- worker/zhaoan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/zhaoan.py b/worker/zhaoan.py index bac6518..aa7ffd5 100644 --- a/worker/zhaoan.py +++ b/worker/zhaoan.py @@ -68,5 +68,5 @@ def calendar(): if lunarday.Lleap: lunardaychinese = "闰" + lunardaychinese - cal = f"{m}月{d}日,{lunardaychinese},寒假第{zc}周,星期{z}\n距离 2022 考研还有 {djs} 天" + cal = f"{m}月{d}日,{lunardaychinese},寒假第{zc}周,星期{z}\n\n距离 2022 考研还有 {djs} 天" return cal From ee52cd135f2003c07cd396e6819a08a0257b0433 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 14 Jan 2021 14:12:53 +0800 Subject: [PATCH 194/240] update zhaoan --- worker/zhaoan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/zhaoan.py b/worker/zhaoan.py index aa7ffd5..06da5d3 100644 --- a/worker/zhaoan.py +++ b/worker/zhaoan.py @@ -52,8 +52,8 @@ def calendar(): "十六", "十七", "十八", "十九", "二十", "廿一", "廿二", "廿三", "廿四", "廿五", "廿六", "廿七", "廿八", "廿九", "三十", "卅一"] zmc = ["一", "二", "三", "四", "五", "六", "天"] nowdate = datetime.now() - kaoyandate = datetime(2021,12,26) - djs = (kaoyandate - nowdate).days - 1 + kaoyandate = datetime(2021,12,21) + djs = (kaoyandate - nowdate).days -1 y = nowdate.year m = nowdate.month d = nowdate.day From 4a2882ed545e3503f69d2dc031462011b8f7aee0 Mon Sep 17 00:00:00 2001 From: weilinfox Date: Tue, 26 Jan 2021 00:30:01 +0800 Subject: [PATCH 195/240] fix qymusic --- worker/qymusic.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/qymusic.py b/worker/qymusic.py index 3d59627..a616040 100644 --- a/worker/qymusic.py +++ b/worker/qymusic.py @@ -29,9 +29,9 @@ class Ans(StdAns): # print(resp) if resp['data']['song']['totalnum'] == 0: return '啊嘞嘞好像没有诶qaq' - mid = resp['data']['song']['list'][0]['mid'] - # id = resp['data']['song']['list'][0]['id'] - msg = f'[CQ:music,type=qq,id={mid}]' + # mid = resp['data']['song']['list'][0]['mid'] + id = resp['data']['song']['list'][0]['id'] + msg = f'[CQ:music,type=qq,id={id}]' # mname = resp['data']['song']['list'][0]['name'] # msg = '[CQ:share,url=https://y.qq.com/n/yqq/song/' + str(mid) + '.html,title=' + str(mname) + ']' except Exception as e: From 6ed9adfaaf3c5d3433205ae3375f7e5e32f6eabf Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 26 Jan 2021 23:58:00 +0800 Subject: [PATCH 196/240] add wait --- route.py | 2 +- worker/wait.py | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 worker/wait.py diff --git a/route.py b/route.py index 1faa2d4..06c8257 100644 --- a/route.py +++ b/route.py @@ -6,7 +6,7 @@ def ZZRouter(data): gid = data['group_id'] role = data['sender']['role'] mid = data['message_id'] - parms = str.split(data['message'][1:]) + parms = str.split(data['message'][0]['data']['text'][1:]) print(uid, gid, role, parms) if parms == []: parms[0] = 'help' diff --git a/worker/wait.py b/worker/wait.py new file mode 100644 index 0000000..3da9244 --- /dev/null +++ b/worker/wait.py @@ -0,0 +1,23 @@ +from zzcore import StdAns +import re +import requests + + +class Ans(StdAns): + def GETMSG(self): + try: + url = self.raw_msg['message'][1]['data']['url'] + resp = requests.get( + f"https://trace.moe/api/search?url={url}").json()['docs'][0] + except: + return "There something wrong." + + video_url = f"https://media.trace.moe/video/{resp['anilist_id']}/{resp['filename']}?t={resp['at']}&token={resp['tokenthumb']}" + + m, s = divmod(float(resp['at']), 60) + h, m = divmod(m, 60) + print("%02d:%02d:%02d" % (h, m, s)) + text = f"{resp['title_native']}\n{resp['title_chinese']}\nEP#{resp['episode']} {h:02.0f}:{m:02.0f}:{s:02.0f}\n{resp['similarity'][:5]} similarity" + + msg = f"[CQ:video,file={video_url}]\n{text}" + return msg \ No newline at end of file From 76ec3a3068b1b28e1e0ed3fe384d3ae004d3c342 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 27 Jan 2021 10:05:06 +0800 Subject: [PATCH 197/240] core add get_img --- zzcore.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zzcore.py b/zzcore.py index 6117918..81b8fd5 100644 --- a/zzcore.py +++ b/zzcore.py @@ -49,6 +49,14 @@ class StdAns(): } return requests.get(url = url, params=data).json()['data']['message_id'] + def get_img(self,cache_name): + url = APIURL + "get_image" + + data = { + 'access_token' : AUTHORIZATION, + 'file': cache_name + } + return requests.get(url = url, params=data).json()['data']['url'] def delmsg(self,msgid): url = APIURL + "delete_msg" From ee6e02961dfaacde86da66c2b7a4b2d241f0c557 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 27 Jan 2021 11:33:32 +0800 Subject: [PATCH 198/240] use array msg --- exmple.json | 9 ++++++++- test.py | 15 ++++++++++++--- worker/bbc.py | 2 +- worker/bing.py | 2 +- worker/broadcast.py | 2 +- worker/echo.py | 6 +++--- worker/emmm.py | 2 +- worker/hhsh.py | 2 +- worker/mc.py | 2 +- worker/music.py | 2 +- worker/ns.py | 2 +- worker/pcr.py | 2 +- worker/qymusic.py | 2 +- worker/run.py | 2 +- worker/talk.py | 2 +- worker/wait.py | 4 ++-- worker/wolfram.py | 2 +- 17 files changed, 38 insertions(+), 22 deletions(-) diff --git a/exmple.json b/exmple.json index bd8d1df..b06162b 100644 --- a/exmple.json +++ b/exmple.json @@ -2,7 +2,14 @@ "anonymous": "None", "font": 1501544, "group_id": 959613000, - "message": "/ping", + "message": [ + { + "data": { + "text": "/ping" + }, + "type": "text" + } + ], "message_id": 2071, "message_type": "group", "post_type": "message", diff --git a/test.py b/test.py index 8902ccc..665b303 100644 --- a/test.py +++ b/test.py @@ -1,10 +1,12 @@ from worker import emmm debug = True + def de(e): if debug: print('DEBUG '+str(e)) + print("开始测试咯,在 '>' 后面输入n你的消息,不用加 '/'") inp = input('>') while(inp): @@ -12,14 +14,21 @@ while(inp): worker = parms[0] try: - package = __import__(name='worker.'+ worker, fromlist=worker) - Ans_ = getattr(package,'Ans') + package = __import__(name='worker.' + worker, fromlist=worker) + Ans_ = getattr(package, 'Ans') except Exception as e: de(e) Ans_ = emmm.Ans de(Ans_) try: - Ans = Ans_(parms,uid=0,gid=0,role='owner',mid=1001, raw_msg={'message':'/' + inp, 'message_id' : '1001'}) + Ans = Ans_(parms, uid=0, gid=0, role='owner', mid=1001, raw_msg={'message': [ + { + "data": { + "text": f"/{inp}" + }, + "type": "text" + } + ], 'message_id': '1001', 'raw_message': f"/{inp}"}) Message = Ans.GETMSG() except Exception as e: Message = ' Error:\n'+str(e) diff --git a/worker/bbc.py b/worker/bbc.py index b654691..064d4f8 100644 --- a/worker/bbc.py +++ b/worker/bbc.py @@ -5,7 +5,7 @@ class Ans(StdAns): if len(self.parms) < 2: return '不加参数是坏文明!' try: - msg = str(bc(self.raw_msg['message'][5:])) + msg = str(bc(self.raw_msg['raw_message'][5:])) except Exception as e: msg = str(e) return msg diff --git a/worker/bing.py b/worker/bing.py index 0626aed..23fdd8f 100644 --- a/worker/bing.py +++ b/worker/bing.py @@ -10,7 +10,7 @@ class Ans(StdAns): url = 'https://api.cognitive.microsoft.com/bing/v7.0/search' params = { - 'q':self.raw_msg['message'][5:], + 'q':self.raw_msg['raw_message'][5:], 'count': 1, 'mkt': 'zh-CN' } diff --git a/worker/broadcast.py b/worker/broadcast.py index 3a993e5..87bbd8e 100644 --- a/worker/broadcast.py +++ b/worker/broadcast.py @@ -5,7 +5,7 @@ class Ans(StdAns): def GETMSG(self): groups = self.getgroups() - text = self.raw_msg['message'][11:] + text = self.raw_msg['raw_message'][11:] gid = self.gid for g in groups: diff --git a/worker/echo.py b/worker/echo.py index 4ac5437..859050a 100644 --- a/worker/echo.py +++ b/worker/echo.py @@ -6,14 +6,14 @@ class Ans(StdAns): if len(self.parms) < 2: return '不加参数是坏文明!' - if mysakuya(self,self.raw_msg['message']) == False: + if mysakuya(self,self.raw_msg['raw_message']) == False: return "不许你们说咲夜!!" r = random.randint(1,3) if r == 1: - msg = self.raw_msg['message'][6:] + msg = self.raw_msg['raw_message'][6:] elif r == 2: - msg = "汝以为咱会复读的嘛!\n(╯' - ')╯︵ ┻━┻\n" + self.raw_msg['message'][5:] + msg = "汝以为咱会复读的嘛!\n(╯' - ')╯︵ ┻━┻\n" + self.raw_msg['raw_message'][5:] elif r == 3: msg = '咱才不做复读机。→_→' return msg \ No newline at end of file diff --git a/worker/emmm.py b/worker/emmm.py index 614494f..3d94263 100644 --- a/worker/emmm.py +++ b/worker/emmm.py @@ -12,7 +12,7 @@ class Ans(StdAns): def GETMSG(self): if self.parms: - if mysakuya(self, self.raw_msg['message']) == False: + if mysakuya(self, self.raw_msg['raw_message']) == False: return "咲夜是最完美的!!" return '咱也不知道' + self.parms[0] + '是啥呢~' diff --git a/worker/hhsh.py b/worker/hhsh.py index 97df0ef..16af5c2 100644 --- a/worker/hhsh.py +++ b/worker/hhsh.py @@ -6,7 +6,7 @@ class Ans(StdAns): if len(self.parms) < 2: return '不加参数是坏文明!' - if mysakuya(self, self.raw_msg['message']) == False: + if mysakuya(self, self.raw_msg['raw_message']) == False: return "不许你们说咲夜!!" msg = f"[CQ:reply,id={self.raw_msg['message_id']}]" diff --git a/worker/mc.py b/worker/mc.py index 5a36c1a..92a847c 100644 --- a/worker/mc.py +++ b/worker/mc.py @@ -18,7 +18,7 @@ class Ans(StdAns): elif cmd == 'list': msg = getList() elif cmd == 'say': - saywhat = self.raw_msg['message'][8:] + saywhat = self.raw_msg['raw_message'][8:] msg = say(saywhat) else: msg = '汝是不是在mc后面添加了奇怪的参数,咱可只知道 status list 和 say。' diff --git a/worker/music.py b/worker/music.py index 6cb0b54..4119840 100644 --- a/worker/music.py +++ b/worker/music.py @@ -12,7 +12,7 @@ class Ans(StdAns): url = 'http://inuyasha.love:8001/search' params = { 'limit': 1, - 'keywords':self.raw_msg['message'][6:], + 'keywords':self.raw_msg['raw_message'][6:], } try: resp = requests.get(url=url,params=params).json() diff --git a/worker/ns.py b/worker/ns.py index 99e2764..44c3dc4 100644 --- a/worker/ns.py +++ b/worker/ns.py @@ -6,7 +6,7 @@ class Ans(StdAns): if len(self.parms) < 2: return '不加参数是坏文明!' - domain = self.raw_msg['message'][4:] + domain = self.raw_msg['raw_message'][4:] try: answer = check_output(['nslookup',domain],shell=False,timeout=4) msg = bytes.decode(answer) diff --git a/worker/pcr.py b/worker/pcr.py index d9a9d4d..dc1bd58 100644 --- a/worker/pcr.py +++ b/worker/pcr.py @@ -76,7 +76,7 @@ class Ans(StdAns): return '初始化完成!请使用\n /pcr 血量 xxxx \n 来设置第一周目第一个Boss的总血量。' if cmd == '登记': - nickname = self.raw_msg['message'][8:] + nickname = self.raw_msg['raw_message'][8:] if nickname: player = { 'id':nickname, diff --git a/worker/qymusic.py b/worker/qymusic.py index a616040..f22a38a 100644 --- a/worker/qymusic.py +++ b/worker/qymusic.py @@ -21,7 +21,7 @@ class Ans(StdAns): 'flag_qc': 0, 'p': 1, 'n': 20, - 'w':self.raw_msg['message'][8:], + 'w':self.raw_msg['raw_message'][8:], } try: resp = requests.get(url=url,params=params).text diff --git a/worker/run.py b/worker/run.py index 4fd1af6..ab41c91 100644 --- a/worker/run.py +++ b/worker/run.py @@ -54,7 +54,7 @@ class Ans(StdAns): ''' lang = self.parms[1] i = 6 + len(lang) - content = self.raw_msg['message'][i:] + content = self.raw_msg['raw_message'][i:] try : langconfig = LANGS[lang] name = langconfig['filename'] diff --git a/worker/talk.py b/worker/talk.py index 43e2580..ec0f305 100644 --- a/worker/talk.py +++ b/worker/talk.py @@ -9,7 +9,7 @@ class Ans(StdAns): if len(self.parms) < 2: text = "想让我说点什么呢?" else: - text = self.raw_msg['message'][5:] + text = self.raw_msg['raw_message'][5:] try: b = tts(text) diff --git a/worker/wait.py b/worker/wait.py index 3da9244..ab5eff4 100644 --- a/worker/wait.py +++ b/worker/wait.py @@ -13,10 +13,10 @@ class Ans(StdAns): return "There something wrong." video_url = f"https://media.trace.moe/video/{resp['anilist_id']}/{resp['filename']}?t={resp['at']}&token={resp['tokenthumb']}" - + video_url = video_url.replace("&","&").replace("[","[").replace("]","]").replace(",",",") m, s = divmod(float(resp['at']), 60) h, m = divmod(m, 60) - print("%02d:%02d:%02d" % (h, m, s)) + # print("%02d:%02d:%02d" % (h, m, s)) text = f"{resp['title_native']}\n{resp['title_chinese']}\nEP#{resp['episode']} {h:02.0f}:{m:02.0f}:{s:02.0f}\n{resp['similarity'][:5]} similarity" msg = f"[CQ:video,file={video_url}]\n{text}" diff --git a/worker/wolfram.py b/worker/wolfram.py index 9a0cdda..32769ce 100644 --- a/worker/wolfram.py +++ b/worker/wolfram.py @@ -13,7 +13,7 @@ class Ans(StdAns): return '不加参数是坏文明!' try: - res = wolframsearch(self.raw_msg['message'][9:]) + res = wolframsearch(self.raw_msg['raw_message'][9:]) msg = next(res.results).text except Exception as e: print(e) From f9335b08fe4030d054f562939da6a8e8b91bc43a Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 27 Jan 2021 11:44:13 +0800 Subject: [PATCH 199/240] fix wait --- worker/wait.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/wait.py b/worker/wait.py index ab5eff4..c0f997b 100644 --- a/worker/wait.py +++ b/worker/wait.py @@ -17,7 +17,7 @@ class Ans(StdAns): m, s = divmod(float(resp['at']), 60) h, m = divmod(m, 60) # print("%02d:%02d:%02d" % (h, m, s)) - text = f"{resp['title_native']}\n{resp['title_chinese']}\nEP#{resp['episode']} {h:02.0f}:{m:02.0f}:{s:02.0f}\n{resp['similarity'][:5]} similarity" + text = f"{resp['title_native']}\n{resp['title_chinese']}\nEP#{resp['episode']} {h:02.0f}:{m:02.0f}:{s:02.0f}\n{int(resp['similarity']*100)}% similarity" msg = f"[CQ:video,file={video_url}]\n{text}" return msg \ No newline at end of file From f5aebdbed599b45d88e23c27c41e4d6d752c979d Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 27 Jan 2021 11:57:06 +0800 Subject: [PATCH 200/240] fix wait --- worker/wait.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worker/wait.py b/worker/wait.py index c0f997b..73fbf81 100644 --- a/worker/wait.py +++ b/worker/wait.py @@ -19,5 +19,6 @@ class Ans(StdAns): # print("%02d:%02d:%02d" % (h, m, s)) text = f"{resp['title_native']}\n{resp['title_chinese']}\nEP#{resp['episode']} {h:02.0f}:{m:02.0f}:{s:02.0f}\n{int(resp['similarity']*100)}% similarity" - msg = f"[CQ:video,file={video_url}]\n{text}" + msg = f"[CQ:video,file={video_url}]" + self.sendmsg(text) return msg \ No newline at end of file From 2d81fdde168f2e317d6406cd9f13942907a03218 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 27 Jan 2021 12:12:20 +0800 Subject: [PATCH 201/240] update wait --- worker/wait.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/wait.py b/worker/wait.py index 73fbf81..fe2bda1 100644 --- a/worker/wait.py +++ b/worker/wait.py @@ -17,7 +17,7 @@ class Ans(StdAns): m, s = divmod(float(resp['at']), 60) h, m = divmod(m, 60) # print("%02d:%02d:%02d" % (h, m, s)) - text = f"{resp['title_native']}\n{resp['title_chinese']}\nEP#{resp['episode']} {h:02.0f}:{m:02.0f}:{s:02.0f}\n{int(resp['similarity']*100)}% similarity" + text = f"[CQ:reply,id={self.raw_msg['message_id']}]{resp['title_native']}\n{resp['title_chinese']}\nEP#{resp['episode']} {h:02.0f}:{m:02.0f}:{s:02.0f}\n{int(resp['similarity']*100)}% similarity" msg = f"[CQ:video,file={video_url}]" self.sendmsg(text) From 88766bc6a07088e374a7ed194f1bfdc39712e2b1 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 27 Jan 2021 14:42:24 +0800 Subject: [PATCH 202/240] update router --- route.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/route.py b/route.py index 06c8257..2f32226 100644 --- a/route.py +++ b/route.py @@ -6,7 +6,7 @@ def ZZRouter(data): gid = data['group_id'] role = data['sender']['role'] mid = data['message_id'] - parms = str.split(data['message'][0]['data']['text'][1:]) + parms = str.split(data['raw_message'][1:]) print(uid, gid, role, parms) if parms == []: parms[0] = 'help' From 5811fcfdc700348c5b7a014a563668b993d90994 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 27 Jan 2021 16:08:36 +0800 Subject: [PATCH 203/240] update req --- req.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/req.txt b/req.txt index df00370..d1d9b3e 100644 --- a/req.txt +++ b/req.txt @@ -6,6 +6,7 @@ chardet==3.0.4 Click==7.0 decorator==4.4.2 entrypoints==0.3 +feedparser==6.0.2 flake8==3.7.9 Flask==1.1.1 idna==2.9 @@ -39,6 +40,7 @@ python-dateutil==2.8.1 pyzmq==19.0.2 redis==3.4.1 requests==2.23.0 +sgmllib3k==1.0.0 six==1.14.0 sxtwl==1.1.0 toml==0.10.1 From b2b45e9ff603abe67e5e7dc38cfe371583bdffd1 Mon Sep 17 00:00:00 2001 From: weilinfox Date: Mon, 15 Feb 2021 18:25:31 +0800 Subject: [PATCH 204/240] fix run.py ssl error --- worker/run.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/run.py b/worker/run.py index 4fd1af6..e46855d 100644 --- a/worker/run.py +++ b/worker/run.py @@ -79,6 +79,6 @@ def glot(name, content, url): "content": content, }] } - resp = requests.post(url=url, headers=headers, json=data).json() + resp = requests.post(url=url, headers=headers, json=data, verify=False).json() r = f"stdout:\n{resp['stdout']}\nstderr:\n{resp['stderr']}\nerror:\n{resp['error']}" - return r \ No newline at end of file + return r From 55c44cf6067627639b7426a759084955373a27a1 Mon Sep 17 00:00:00 2001 From: SiHuan <49349784+sihuan@users.noreply.github.com> Date: Fri, 5 Mar 2021 12:28:59 +0800 Subject: [PATCH 205/240] Create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..dc82a49 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 SiHuan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 9320781dc38f0422f679a523822e5b0a6f37a467 Mon Sep 17 00:00:00 2001 From: Kontor Date: Wed, 10 Mar 2021 16:21:34 +0800 Subject: [PATCH 206/240] Update zhaoan.py --- worker/zhaoan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/zhaoan.py b/worker/zhaoan.py index 06da5d3..c8c0ecf 100644 --- a/worker/zhaoan.py +++ b/worker/zhaoan.py @@ -57,7 +57,7 @@ def calendar(): y = nowdate.year m = nowdate.month d = nowdate.day - zc = int(nowdate.strftime("%W")) - 1 + zc = int(nowdate.strftime("%W")) - 8 z = zmc[nowdate.weekday()] @@ -68,5 +68,5 @@ def calendar(): if lunarday.Lleap: lunardaychinese = "闰" + lunardaychinese - cal = f"{m}月{d}日,{lunardaychinese},寒假第{zc}周,星期{z}\n\n距离 2022 考研还有 {djs} 天" + cal = f"{m}月{d}日,{lunardaychinese},第{zc}教学周,星期{z}\n\n距离 2022 考研还有 {djs} 天" return cal From ea37514001968aeae016e5cfea858a8ec1ba8942 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 10 Mar 2021 16:43:30 +0800 Subject: [PATCH 207/240] fix zhaoan --- worker/zhaoan.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/worker/zhaoan.py b/worker/zhaoan.py index c8c0ecf..215228d 100644 --- a/worker/zhaoan.py +++ b/worker/zhaoan.py @@ -47,17 +47,23 @@ def getWeather(id='101120206'): def calendar(): + # 可选 教学、寒假、暑假 等 + NowStatus = "教学" + # 开始周次是今年的第几周 + StartWeek = 8 + # 今年考研开始日期 + KaoYanDate = datetime(2021, 12, 21) + ymc = ["冬", "腊", "正", "二", "三", "四", "五", "六", "七", "八", "九", "十"] rmc = ["初一", "初二", "初三", "初四", "初五", "初六", "初七", "初八", "初九", "初十", "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十", "廿一", "廿二", "廿三", "廿四", "廿五", "廿六", "廿七", "廿八", "廿九", "三十", "卅一"] zmc = ["一", "二", "三", "四", "五", "六", "天"] nowdate = datetime.now() - kaoyandate = datetime(2021,12,21) - djs = (kaoyandate - nowdate).days -1 + djs = (KaoYanDate - nowdate).days -1 y = nowdate.year m = nowdate.month d = nowdate.day - zc = int(nowdate.strftime("%W")) - 8 + zc = int(nowdate.strftime("%W")) - StartWeek z = zmc[nowdate.weekday()] @@ -68,5 +74,5 @@ def calendar(): if lunarday.Lleap: lunardaychinese = "闰" + lunardaychinese - cal = f"{m}月{d}日,{lunardaychinese},第{zc}教学周,星期{z}\n\n距离 2022 考研还有 {djs} 天" + cal = f"{m}月{d}日,{lunardaychinese},{NowStatus}第{zc}周,星期{z}\n\n距离 2022 考研还有 {djs} 天" return cal From 9c45984817d1c1369496ee10bb49c00feee40cab Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Wed, 14 Apr 2021 20:40:01 +0800 Subject: [PATCH 208/240] Add files via upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Arch Linux查包 --- worker/pkg.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 worker/pkg.py diff --git a/worker/pkg.py b/worker/pkg.py new file mode 100644 index 0000000..a523df2 --- /dev/null +++ b/worker/pkg.py @@ -0,0 +1,49 @@ +import requests + +from zzcore import StdAns + + +class Ans(StdAns): + #AllowGroup = [874769998,596678277,7343311] + + def GETMSG(self): + if len(self.parms) < 1: + msg = '请输入包名 如:/pkg linux' + return msg + elif self.parms[1] == 'help': + msg = '使用 /pkg 包名 查询Core, Extra, Testing, Multilib, Multilib-Testing, ' \ + 'Community, Community-Testing仓库的软件' + return msg + else: + req = requests.get( + url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json() + if req['results'] == []: + req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() + # print(req) + if req['resultcount'] > 0: + name = '包名:' + req['results'][0]['Name'] + # pkgname = req['results'][0]['pkgname'] + version = '版本:' + req['results'][0]['Version'] + description = '描述:' + req['results'][0]['Description'] + maintainer = '维护:' + req['results'][0]['Maintainer'] + numvotes = '投票:' + str(req['results'][0]['NumVotes']) + + url = req['results'][0]['URL'] + if url is None: + url = '链接:None' + else: + url = '链接:' + url + msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ + + '\n' + numvotes + '\n' + url + '\n' + return msg + else: + repo = req['results'][0]['repo'] + pkgname = req['results'][0]['pkgname'] + pkgver = req['results'][0]['pkgver'] + pkgdesc = req['results'][0]['pkgdesc'] + url = req['results'][0]['url'] + # return repo,pkgname,pkgver,pkgdesc,url + # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') + msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n' + return msg + From 786ebd0d47d225c12c337501831c54d30a938700 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Wed, 14 Apr 2021 20:41:56 +0800 Subject: [PATCH 209/240] Add files via upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 下载网易云音乐和舔狗日记 --- worker/song.py | 29 +++++++++++++++++++++++++++++ worker/tiangou.py | 20 ++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 worker/song.py create mode 100644 worker/tiangou.py diff --git a/worker/song.py b/worker/song.py new file mode 100644 index 0000000..02e4368 --- /dev/null +++ b/worker/song.py @@ -0,0 +1,29 @@ +from zzcore import StdAns +import requests +import urllib3 +urllib3.disable_warnings() + +class Ans(StdAns): + def GETMSG(self): + # self.parms[] + if len(self.parms) < 2: + return '不加参数是坏文明!' + url = 'https://music.xmengnet.cn/api' + + try: + # print(self.parms[1]) + getid = requests.get(url + '/search?keywords=' + self.raw_msg['raw_message'][5:], verify=False).json() + id = getid['result']['songs'][0]['id'] + # print(id) + downurl = requests.get(url + '/song/url?id=' + str(id), verify=False).json() + # print(downurl) + down = downurl['data'][0]['url'] + song = getid['result']['songs'][0]['name'] + '-' \ + + getid['result']['songs'][0]['artists'][0]['name'] + msg = f"[CQ:reply,id={self.raw_msg['message_id']}]" + return msg+song+'的下载地址为:'+down + # msg = f'[CQ:music,type=163,id={id}]' + except Exception as e: + print(e) + msg = '什么东西坏掉了,大概是网易云吧...不可能是咱!' + return msg diff --git a/worker/tiangou.py b/worker/tiangou.py new file mode 100644 index 0000000..06e2193 --- /dev/null +++ b/worker/tiangou.py @@ -0,0 +1,20 @@ +from zzcore import StdAns, mysakuya +import requests + +class Ans(StdAns): + #AllowGroup = [874769998,596678277] + def GETMSG(self): + msg = f"[CQ:reply,id={self.raw_msg['message_id']}]" + try: + msg += tiangou() + except: + msg += '可能是api坏掉了,可不是咱!' + return msg + +def tiangou(): + r = requests.get(url='https://api.muxiaoguo.cn/api/tiangourj').json() + # print(r) + msg = None + if r['msg'] == 'success': + msg = r['data']['comment'] + return msg From 8bc6072ff357045faf447d01cf724b909db35a47 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sat, 17 Apr 2021 13:13:22 +0800 Subject: [PATCH 210/240] Add files via upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加‘笑死’ --- worker/xs.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 worker/xs.py diff --git a/worker/xs.py b/worker/xs.py new file mode 100644 index 0000000..4830669 --- /dev/null +++ b/worker/xs.py @@ -0,0 +1,16 @@ +from zzcore import StdAns, mysakuya +import requests + +class Ans(StdAns): + def GETMSG(self): + msg='' + try: + msg += xs() + except: + msg += '可能是机器人笑死了!' + return msg + +def xs(): + url = "http://api-x.aya1.xyz:6/" + text = requests.get(url=url).text + return text From 5149940c043e172c1aac2ce4bcc401d7eabf6d0c Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sun, 18 Apr 2021 10:36:30 +0800 Subject: [PATCH 211/240] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Kemomimi=E5=9B=BE?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/k.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 worker/k.py diff --git a/worker/k.py b/worker/k.py new file mode 100644 index 0000000..4aac6e9 --- /dev/null +++ b/worker/k.py @@ -0,0 +1,38 @@ +from zzcore import StdAns +import requests +class Ans(StdAns): + def GETMSG(self): + try: + picurl,status=Kemomimi() + except: + print() + msg = '' + if status==200: + # 显示图标 + # msg += f'[CQ:xml,data=' \ + # f'' \ + # f'来喽!!' \ + # f'' \ + # f'' \ + # f']' + msg = f'[CQ:xml,data=\n' \ + f'\n' \ + f'ケモミミちゃん:Kemomimi酱来了~\n' \ + f' ' \ + f']' + # 显示卡片图片 + # msg += f'[CQ:cardimage,file={picurl},maxheight=200]' + else: + msg+='图库丢了哦,不是咱的问题呀!' + return msg + + +def Kemomimi(): + url="http://api.aya1.xyz:6/random.php" + # 获取重定向后的地址 + imgurl=requests.get(url).url + status = requests.get(url).status_code + # print(imgurl)\ + return imgurl,status From 3bbe82324602c68fa2a94ca88a498c0ee3c0e7b7 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 22 Apr 2021 21:57:47 +0800 Subject: [PATCH 212/240] update hhsh --- worker/hhsh.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/worker/hhsh.py b/worker/hhsh.py index 16af5c2..7fab908 100644 --- a/worker/hhsh.py +++ b/worker/hhsh.py @@ -11,7 +11,10 @@ class Ans(StdAns): msg = f"[CQ:reply,id={self.raw_msg['message_id']}]" r = nbnhhsh(self.parms[1]) - msg += f'''{(str(r['trans'])[1:-1]).replace("'","").replace(","," ")}''' + try: + msg += f'''{(str(r['trans'])[1:-1]).replace("'","").replace(","," ")}''' + except: + msg += "没查到(" return msg From db4a384097a19d9d843a0700f162087af5a9cfd0 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 6 May 2021 20:04:04 +0800 Subject: [PATCH 213/240] update lsp --- worker/lsp.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/worker/lsp.py b/worker/lsp.py index bd7b688..4269241 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -5,7 +5,7 @@ from config import LOLIKEYS class Ans(StdAns): - AllowGroup = [973510746, 805197917, 343700338, 125733077, 1084566280, + AllowGroup = [959613860,973510746, 805197917, 343700338, 125733077, 1084566280, 920863253, 798595664, 655057127, 196268763, 247022495, 474907856, 940333876] def GETMSG(self): @@ -33,7 +33,7 @@ class Ans(StdAns): msg += '咱没查到,也有可能是Pixiv坏掉惹' elif code == 0: if len(self.parms) < 2 or (len(self.parms) > 2 and self.parms[2] == 'p'): - msg += f'[CQ:image,file={picurl}]' + msg += f'[CQ:image,file={picurl},type=flash]' else: msg += f'[CQ:reply,id={self.mid}]咱帮你🔍{keyword}找到了这个\n{picurl}' @@ -57,6 +57,7 @@ def getsetu(apikey, keyword=''): try: resp = requests.get(url=url, params=params).json() + print(resp) except: return -1, -1, '' @@ -69,6 +70,7 @@ def getsetu(apikey, keyword=''): quota = resp['quota'] try: picurl = resp['data'][0]['url'] + picurl = "https://r.zjuyk.site/" + picurl code = 0 except: picurl = '' From bd46f9d21802e9df1b31e37a5a12015e42786803 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 6 May 2021 20:35:46 +0800 Subject: [PATCH 214/240] update lsp --- worker/lsp.py | 78 ++++++++++++--------------------------------------- 1 file changed, 18 insertions(+), 60 deletions(-) diff --git a/worker/lsp.py b/worker/lsp.py index 4269241..79bd340 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -1,83 +1,41 @@ from zzcore import StdAns, mysakuya import requests -from config import LOLIKEYS +from config import LOLIKEY class Ans(StdAns): - AllowGroup = [959613860,973510746, 805197917, 343700338, 125733077, 1084566280, + AllowGroup = [959613860, 973510746, 805197917, 343700338, 125733077, 1084566280, 920863253, 798595664, 655057127, 196268763, 247022495, 474907856, 940333876] def GETMSG(self): - - keys = LOLIKEYS - - try: - nowkey = int(self.DATAGET()['nowkey']) - except: - nowkey = 0 - - if len(self.parms) < 2: - keyword = '' + if len(self.parms) == 1: + code, picurl = getsetu() else: keyword = self.parms[1] if mysakuya(self, keyword) == False: return "不许你们看咲夜的涩图!!" - - code, quota, picurl = getsetu(keys[nowkey], keyword) - - msg = '' - if code == -1 or code == -2: - msg += f'>_< 天啦喽,loli 不见了 Code:{code}' - elif code == 3: - msg += '咱没查到,也有可能是Pixiv坏掉惹' - elif code == 0: - if len(self.parms) < 2 or (len(self.parms) > 2 and self.parms[2] == 'p'): - msg += f'[CQ:image,file={picurl},type=flash]' - else: - msg += f'[CQ:reply,id={self.mid}]咱帮你🔍{keyword}找到了这个\n{picurl}' - - if quota == 0: - nowkey = (nowkey+1) % (len(keys)) - if code == 429: - msg += f'>_< 已经没有 loli 啦,帮你换到了key{nowkey},再试一下吧' - else: - msg += f'额度用光了,下次将使用 key{nowkey}' - self.DATASET({'nowkey': nowkey}) - return msg + code, picurl = getsetu() + if code == 0: + return f'[CQ:reply,id={self.mid}][CQ:image,file={picurl},type=flash]' + else: + return f'[CQ:reply,id={self.mid}] 什么东西出错了,code:{code}' -def getsetu(apikey, keyword=''): +def getsetu(keyword=''): url = 'https://api.lolicon.app/setu/' params = { - 'apikey': apikey, + 'apikey': LOLIKEY, + 'keyword': keyword, } - if keyword != '': - params['keyword'] = keyword try: - resp = requests.get(url=url, params=params).json() - print(resp) + resp = requests.get(url=url, params=params, timeout=5).json() except: - return -1, -1, '' + return 500, '' - #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 = '' if resp['code'] == 0: - quota = resp['quota'] - try: - picurl = resp['data'][0]['url'] - picurl = "https://r.zjuyk.site/" + picurl - code = 0 - except: - picurl = '' - code = -3 - return code, quota, picurl - elif resp['code'] == 429: - return 429, 0, '' - else: - # print(resp['code']) - return -2, -1, '' + picurl = "https://r.zjuyk.site/" + resp['data'][0]['url'] + + return resp['code'], picurl From 348b418a92b88a551e3ddb761cab3bccddaa852d Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 6 May 2021 20:38:45 +0800 Subject: [PATCH 215/240] update lsp --- worker/lsp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/lsp.py b/worker/lsp.py index 79bd340..7cbaf61 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -15,7 +15,7 @@ class Ans(StdAns): keyword = self.parms[1] if mysakuya(self, keyword) == False: return "不许你们看咲夜的涩图!!" - code, picurl = getsetu() + code, picurl = getsetu(keyword) if code == 0: return f'[CQ:reply,id={self.mid}][CQ:image,file={picurl},type=flash]' else: From c8fa6ed313e35fc95cff6ff2d18ca9c0a181f255 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sat, 8 May 2021 19:27:03 +0800 Subject: [PATCH 216/240] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 69 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index a523df2..ffc664e 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -1,10 +1,10 @@ import requests - +import time from zzcore import StdAns class Ans(StdAns): - #AllowGroup = [874769998,596678277,7343311] + # AllowGroup = [874769998,596678277,7343311] def GETMSG(self): if len(self.parms) < 1: @@ -27,14 +27,16 @@ class Ans(StdAns): description = '描述:' + req['results'][0]['Description'] maintainer = '维护:' + req['results'][0]['Maintainer'] numvotes = '投票:' + str(req['results'][0]['NumVotes']) - + updatetime = req['results'][0]['LastModified'] + updatetime = time.localtime(int(updatetime)) + updatetime = time.strftime("%Y-%m-%d %H:%M:%S", updatetime) url = req['results'][0]['URL'] if url is None: url = '链接:None' else: url = '链接:' + url msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ - + '\n' + numvotes + '\n' + url + '\n' + + '\n' + numvotes + '\n更新日期' + updatetime[0:10] + '\n' + url + '\n' return msg else: repo = req['results'][0]['repo'] @@ -42,8 +44,65 @@ class Ans(StdAns): pkgver = req['results'][0]['pkgver'] pkgdesc = req['results'][0]['pkgdesc'] url = req['results'][0]['url'] + updatetime = req['results'][0]['last_update'] + updatetime = updatetime.replace('T', ' ') + updatetime = updatetime[0:16] # return repo,pkgname,pkgver,pkgdesc,url # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') - msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n' + msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n更新日期:' \ + + updatetime[0:10] + '\n' + '\n上游:' + url return msg +import requests +import time +from zzcore import StdAns + +class Ans(StdAns): + # AllowGroup = [874769998,596678277,7343311] + + def GETMSG(self): + if len(self.parms) < 1: + msg = '请输入包名 如:/pkg linux' + return msg + elif self.parms[1] == 'help': + msg = '使用 /pkg 包名 查询Core, Extra, Testing, Multilib, Multilib-Testing, ' \ + 'Community, Community-Testing仓库的软件' + return msg + else: + req = requests.get( + url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json() + if req['results'] == []: + req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() + # print(req) + if req['resultcount'] > 0: + name = '包名:' + req['results'][0]['Name'] + # pkgname = req['results'][0]['pkgname'] + version = '版本:' + req['results'][0]['Version'] + description = '描述:' + req['results'][0]['Description'] + maintainer = '维护:' + req['results'][0]['Maintainer'] + numvotes = '投票:' + str(req['results'][0]['NumVotes']) + updatetime = req['results'][0]['LastModified'] + updatetime = time.localtime(int(updatetime)) + updatetime = time.strftime("%Y-%m-%d %H:%M:%S", updatetime) + url = req['results'][0]['URL'] + if url is None: + url = '链接:None' + else: + url = '链接:' + url + msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ + + '\n' + numvotes + '\n更新日期:' + updatetime + '\n' + url + '\n' + return msg + else: + repo = req['results'][0]['repo'] + pkgname = req['results'][0]['pkgname'] + pkgver = req['results'][0]['pkgver'] + pkgdesc = req['results'][0]['pkgdesc'] + url = req['results'][0]['url'] + updatetime = req['results'][0]['last_update'] + updatetime = updatetime.replace('T', ' ') + updatetime = updatetime[0:16] + # return repo,pkgname,pkgver,pkgdesc,url + # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') + msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n更新日期:' \ + + updatetime[0:10] + '\n上游:' + url + return msg From 47ef41636fbb971fa3bb54343abfbc00750486f8 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sat, 8 May 2021 19:27:49 +0800 Subject: [PATCH 217/240] =?UTF-8?q?=E6=9F=A5=E8=AF=A2aur=E6=89=93=E5=8C=85?= =?UTF-8?q?=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/mner.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 worker/mner.py diff --git a/worker/mner.py b/worker/mner.py new file mode 100644 index 0000000..3f06d05 --- /dev/null +++ b/worker/mner.py @@ -0,0 +1,27 @@ +import requests + +from zzcore import StdAns + + +class Ans(StdAns): + def GETMSG(self): + if len(self.parms) < 2: + msg = '请输入包名 如:/mner yjun' + return msg + else: + msg = '' + req = requests.get( + url='https://aur.archlinux.org/rpc/?v=5&type=search&by=maintainer&arg=' + self.parms[1]).json() + count = req['resultcount'] + if count != 0: + msg += '工具人 ' + self.parms[1] + ' 打包了' + str(count) + '个软件\n' + soft='' + if count < 5: + # soft = list() + for i in range(count): + soft= req['results'][i]['Name'] + else: + for i in range(5): + soft+=req['results'][i]['Name']+'\n' + soft+='....' + return msg+soft From 949cc00d2a4d4e0d70b9dd441c50a8dd83799edf Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sat, 8 May 2021 21:54:26 +0800 Subject: [PATCH 218/240] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index ffc664e..6c5f389 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -72,14 +72,17 @@ class Ans(StdAns): req = requests.get( url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json() if req['results'] == []: - req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() + req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=info&arg=' + self.parms[1]).json() # print(req) if req['resultcount'] > 0: name = '包名:' + req['results'][0]['Name'] # pkgname = req['results'][0]['pkgname'] version = '版本:' + req['results'][0]['Version'] description = '描述:' + req['results'][0]['Description'] - maintainer = '维护:' + req['results'][0]['Maintainer'] + if req['results'][0]['Maintainer'] is None: + maintainer='' + else: + maintainer = '维护:' + req['results'][0]['Maintainer'] numvotes = '投票:' + str(req['results'][0]['NumVotes']) updatetime = req['results'][0]['LastModified'] updatetime = time.localtime(int(updatetime)) From 3ee7e80c609afee314f3d7328b7e0c769020e407 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sun, 9 May 2021 15:56:36 +0800 Subject: [PATCH 219/240] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/worker/pkg.py b/worker/pkg.py index 6c5f389..87047e4 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -73,6 +73,8 @@ class Ans(StdAns): url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json() if req['results'] == []: req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=info&arg=' + self.parms[1]).json() + if req['resultcount']==0: + req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() # print(req) if req['resultcount'] > 0: name = '包名:' + req['results'][0]['Name'] From a9c9845ddda6ceeba02eac50bca00beccaf6292f Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sat, 15 May 2021 15:17:54 +0800 Subject: [PATCH 220/240] =?UTF-8?q?=E5=8E=BB=E9=99=A4x86=E6=9E=B6=E6=9E=84?= =?UTF-8?q?=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 69 ++++----------------------------------------------- 1 file changed, 5 insertions(+), 64 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index 87047e4..93ca57c 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -16,7 +16,7 @@ class Ans(StdAns): return msg else: req = requests.get( - url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json() + url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] ).json() if req['results'] == []: req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() # print(req) @@ -41,73 +41,14 @@ class Ans(StdAns): else: repo = req['results'][0]['repo'] pkgname = req['results'][0]['pkgname'] - pkgver = req['results'][0]['pkgver'] + pkgver = req['results'][0]['pkgver']+'\n' pkgdesc = req['results'][0]['pkgdesc'] url = req['results'][0]['url'] updatetime = req['results'][0]['last_update'] updatetime = updatetime.replace('T', ' ') - updatetime = updatetime[0:16] + updatetime = updatetime[0:16]+'\n' # return repo,pkgname,pkgver,pkgdesc,url # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') - msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n更新日期:' \ - + updatetime[0:10] + '\n' + '\n上游:' + url - return msg -import requests -import time -from zzcore import StdAns - - -class Ans(StdAns): - # AllowGroup = [874769998,596678277,7343311] - - def GETMSG(self): - if len(self.parms) < 1: - msg = '请输入包名 如:/pkg linux' - return msg - elif self.parms[1] == 'help': - msg = '使用 /pkg 包名 查询Core, Extra, Testing, Multilib, Multilib-Testing, ' \ - 'Community, Community-Testing仓库的软件' - return msg - else: - req = requests.get( - url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json() - if req['results'] == []: - req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=info&arg=' + self.parms[1]).json() - if req['resultcount']==0: - req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() - # print(req) - if req['resultcount'] > 0: - name = '包名:' + req['results'][0]['Name'] - # pkgname = req['results'][0]['pkgname'] - version = '版本:' + req['results'][0]['Version'] - description = '描述:' + req['results'][0]['Description'] - if req['results'][0]['Maintainer'] is None: - maintainer='' - else: - maintainer = '维护:' + req['results'][0]['Maintainer'] - numvotes = '投票:' + str(req['results'][0]['NumVotes']) - updatetime = req['results'][0]['LastModified'] - updatetime = time.localtime(int(updatetime)) - updatetime = time.strftime("%Y-%m-%d %H:%M:%S", updatetime) - url = req['results'][0]['URL'] - if url is None: - url = '链接:None' - else: - url = '链接:' + url - msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ - + '\n' + numvotes + '\n更新日期:' + updatetime + '\n' + url + '\n' - return msg - else: - repo = req['results'][0]['repo'] - pkgname = req['results'][0]['pkgname'] - pkgver = req['results'][0]['pkgver'] - pkgdesc = req['results'][0]['pkgdesc'] - url = req['results'][0]['url'] - updatetime = req['results'][0]['last_update'] - updatetime = updatetime.replace('T', ' ') - updatetime = updatetime[0:16] - # return repo,pkgname,pkgver,pkgdesc,url - # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') - msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n更新日期:' \ - + updatetime[0:10] + '\n上游:' + url + msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '描述:' + pkgdesc + '\n更新日期:' \ + + updatetime[0:10] + '\n上游:' + url return msg From 4e5c765d06d065793e7c74a4d4f3c4838ae10d53 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sat, 15 May 2021 18:59:06 +0800 Subject: [PATCH 221/240] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index 93ca57c..6e800dc 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -18,14 +18,14 @@ class Ans(StdAns): req = requests.get( url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] ).json() if req['results'] == []: - req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() + req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=info&arg=' + self.parms[1]).json() # print(req) if req['resultcount'] > 0: name = '包名:' + req['results'][0]['Name'] # pkgname = req['results'][0]['pkgname'] version = '版本:' + req['results'][0]['Version'] description = '描述:' + req['results'][0]['Description'] - maintainer = '维护:' + req['results'][0]['Maintainer'] + maintainer = '维护:' + str(req['results'][0]['Maintainer']) numvotes = '投票:' + str(req['results'][0]['NumVotes']) updatetime = req['results'][0]['LastModified'] updatetime = time.localtime(int(updatetime)) From 39a76b799207e6e5e022306b0d0e1858573dc952 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Wed, 19 May 2021 18:05:30 +0800 Subject: [PATCH 222/240] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index 6e800dc..dae8c09 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -1,10 +1,10 @@ import requests -import time + from zzcore import StdAns class Ans(StdAns): - # AllowGroup = [874769998,596678277,7343311] + #AllowGroup = [874769998,596678277,7343311] def GETMSG(self): if len(self.parms) < 1: @@ -16,39 +16,36 @@ class Ans(StdAns): return msg else: req = requests.get( - url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] ).json() + url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json() if req['results'] == []: - req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=info&arg=' + self.parms[1]).json() + req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() + if req['resultcount'] == 0: + req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() # print(req) if req['resultcount'] > 0: name = '包名:' + req['results'][0]['Name'] # pkgname = req['results'][0]['pkgname'] version = '版本:' + req['results'][0]['Version'] description = '描述:' + req['results'][0]['Description'] - maintainer = '维护:' + str(req['results'][0]['Maintainer']) + maintainer = '维护:' + req['results'][0]['Maintainer'] numvotes = '投票:' + str(req['results'][0]['NumVotes']) - updatetime = req['results'][0]['LastModified'] - updatetime = time.localtime(int(updatetime)) - updatetime = time.strftime("%Y-%m-%d %H:%M:%S", updatetime) + url = req['results'][0]['URL'] if url is None: url = '链接:None' else: url = '链接:' + url msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ - + '\n' + numvotes + '\n更新日期' + updatetime[0:10] + '\n' + url + '\n' + + '\n' + numvotes + '\n' + url + '\n' return msg else: repo = req['results'][0]['repo'] pkgname = req['results'][0]['pkgname'] - pkgver = req['results'][0]['pkgver']+'\n' + pkgver = req['results'][0]['pkgver'] pkgdesc = req['results'][0]['pkgdesc'] url = req['results'][0]['url'] - updatetime = req['results'][0]['last_update'] - updatetime = updatetime.replace('T', ' ') - updatetime = updatetime[0:16]+'\n' # return repo,pkgname,pkgver,pkgdesc,url # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') - msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '描述:' + pkgdesc + '\n更新日期:' \ - + updatetime[0:10] + '\n上游:' + url + msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n' return msg + From da6307064c0da4e22de5fce57062881c0bcf9edd Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sat, 22 May 2021 10:43:26 +0800 Subject: [PATCH 223/240] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8B=A5=E5=B9=B2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index dae8c09..e4ce432 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -1,10 +1,10 @@ import requests - +import time from zzcore import StdAns class Ans(StdAns): - #AllowGroup = [874769998,596678277,7343311] + # AllowGroup = [874769998,596678277,7343311] def GETMSG(self): if len(self.parms) < 1: @@ -16,9 +16,9 @@ class Ans(StdAns): return msg else: req = requests.get( - url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json() + url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] ).json() if req['results'] == []: - req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() + req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=info&arg=' + self.parms[1]).json() if req['resultcount'] == 0: req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() # print(req) @@ -27,25 +27,30 @@ class Ans(StdAns): # pkgname = req['results'][0]['pkgname'] version = '版本:' + req['results'][0]['Version'] description = '描述:' + req['results'][0]['Description'] - maintainer = '维护:' + req['results'][0]['Maintainer'] + maintainer = '维护:' + str(req['results'][0]['Maintainer']) numvotes = '投票:' + str(req['results'][0]['NumVotes']) - + updatetime = req['results'][0]['LastModified'] + updatetime = time.localtime(int(updatetime)) + updatetime = time.strftime("%Y-%m-%d %H:%M:%S", updatetime) url = req['results'][0]['URL'] if url is None: url = '链接:None' else: url = '链接:' + url msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ - + '\n' + numvotes + '\n' + url + '\n' + + '\n' + numvotes + '\n更新日期' + updatetime[0:10] + '\n' + url return msg else: repo = req['results'][0]['repo'] pkgname = req['results'][0]['pkgname'] - pkgver = req['results'][0]['pkgver'] + pkgver = req['results'][0]['pkgver']+'\n' pkgdesc = req['results'][0]['pkgdesc'] url = req['results'][0]['url'] + updatetime = req['results'][0]['last_update'] + updatetime = updatetime.replace('T', ' ') + updatetime = updatetime[0:16]+'\n' # return repo,pkgname,pkgver,pkgdesc,url # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') - msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n' + msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '描述:' + pkgdesc + '\n更新日期:' \ + + updatetime[0:10] + '\n上游:' + url return msg - From 4712ce4e87f2638b06634dd02c1b996e15607860 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sun, 30 May 2021 12:46:25 +0800 Subject: [PATCH 224/240] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index e4ce432..df5fe2f 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -7,12 +7,12 @@ class Ans(StdAns): # AllowGroup = [874769998,596678277,7343311] def GETMSG(self): - if len(self.parms) < 1: + if len(self.parms) <= 1: msg = '请输入包名 如:/pkg linux' return msg - elif self.parms[1] == 'help': + elif self.parms[1] == 'help' : msg = '使用 /pkg 包名 查询Core, Extra, Testing, Multilib, Multilib-Testing, ' \ - 'Community, Community-Testing仓库的软件' + 'Community, Community-Testing仓库以及AUR的软件' return msg else: req = requests.get( @@ -38,7 +38,7 @@ class Ans(StdAns): else: url = '链接:' + url msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ - + '\n' + numvotes + '\n更新日期' + updatetime[0:10] + '\n' + url + + '\n' + numvotes + '\n更新日期:' + updatetime + '\n' + url return msg else: repo = req['results'][0]['repo'] @@ -52,5 +52,5 @@ class Ans(StdAns): # return repo,pkgname,pkgver,pkgdesc,url # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '描述:' + pkgdesc + '\n更新日期:' \ - + updatetime[0:10] + '\n上游:' + url + + updatetime + '上游:' + url return msg From 17f3365e6feeac6bcee6350c669302e0fa306679 Mon Sep 17 00:00:00 2001 From: xmengnet <794508986@qq.com> Date: Mon, 31 May 2021 20:41:09 +0800 Subject: [PATCH 225/240] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E4=BB=93=E5=BA=93=E8=BD=AF=E4=BB=B6=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index df5fe2f..4cca9ad 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -7,17 +7,23 @@ class Ans(StdAns): # AllowGroup = [874769998,596678277,7343311] def GETMSG(self): - if len(self.parms) <= 1: - msg = '请输入包名 如:/pkg linux' + if len(self.parms) < 2: + msg = '请输入包名 如:/pkg linux testing 查询 Testing 的 linux 软件' return msg - elif self.parms[1] == 'help' : + elif self.parms[1] == 'help': msg = '使用 /pkg 包名 查询Core, Extra, Testing, Multilib, Multilib-Testing, ' \ - 'Community, Community-Testing仓库以及AUR的软件' + 'Community, Community-Testing仓库以及AUR的软件 ' return msg else: + repo = str() + try: + if len(self.parms) > 1: + repo = '&repo=' + self.parms[2].capitalize() + except: + print('repo empty') req = requests.get( - url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] ).json() - if req['results'] == []: + url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + repo).json() + if not req['results']: req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=info&arg=' + self.parms[1]).json() if req['resultcount'] == 0: req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() @@ -38,19 +44,19 @@ class Ans(StdAns): else: url = '链接:' + url msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ - + '\n' + numvotes + '\n更新日期:' + updatetime + '\n' + url + + '\n' + numvotes + '\n更新日期:' + updatetime + '\n' + url return msg else: repo = req['results'][0]['repo'] pkgname = req['results'][0]['pkgname'] - pkgver = req['results'][0]['pkgver']+'\n' + pkgver = req['results'][0]['pkgver'] + '\n' pkgdesc = req['results'][0]['pkgdesc'] url = req['results'][0]['url'] updatetime = req['results'][0]['last_update'] updatetime = updatetime.replace('T', ' ') - updatetime = updatetime[0:16]+'\n' + updatetime = updatetime[0:16] + '\n' # return repo,pkgname,pkgver,pkgdesc,url # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '描述:' + pkgdesc + '\n更新日期:' \ - + updatetime + '上游:' + url + + updatetime + '上游:' + url return msg From b625b19c46ee4341861a46e565922e6c69cfe409 Mon Sep 17 00:00:00 2001 From: xmengnet <794508986@qq.com> Date: Mon, 7 Jun 2021 20:19:42 +0800 Subject: [PATCH 226/240] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/lsp.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/lsp.py b/worker/lsp.py index bd7b688..a3d5d38 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -5,8 +5,7 @@ from config import LOLIKEYS class Ans(StdAns): - AllowGroup = [973510746, 805197917, 343700338, 125733077, 1084566280, - 920863253, 798595664, 655057127, 196268763, 247022495, 474907856, 940333876] + AllowGroup = [874769998,596678277,794290657,204097403] def GETMSG(self): @@ -51,6 +50,7 @@ def getsetu(apikey, keyword=''): url = 'https://api.lolicon.app/setu/' params = { 'apikey': apikey, + 'r18': 0, } if keyword != '': params['keyword'] = keyword @@ -66,7 +66,7 @@ def getsetu(apikey, keyword=''): #h, m = divmod(m, 60) #quota_min_ttl = f'{h}时{m}分{s}秒' if resp['code'] == 0: - quota = resp['quota'] + quota = resp['count'] try: picurl = resp['data'][0]['url'] code = 0 From ef5587b2e21cc1adb87f7a00892c7743cfad2ad5 Mon Sep 17 00:00:00 2001 From: xmengnet <794508986@qq.com> Date: Fri, 11 Jun 2021 09:06:40 +0800 Subject: [PATCH 227/240] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=EF=BC=8C=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/k.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/worker/k.py b/worker/k.py index 4aac6e9..eb0e9c1 100644 --- a/worker/k.py +++ b/worker/k.py @@ -1,13 +1,15 @@ from zzcore import StdAns import requests + + class Ans(StdAns): def GETMSG(self): try: - picurl,status=Kemomimi() + picurl, status = Kemomimi() except: print() msg = '' - if status==200: + if status == 200: # 显示图标 # msg += f'[CQ:xml,data=' \ # f'' \ @@ -25,14 +27,14 @@ class Ans(StdAns): # 显示卡片图片 # msg += f'[CQ:cardimage,file={picurl},maxheight=200]' else: - msg+='图库丢了哦,不是咱的问题呀!' + msg += '图库丢了哦,不是咱的问题呀!' return msg def Kemomimi(): - url="http://api.aya1.xyz:6/random.php" + url = "http://api.aya1.xyz:6/random0.php" # 获取重定向后的地址 - imgurl=requests.get(url).url + imgurl = requests.get(url).url status = requests.get(url).status_code # print(imgurl)\ - return imgurl,status + return imgurl, status From e4ea401949cf7b07af41e3aaae711e06dc58de7a Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 14 Jun 2021 13:35:00 +0800 Subject: [PATCH 228/240] lsp add arch qq --- worker/lsp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worker/lsp.py b/worker/lsp.py index 7cbaf61..a45da73 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -6,7 +6,8 @@ from config import LOLIKEY class Ans(StdAns): AllowGroup = [959613860, 973510746, 805197917, 343700338, 125733077, 1084566280, - 920863253, 798595664, 655057127, 196268763, 247022495, 474907856, 940333876] + 920863253, 798595664, 655057127, 196268763, 247022495, 474907856, 940333876, + 204097403] def GETMSG(self): if len(self.parms) == 1: From aacf0cde91222a45b1111511e07368c590168a22 Mon Sep 17 00:00:00 2001 From: xmengnet <794508986@qq.com> Date: Mon, 14 Jun 2021 13:50:03 +0800 Subject: [PATCH 229/240] =?UTF-8?q?=E5=B0=86=E5=9B=BE=E7=89=87=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=B8=BA=E9=97=AA=E7=85=A7=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/lsp.py | 76 ++++++++++++--------------------------------------- 1 file changed, 18 insertions(+), 58 deletions(-) diff --git a/worker/lsp.py b/worker/lsp.py index a3d5d38..5cbba8f 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -5,77 +5,37 @@ from config import LOLIKEYS class Ans(StdAns): - AllowGroup = [874769998,596678277,794290657,204097403] + AllowGroup = [874769998, 596678277, 794290657, 204097403] def GETMSG(self): - - keys = LOLIKEYS - - try: - nowkey = int(self.DATAGET()['nowkey']) - except: - nowkey = 0 - - if len(self.parms) < 2: - keyword = '' + if len(self.parms) == 1: + code, picurl = getsetu() else: keyword = self.parms[1] if mysakuya(self, keyword) == False: return "不许你们看咲夜的涩图!!" - - code, quota, picurl = getsetu(keys[nowkey], keyword) - - msg = '' - if code == -1 or code == -2: - msg += f'>_< 天啦喽,loli 不见了 Code:{code}' - elif code == 3: - msg += '咱没查到,也有可能是Pixiv坏掉惹' - elif code == 0: - if len(self.parms) < 2 or (len(self.parms) > 2 and self.parms[2] == 'p'): - msg += f'[CQ:image,file={picurl}]' - else: - msg += f'[CQ:reply,id={self.mid}]咱帮你🔍{keyword}找到了这个\n{picurl}' - - if quota == 0: - nowkey = (nowkey+1) % (len(keys)) - if code == 429: - msg += f'>_< 已经没有 loli 啦,帮你换到了key{nowkey},再试一下吧' - else: - msg += f'额度用光了,下次将使用 key{nowkey}' - self.DATASET({'nowkey': nowkey}) - return msg + code, picurl = getsetu(keyword) + if code == 0: + return f'[CQ:reply,id={self.mid}][CQ:image,file={picurl},type=flash]' + else: + return f'[CQ:reply,id={self.mid}] 什么东西出错了,code:{code}' -def getsetu(apikey, keyword=''): +def getsetu(keyword=''): url = 'https://api.lolicon.app/setu/' params = { - 'apikey': apikey, - 'r18': 0, + 'apikey': LOLIKEYS, + 'keyword': keyword, + 'r18': 0 } - if keyword != '': - params['keyword'] = keyword try: - resp = requests.get(url=url, params=params).json() + resp = requests.get(url=url, params=params, timeout=5).json() except: - return -1, -1, '' + return 500, '' - #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 = '' if resp['code'] == 0: - quota = resp['count'] - try: - picurl = resp['data'][0]['url'] - code = 0 - except: - picurl = '' - code = -3 - return code, quota, picurl - elif resp['code'] == 429: - return 429, 0, '' - else: - # print(resp['code']) - return -2, -1, '' + picurl = "https://r.zjuyk.site/" + resp['data'][0]['url'] + + return resp['code'], picurl From a1c7471816209d5b4217c6460649a901600b4c92 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 9 Jul 2021 20:53:34 +0800 Subject: [PATCH 230/240] update README --- README.md | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a1743cb..91a16f9 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,36 @@ # XZZ -小智障,一个拓展 CoolQ HttpApi,快速构建命令式 QQ 机器人的框架. +小智障,一个拓展 go-cqhttp ,快速构建命令式 QQ 机器人的框架. ## 如何使用 +> 阅读完以下内容后可以参考我的 blog -> [部署一个自己的智障机器人](https://blog.sakuya.love/archives/xzz/) +> 其中 go-cqhttp 配置文件部分格式可能有点过时,但是不影响理解🙈 + ### 安装配置 -#### 0.自己安装配置好 CoolQ 及其 HttpApi 插件. +#### 0.自己安装配置好 go-cqhttp. -包括上报过滤! +`XZZ` 需要的配置有 + +- 相对应的上报地址与 `go-cqhttp` api 地址 +- 上报消息类型为 `array` +- 上报消息过滤为以下条件 + +```json +{ + "message_type": "group", + "raw_message":{ + ".regex":"^\/" + }, + "user_id":{ + ".neq": 80000000 + } +} +``` #### 1.clone 本仓库, 填写 `config.py` -其中 `APIURL` 为 CoolQ HttpApi 的 URL, `AUTHORIZATION` 为 CoolQ HttpApi 的 `access_token`, `PORT` 和 CoolQ HttpApi `post_url` 中的端口保持一致. +其中 `APIURL` 为 go-cqhttp 的 api 地址, `AUTHORIZATION` 为 go-cqhttp 的 `access_token`, `PORT` 和 go-cqhttp 反向 http post 设置的端口保持一致. #### 2.安装依赖, 启动服务 @@ -21,7 +40,6 @@ python main.py ``` - ### 拓展功能 在 `worker` 文件夹中添加 python 模块.文件名即受该文件响应的命令. From c416dffbf641dc6be5373cbb2a74809f6ec8ca10 Mon Sep 17 00:00:00 2001 From: weilinfox Date: Wed, 28 Jul 2021 11:05:23 +0800 Subject: [PATCH 231/240] =?UTF-8?q?change=20worker/zhaoan.py=20from=20?= =?UTF-8?q?=E6=95=99=E5=AD=A6=20to=20=E6=9A=91=E5=81=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/zhaoan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/zhaoan.py b/worker/zhaoan.py index 215228d..5b5d1d1 100644 --- a/worker/zhaoan.py +++ b/worker/zhaoan.py @@ -48,9 +48,9 @@ def getWeather(id='101120206'): def calendar(): # 可选 教学、寒假、暑假 等 - NowStatus = "教学" + NowStatus = "暑假" # 开始周次是今年的第几周 - StartWeek = 8 + StartWeek = 28 # 今年考研开始日期 KaoYanDate = datetime(2021, 12, 21) From baa3dd8df9e40b38a9160a87d21d7a39e7b0d204 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 8 Aug 2021 17:20:28 +0800 Subject: [PATCH 232/240] lsp guiwang --- worker/lsp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/lsp.py b/worker/lsp.py index a45da73..4dd23e9 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -7,7 +7,7 @@ from config import LOLIKEY class Ans(StdAns): AllowGroup = [959613860, 973510746, 805197917, 343700338, 125733077, 1084566280, 920863253, 798595664, 655057127, 196268763, 247022495, 474907856, 940333876, - 204097403] + 204097403,138966354] def GETMSG(self): if len(self.parms) == 1: From d941f32194f096c145adb728c7190258eaa5a843 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 11 Aug 2021 22:45:47 +0800 Subject: [PATCH 233/240] genshin zaoan --- worker/zhaoan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/zhaoan.py b/worker/zhaoan.py index 5b5d1d1..1a3eb5e 100644 --- a/worker/zhaoan.py +++ b/worker/zhaoan.py @@ -9,8 +9,8 @@ class Ans(StdAns): def GETMSG(self): msg = f'早上好,今天是{calendar()}\n\n' msg += getWeather() + '\n\n' - t = requests.get('https://v1.hitokoto.cn/?c=k&encode=text').text - # t = ("预祝大家四六级考试顺利。") + # t = requests.get('https://v1.hitokoto.cn/?c=k&encode=text').text + t =("只要不失去你的崇高,整个世界都会向你敞开") msg += t return msg From 643f2545ba1bc753e6bf28edfdd1e11c2433b5c7 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 12 Aug 2021 19:01:29 +0800 Subject: [PATCH 234/240] update --- worker/lsp.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/worker/lsp.py b/worker/lsp.py index 4dd23e9..1c4f06a 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -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'] From 8057283a8aad8e060bd989de326e5db6e0e718d3 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 12 Aug 2021 19:03:30 +0800 Subject: [PATCH 235/240] update --- worker/lsp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worker/lsp.py b/worker/lsp.py index 1c4f06a..9449e69 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -24,7 +24,8 @@ class Ans(StdAns): return "不许你们看咲夜的涩图!!" code, picurl, pid = getsetu(keyword) if code == 0: - return f'[CQ:image,file={picurl}{flash}]Pixiv ID:{pid}' + self.sendmsg(f'[CQ:reply,id={self.mid}]Pixiv ID:{pid}') + return f'[CQ:image,file={picurl}{flash}]' else: return f'[CQ:reply,id={self.mid}] 什么东西出错了,code:{code}' From 1985d84fcd0e932cc1b9c3cd750fa5d70f9e3953 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 12 Aug 2021 19:11:13 +0800 Subject: [PATCH 236/240] update --- worker/lsp.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/worker/lsp.py b/worker/lsp.py index 9449e69..373ceca 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -42,8 +42,11 @@ def getsetu(keyword=''): except: return 500, '',0 + picurl = '' + pid = 0 if resp['code'] == 0: picurl = "https://r.zjuyk.site/" + resp['data'][0]['url'] + pid = resp['data'][0]['pid'] - return resp['code'], picurl, resp['data'][0]['pid'] + return resp['code'], picurl, pid From b7b0c8c37c7406af35599f721a0da1c2ea46171c Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 12 Aug 2021 19:19:03 +0800 Subject: [PATCH 237/240] update --- sample_config.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sample_config.py b/sample_config.py index 5bd18c1..50bc2d2 100644 --- a/sample_config.py +++ b/sample_config.py @@ -1,3 +1,6 @@ +from config import BINGKEY + + ALLWORKERS = ['ping','yiyan','mc',] APIURL = 'http://127.0.0.1:5700/' @@ -8,4 +11,6 @@ HOST = '0.0.0.0' PORT = 5580 -REMOTE_MC_URL = '' \ No newline at end of file +REMOTE_MC_URL = '' + +BINGKEY = '' \ No newline at end of file From 56f306c82b8650811d22e8bc6e5d0072fbbb9b08 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Wed, 18 Aug 2021 18:06:31 +0800 Subject: [PATCH 238/240] Update pkg.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加aur包过期提示,优化部分代码 --- worker/pkg.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index 4cca9ad..1dabb71 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -21,12 +21,20 @@ class Ans(StdAns): repo = '&repo=' + self.parms[2].capitalize() except: print('repo empty') + + def timeTrans(value): + temp = time.localtime(int(value)) + timeValue = time.strftime("%Y-%m-%d %H:%M:%S", temp) + return timeValue[:16] + req = requests.get( url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + repo).json() if not req['results']: - req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=info&arg=' + self.parms[1]).json() + req = requests.get( + url='https://aur.tuna.tsinghua.edu.cn/rpc/?v=5&type=info&arg=' + self.parms[1]).json() if req['resultcount'] == 0: - req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() + req = requests.get( + url='https://aur.tuna.tsinghua.edu.cn/rpc/?v=5&type=search&arg=' + self.parms[1]).json() # print(req) if req['resultcount'] > 0: name = '包名:' + req['results'][0]['Name'] @@ -35,16 +43,18 @@ class Ans(StdAns): description = '描述:' + req['results'][0]['Description'] maintainer = '维护:' + str(req['results'][0]['Maintainer']) numvotes = '投票:' + str(req['results'][0]['NumVotes']) - updatetime = req['results'][0]['LastModified'] - updatetime = time.localtime(int(updatetime)) - updatetime = time.strftime("%Y-%m-%d %H:%M:%S", updatetime) + updatetime = '更新日期:' + timeTrans(req['results'][0]['LastModified']) + outofdate = req['results'][0]['OutOfDate'] + if outofdate is not None: + outofdate=timeTrans(outofdate) + updatetime = updatetime + '\n过期日期:' + outofdate url = req['results'][0]['URL'] if url is None: url = '链接:None' else: url = '链接:' + url msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ - + '\n' + numvotes + '\n更新日期:' + updatetime + '\n' + url + + '\n' + numvotes + '\n' + updatetime + '\n' + url return msg else: repo = req['results'][0]['repo'] From 662bd0c65cf7660c7c4a001a100424a9edd50acb Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 25 Aug 2021 21:34:03 +0800 Subject: [PATCH 239/240] no lsp --- worker/lsp.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/worker/lsp.py b/worker/lsp.py index 373ceca..2c80902 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -5,9 +5,7 @@ from config import LOLIKEY class Ans(StdAns): - AllowGroup = [959613860, 973510746, 805197917, 343700338, 125733077, 1084566280, - 920863253, 798595664, 655057127, 196268763, 247022495, 474907856, 940333876, - 204097403,138966354] + AllowGroup = [959613860, 125733077] def GETMSG(self): if self.parms[-1] == 'p': From 474bbe65ba3f5429e9f23173e163d70f62832566 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sat, 4 Sep 2021 21:58:54 +0800 Subject: [PATCH 240/240] update zaoan --- worker/zhaoan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/zhaoan.py b/worker/zhaoan.py index 1a3eb5e..3a94eb2 100644 --- a/worker/zhaoan.py +++ b/worker/zhaoan.py @@ -52,7 +52,7 @@ def calendar(): # 开始周次是今年的第几周 StartWeek = 28 # 今年考研开始日期 - KaoYanDate = datetime(2021, 12, 21) + KaoYanDate = datetime(2021, 12, 25) ymc = ["冬", "腊", "正", "二", "三", "四", "五", "六", "七", "八", "九", "十"] rmc = ["初一", "初二", "初三", "初四", "初五", "初六", "初七", "初八", "初九", "初十", "十一", "十二", "十三", "十四", "十五",