From eb1053dc897569bc8e29ff52cd954f04fc2bb40e Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 3 Aug 2020 22:10:17 +0800 Subject: [PATCH 01/36] =?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 fd29e8808f61657ab7511538532298e57277a6bb Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 3 Aug 2020 22:20:12 +0800 Subject: [PATCH 02/36] 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 8cd2f32624bb5dd3effbd9f212cbc559efc19195 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 3 Aug 2020 23:17:56 +0800 Subject: [PATCH 03/36] =?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 6e00c8a33269970c8372a2f6efe5d4d644e5505e Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 3 Aug 2020 23:20:13 +0800 Subject: [PATCH 04/36] =?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 24634a583433f33f4a0beb98e8b130db6991a15d Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 4 Aug 2020 13:33:07 +0800 Subject: [PATCH 05/36] 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 7f347089dbc32873c5211499b79442249f3007c1 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 4 Aug 2020 13:42:26 +0800 Subject: [PATCH 06/36] 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 9b261594410e8f7b149087204cbc0d4dda03d838 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 4 Aug 2020 13:45:15 +0800 Subject: [PATCH 07/36] 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 2e31ec2cb12472cabcc6b8bacbb2a0ffb7f9347b Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 4 Aug 2020 21:42:24 +0800 Subject: [PATCH 08/36] 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 b658029c8433900bbd101b65e026e9c552176c95 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 4 Aug 2020 21:48:48 +0800 Subject: [PATCH 09/36] 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 c05b6f557f643fc6b50b7766675c5ebbd5e8d988 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 4 Aug 2020 22:00:28 +0800 Subject: [PATCH 10/36] 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 6b691a6dfad203ff961ae8fa971286e404fb311e Mon Sep 17 00:00:00 2001 From: DD6181S03 Date: Wed, 5 Aug 2020 21:03:48 +0800 Subject: [PATCH 11/36] 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>e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0ALvFjiQHLl@$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 12/36] 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 b89fef264e2e688ec291adcf5deb726153193c02 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 11 Aug 2020 10:24:28 +0800 Subject: [PATCH 13/36] =?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 3eb183e11e5f9a51c063ba2370e7dbd199bdf29c Mon Sep 17 00:00:00 2001 From: SiHuan Date: Tue, 11 Aug 2020 22:52:59 +0800 Subject: [PATCH 14/36] =?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 5e776f5fbe3670b934de9d323d0df9be38adbc5e Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 12 Aug 2020 11:04:27 +0800 Subject: [PATCH 15/36] 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 7f3ac12e8105d434b6fcbf1a6f9cdb4504a82f9d Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 12 Aug 2020 19:31:57 +0800 Subject: [PATCH 16/36] 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 7b8153dfbc1d6367a524790d609d8d5eb9718b33 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Wed, 12 Aug 2020 19:33:15 +0800 Subject: [PATCH 17/36] 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 530dcf5d21fbb1f59d99ecc90d1e89e69948e140 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 18/36] =?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 a032db97cd2c1c2be2b3f5825a8443499c095456 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 19/36] =?UTF-8?q?=E4=BF=AE=E6=94=B9char=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=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 e4a6ef6dd8235fed0ac33d4716da6d750d501de6 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 20/36] =?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 9525736cf54a71971d5b9c2609a05a50177b7dbe 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 21/36] =?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 3b03b7b997bb5e964ab075fb0126c9ecd72450e7 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 22/36] =?UTF-8?q?=E6=8A=BD=E5=8D=A1@=E4=BA=BA=EF=BC=8Cclas?= =?UTF-8?q?s=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 ead17a421850e2fa01a9491c2ad16939821e8f87 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 23/36] 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 a687c79fb39bc1593c953ddd5c7b71b10e84daa1 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 24/36] 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 67c192455423906f6643782eaf705a8faeeb2e62 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 25/36] =?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 bbe6465cca8b93dcb5aeb09d39e1801b20bccd24 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 26/36] 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 dac22968cd6d066a9fcfe08e58e60313d2e46636 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 27/36] =?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 3696e6cad434c6ee606a234da3874ef4e7133c3d 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 28/36] =?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 1a861d363257cf9abb5f46dce9d177de7ae33095 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 16 Aug 2020 23:08:22 +0800 Subject: [PATCH 29/36] 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 ae1e6af42e365e246d288904987f209e1617dbe2 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 16 Aug 2020 23:11:22 +0800 Subject: [PATCH 30/36] 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 ca50071fb5f061639a88e95069ce0a2fb90afc35 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 17 Aug 2020 10:40:46 +0800 Subject: [PATCH 31/36] 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 1c9d1374127979d26db4064ead0fc5ab453b73cd 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 32/36] =?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 53fc668e4aeef6fc948c36c0c2a38a087565c351 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 33/36] 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 a214b1d9535f95f857795653e08ef78b4edfa0df 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 34/36] .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 ad42adbff02c8440d2fe55197699092de78d1db7 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 35/36] 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 c071e41124c9d5caba4ade40c79ac9d1adcd7cf6 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Thu, 20 Aug 2020 18:57:31 +0800 Subject: [PATCH 36/36] 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