抽卡@人,class内加入昵称属性。

This commit is contained in:
2920233418@qq.com 2020-08-16 18:50:48 +08:00
parent 9525736cf5
commit 3b03b7b997
4 changed files with 8 additions and 5 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@ env
__pycache__ __pycache__
.vscode .vscode
config.py config.py
.idea

View file

@ -9,7 +9,8 @@ def ZZRouter(data):
gid = data['group_id'] gid = data['group_id']
role = data['sender']['role'] role = data['sender']['role']
parms = str.split(data['message'][1:]) parms = str.split(data['message'][1:])
print(uid, gid, role, parms) nickname = data['sender']['nickname']
print(uid, gid, role, parms, nickname)
if parms == []: if parms == []:
parms[0] = 'help' parms[0] = 'help'
worker = parms[0] worker = parms[0]
@ -20,7 +21,7 @@ def ZZRouter(data):
except: except:
Ans_ = emmm.Ans Ans_ = emmm.Ans
Ans = Ans_(parms, uid, gid, role, data) Ans = Ans_(parms, uid, gid, role, data, nickname)
Message = Ans.CheckPermission() Message = Ans.CheckPermission()
if Message == 0: if Message == 0:
Message = Ans.GETMSG() Message = Ans.GETMSG()

View file

@ -320,7 +320,7 @@ class Ans(StdAns):
resultStar.append(2) resultStar.append(2)
resultName.append(choice(star2)) resultName.append(choice(star2))
stones = 0 stones = 0
colors = '' colors = '@{}\n'.format(self.nickname)
for each in range(len(resultStar)): for each in range(len(resultStar)):
if resultStar[each] == 3: if resultStar[each] == 3:
stones = stones + 50 stones = stones + 50

View file

@ -12,12 +12,13 @@ class StdAns():
UserNotAllow = '汝不被允许呢.' UserNotAllow = '汝不被允许呢.'
RoleNotAllow = '汝的角色不被允许哦.' RoleNotAllow = '汝的角色不被允许哦.'
def __init__(self,parms,uid,gid,role,raw_msg): def __init__(self,parms,uid,gid,role,raw_msg,nickname):
self.parms = parms self.parms = parms
self.uid = uid self.uid = uid
self.gid = gid self.gid = gid
self.role = role self.role = role
self.raw_msg = raw_msg self.raw_msg = raw_msg
self.nickname = nickname
def DATAGET(self): def DATAGET(self):
return r.hgetall(self.parms[0]) return r.hgetall(self.parms[0])