From 10dc79cee24a1bf29735e73ff6c3491f1e955c33 Mon Sep 17 00:00:00 2001 From: reza zand <65753078+rezazand@users.noreply.github.com> Date: Wed, 13 Sep 2023 03:53:00 +0330 Subject: [PATCH 1/2] Fix bug in installCommand related to message.photo configuration option In the installCommand file, adding the message.photo configuration option was not handled properly due to extra space. This commit fixes the bug by removing the extra space. --- src/Console/InstallCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php index 0589123..4a6af09 100644 --- a/src/Console/InstallCommand.php +++ b/src/Console/InstallCommand.php @@ -59,8 +59,8 @@ protected function installScaffolding(): void ); $this->replaceInFile( - "'message' => [],", - "'message' => [],\n\n\t\t\t\t'message.photo' => [ + "'message' => [],", + "'message' => [],\n\n\t\t\t\t'message.photo' => [ \t\t\App\Listeners\ProcessInboundPhoto::class,\n\t\t\t\t],\n", config_path('telegram.php') ); From d1ead6cdd01bab28342b31655dcb42803c47a156 Mon Sep 17 00:00:00 2001 From: reza zand <65753078+rezazand@users.noreply.github.com> Date: Wed, 13 Sep 2023 04:04:28 +0330 Subject: [PATCH 2/2] Fix bug in ProcessInboundPhoto for downloading Telegram photos In the ProcessInboundPhoto file, the downloadFile method was not properly accepting the file_id as the first input parameter, resulting in errors when attempting to download photos from the Telegram server. This commit fixes the bug. --- stubs/app/Listeners/ProcessInboundPhoto.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/app/Listeners/ProcessInboundPhoto.php b/stubs/app/Listeners/ProcessInboundPhoto.php index 3c90123..12d7a11 100644 --- a/stubs/app/Listeners/ProcessInboundPhoto.php +++ b/stubs/app/Listeners/ProcessInboundPhoto.php @@ -23,7 +23,7 @@ public function handle(UpdateEvent $event) // Download the largest image to the storage/app directory. $photo = collect($update['message']['photo'])->last(); - $bot->downloadFile($photo, storage_path('app/photos')); + $bot->downloadFile($photo['file_id'], storage_path('app/photos')); // Reply the user. $text = 'Thanks for uploading the pic!';