From 59b5530044d3b5c91c8131049de73323ad7fe606 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 29 Oct 2019 18:56:35 +0100 Subject: [PATCH] Button improvements --- src/danog/MadelineProto/TL/Types/Button.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/danog/MadelineProto/TL/Types/Button.php b/src/danog/MadelineProto/TL/Types/Button.php index 7c55669e..a38d0b46 100644 --- a/src/danog/MadelineProto/TL/Types/Button.php +++ b/src/danog/MadelineProto/TL/Types/Button.php @@ -42,12 +42,11 @@ class Button implements \JsonSerializable, \ArrayAccess public function click($donotwait = false, $params = []) { if (\is_array($donotwait)) { - $async = $donotwait; - } else { - $async = $params; + $params = $donotwait; + $donotwait = false; } - $async = isset($async['async']) ? $async['async'] : (isset($this->info['API']->wrapper) ? $this->info['API']->wrapper->async : true); - $method = $donotwait === true ? 'method_call_async_write' : 'method_call_async_read'; + $async = $params['async']) ?? (isset($this->info['API']->wrapper) ? $this->info['API']->wrapper->async : true); + $method = $donotwait ? 'method_call_async_write' : 'method_call_async_read'; switch ($this->data['_']) { default: return false;