From 24adab1e1964ad58a0bbc75163667cba3b569663 Mon Sep 17 00:00:00 2001 From: Anastasia Viktorova Date: Tue, 22 Aug 2023 16:37:51 +0300 Subject: [PATCH] kill by userID --- app.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 3db457c..739a77c 100644 --- a/app.py +++ b/app.py @@ -49,12 +49,14 @@ def action(): # put application's code here cur = db.cursor if killedUserID != healedUserID: - cur.execute(f"UPDATE Users SET isAlive = false WHERE TrueUserID = '{killedUserID}'") + cur.execute(f"Select UserID from chats join userschats uc on uc.chatid = chats.chatid join " + f"users on users.userid = uc.userid where truechatid = '{trueChatID}' and TrueUserID = '{killedUserID}'") + id = cur.fetchall()[0] + cur.execute(f"UPDATE Users SET isAlive = false WHERE UserID = '{id}'") response["killedUserId"] = killedUserID cur.execute(f"SELECT role FROM users WHERE TrueUserID ='{checkedUserID}';") - row = cur.fetchall() - role = row[0] + role = cur.fetchall()[0] if role == 4: response["checkedRole"] = True