Synchronous my.telegram.org wrapper
This commit is contained in:
parent
b339a9d849
commit
ec6ba6ea76
@ -25,12 +25,15 @@ use Amp\Artax\Request;
|
|||||||
*/
|
*/
|
||||||
class MyTelegramOrgWrapper
|
class MyTelegramOrgWrapper
|
||||||
{
|
{
|
||||||
|
use Tools;
|
||||||
|
|
||||||
private $logged = false;
|
private $logged = false;
|
||||||
private $hash = '';
|
private $hash = '';
|
||||||
private $token;
|
private $token;
|
||||||
private $number;
|
private $number;
|
||||||
private $creation_hash;
|
private $creation_hash;
|
||||||
private $settings;
|
private $settings;
|
||||||
|
public $async = false;
|
||||||
const MY_TELEGRAM_URL = 'https://my.telegram.org';
|
const MY_TELEGRAM_URL = 'https://my.telegram.org';
|
||||||
|
|
||||||
public function __sleep()
|
public function __sleep()
|
||||||
@ -268,5 +271,14 @@ class MyTelegramOrgWrapper
|
|||||||
|
|
||||||
return $final_headers;
|
return $final_headers;
|
||||||
}
|
}
|
||||||
|
public function async($async)
|
||||||
|
{
|
||||||
|
$this->async = $async;
|
||||||
|
}
|
||||||
|
public function __call($name, $arguments)
|
||||||
|
{
|
||||||
|
$name .= '_async';
|
||||||
|
$async = is_array(end($arguments)) && isset(end($arguments)['async']) ? end($arguments)['async'] : $this->async;
|
||||||
|
return $async ? $this->{$name}(...$arguments) : $this->wait($this->{$name}(...$arguments));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user