bug fix : missing rejoincount of new player

This commit is contained in:
imayushsaini 2021-11-26 21:35:30 +05:30
parent ff929c3474
commit 9d9ffe5e42
2 changed files with 14 additions and 4 deletions

View file

@ -16,21 +16,26 @@ def filter(msg,pb_id,client_id):
now = time.time()
if "lastMsg" in serverdata.clients[pb_id]:
if "lastMsgTime" in serverdata.clients[pb_id]:
count=serverdata.clients[pb_id]["cMsgCount"]
if now - serverdata.clients[pb_id]["lastMsg"] < 5:
if now - serverdata.clients[pb_id]["lastMsgTime"] < 5:
count+=1
if count >=2:
addWarn(pb_id,client_id)
count =0
else if now - serverdata.clients[pb_id]["lastMsgTime"] < 30:
if serverdata.clients[pb_id]["lastMsg"]==msg:
addWarn(pb_id,client_id)
else:
count =0
serverdata.clients[pb_id]['cMsgCount']=count
serverdata.clients[pb_id]['lastMsg']=now
serverdata.clients[pb_id]['lastMsgTime']=now
serverdata.clients[pb_id]['lastMsg']=msg
else:
serverdata.clients[pb_id]['cMsgCount']=0
serverdata.clients[pb_id]['lastMsg']=now
serverdata.clients[pb_id]['lastMsgTime']=now
serverdata.clients[pb_id]['lastMsg']=msg
return new_msg

View file

@ -52,6 +52,11 @@ def add_profile(id,display_string,currentname,age):
f=open(data_path+"profiles.json","w")
json.dump(profiles,f,indent=4)
serverdata.clients[id]=profiles[id]
serverdata.clients[id]["warnCount"]=0
serverdata.clients[id]["lastWarned"]=time.time()
serverdata.clients[id]["verified"]=False
serverdata.clients[id]["rejoincount"]=1
serverdata.clients[id]["lastJoin"]=time.time()
f.close()
def update_displayString(id,display_string):