From 2c22ce9d42c4d1202189c1da66829927fb634888 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sat, 20 Apr 2024 00:31:46 +0200 Subject: [PATCH] Fix getPwrChat --- src/MTProtoTools/PeerHandler.php | 2 +- tests/danog/MadelineProto/FileIdTest.php | 4 ++-- tests/danog/MadelineProto/MadelineTestCase.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MTProtoTools/PeerHandler.php b/src/MTProtoTools/PeerHandler.php index f251accae..17a0d35fa 100644 --- a/src/MTProtoTools/PeerHandler.php +++ b/src/MTProtoTools/PeerHandler.php @@ -826,7 +826,7 @@ trait PeerHandler : PhotoSizeSourceDialogPhotoBig::class; $photoSize = new $photoSize( dialogId: $res['id'], - dialogAccessHash: $res['access_hash'], + dialogAccessHash: $full['Chat']['access_hash'] ?? $full['User']['access_hash'], ); $fileId = new FileId( diff --git a/tests/danog/MadelineProto/FileIdTest.php b/tests/danog/MadelineProto/FileIdTest.php index 1d6be8911..98c1e9330 100644 --- a/tests/danog/MadelineProto/FileIdTest.php +++ b/tests/danog/MadelineProto/FileIdTest.php @@ -65,8 +65,8 @@ class FileIdTest extends MadelineTestCase public function testDownload(string $type, string $fileIdStr, string $uniqueFileIdStr, array $fullInfo): void { self::$MadelineProto->logger("Trying to download $fileIdStr"); - self::$MadelineProto->downloadToFile($fileIdStr, "/tmp/$fileIdStr"); - unlink("/tmp/$fileIdStr"); + self::$MadelineProto->downloadToFile($fileIdStr, sys_get_temp_dir()."/$fileIdStr"); + unlink(sys_get_temp_dir()."/$fileIdStr"); $this->assertTrue(true); } /** diff --git a/tests/danog/MadelineProto/MadelineTestCase.php b/tests/danog/MadelineProto/MadelineTestCase.php index dfbdc13fe..c06d9a68e 100644 --- a/tests/danog/MadelineProto/MadelineTestCase.php +++ b/tests/danog/MadelineProto/MadelineTestCase.php @@ -33,7 +33,7 @@ abstract class MadelineTestCase extends TestCase 'testing.madeline', $settings ); - $unlock = Tools::flock('/tmp/login.flock', LOCK_EX); + $unlock = Tools::flock(sys_get_temp_dir().'/login.flock', LOCK_EX); self::$MadelineProto->botLogin(getenv('BOT_TOKEN')); $unlock(); }