remove useless search in users query

This commit is contained in:
git-bruh 2021-12-09 13:37:58 +05:30
parent cef8cb0bbf
commit c2f3e97611
No known key found for this signature in database
GPG key ID: E1475C50075ADCE6

View file

@ -113,11 +113,8 @@ class DataBase:
"""
with self.lock:
self.cur.execute("SELECT * FROM users")
users = self.cur.fetchall()
self.cur.execute("SELECT * FROM users where mxid = ?", [mxid])
user: dict = next(
iter([user for user in users if user["mxid"] == mxid]), {}
)
user = self.cur.fetchone()
return user
return {} if not user else user