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 1/7] =?UTF-8?q?=E6=8A=BD=E5=8D=A1@=E4=BA=BA=EF=BC=8Cclass?= =?UTF-8?q?=E5=86=85=E5=8A=A0=E5=85=A5=E6=98=B5=E7=A7=B0=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=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 2/7] 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 3/7] 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 4/7] =?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 5/7] 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 6/7] =?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 7/7] =?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]'