From c0e742f147eb7108ea5304ebae23e8de2db15ff4 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 11 May 2022 14:22:49 +0200 Subject: [PATCH] Properly update database on updateUserName --- src/danog/MadelineProto/MTProtoTools/PeerHandler.php | 2 +- src/danog/MadelineProto/MTProtoTools/UpdateHandler.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php b/src/danog/MadelineProto/MTProtoTools/PeerHandler.php index 16b67aeac..656aa27f3 100644 --- a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/PeerHandler.php @@ -640,7 +640,7 @@ trait PeerHandler $this->logger->logger($e); } if (isset($dbres['ok']) && $dbres['ok']) { - yield from $this->resolveUsername('@'.$dbres['result']); + yield from $this->resolveUsername($dbres['result']); return yield from $this->getInfo($id, $type, false); } } diff --git a/src/danog/MadelineProto/MTProtoTools/UpdateHandler.php b/src/danog/MadelineProto/MTProtoTools/UpdateHandler.php index 00bfb7b02..b2efced98 100644 --- a/src/danog/MadelineProto/MTProtoTools/UpdateHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/UpdateHandler.php @@ -291,6 +291,9 @@ trait UpdateHandler yield from $this->getConfig(); } if (\in_array($update['_'], ['updateUserName', 'updateUserPhone', 'updateUserBlocked', 'updateUserPhoto', 'updateContactRegistered', 'updateContactLink']) && $this->getSettings()->getDb()->getEnableFullPeerDb()) { + if ($update['_'] === 'updateUserName') { + $update = yield from $this->resolveUsername($update['username'])['peer']; + } $id = $this->getId($update); $chat = yield $this->full_chats[$id]; $chat['last_update'] = 0;