From 7055ee648e1a862d185277fb336c1d59ad3ee9bc Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 1 Sep 2022 21:27:59 +0200 Subject: [PATCH] Update get_peer_by_username query --- pyrogram/storage/sqlite_storage.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyrogram/storage/sqlite_storage.py b/pyrogram/storage/sqlite_storage.py index f7fbb55b..15e5ddc0 100644 --- a/pyrogram/storage/sqlite_storage.py +++ b/pyrogram/storage/sqlite_storage.py @@ -151,7 +151,8 @@ class SQLiteStorage(Storage): async def get_peer_by_username(self, username: str): r = self.conn.execute( - "SELECT id, access_hash, type, last_update_on FROM peers WHERE username = ?", + "SELECT id, access_hash, type, last_update_on FROM peers WHERE username = ?" + "ORDER BY last_update_on DESC", (username,) ).fetchone()