mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 09:38:57 +01:00
Wrap wait
This commit is contained in:
parent
119e29f4a7
commit
2d2a3bd01f
@ -258,12 +258,18 @@ class MyTelegramOrgWrapper
|
||||
{
|
||||
$this->async = $async;
|
||||
}
|
||||
|
||||
public function loop($callable)
|
||||
{
|
||||
return $this->wait($callable());
|
||||
}
|
||||
public function __call($name, $arguments)
|
||||
{
|
||||
$name .= '_async';
|
||||
$async = is_array(end($arguments)) && isset(end($arguments)['async']) ? end($arguments)['async'] : $this->async;
|
||||
|
||||
if (!method_exists($this, $name)) {
|
||||
throw new Exception("$name does not exist!");
|
||||
}
|
||||
return $async ? $this->{$name}(...$arguments) : $this->wait($this->{$name}(...$arguments));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user