diff options
Diffstat (limited to 'main.py')
-rw-r--r-- | main.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/main.py b/main.py index 48cdb1c..15be7a4 100644 --- a/main.py +++ b/main.py @@ -112,13 +112,13 @@ class util: del data["profile"] return data - def authorize(username, conn_id, websocket, client): + def authorize(username, conn_id, websocket, client, bot): # TODO: statuses if client: if not re.fullmatch("[a-zA-Z0-9-_. ]{1,50}", client): client = "" - ulist[username] = {"client": client, "status": ""} - client_data[conn_id] = {"username": username, "client": client, "websocket": websocket, "connected": round(time.time())} + ulist[username] = {"client": client, "status": "", "bot": bot} + client_data[conn_id] = {"username": username, "client": client, "websocket": websocket, "connected": round(time.time()), "bot": bot} data = db.acc.get(username) del data["secure"] return data @@ -256,7 +256,7 @@ async def handler(websocket): continue valid = db.acc.verify_pswd(r["username"], r["password"]) if type(valid) == dict: - userdata = util.authorize(r["username"], str(websocket.id), websocket, r.get("client")) + userdata = util.authorize(r["username"], str(websocket.id), websocket, r.get("client"), valid["bot"]) await websocket.send(json.dumps({"error": False, "token": valid["token"], "user": userdata, "listener": listener})) util.ulist() continue @@ -283,7 +283,7 @@ async def handler(websocket): await websocket.send(util.error("banned", listener, db.acc.get_ban(valid["username"]))) continue else: - userdata = util.authorize(valid["username"], str(websocket.id), websocket, r.get("client")) + userdata = util.authorize(valid["username"], str(websocket.id), websocket, r.get("client"), valid["bot"]) await websocket.send(json.dumps({"error": False, "user": userdata, "listener": listener})) util.ulist() continue |