Merge remote

This commit is contained in:
Daniil Gentili 2019-05-12 12:37:26 +02:00
commit 59bf76aefa
2 changed files with 4 additions and 3 deletions

View File

@ -47,6 +47,7 @@ class Button implements \JsonSerializable, \ArrayAccess
$async = $params; $async = $params;
} }
$async = isset($async['async']) ? $async['async'] : (isset($this->info['API']->wrapper) ? $this->info['API']->wrapper->async : true); $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';
switch ($this->data['_']) { switch ($this->data['_']) {
default: default:
return false; return false;
@ -56,10 +57,10 @@ class Button implements \JsonSerializable, \ArrayAccess
$res = $this->info['API']->method_call_async_read('messages.sendMessage', ['peer' => $this->info['peer'], 'message' => $this->data['text'], 'reply_to_msg_id' => $this->info['id']], ['datacenter' => $this->info['API']->datacenter->curdc]); $res = $this->info['API']->method_call_async_read('messages.sendMessage', ['peer' => $this->info['peer'], 'message' => $this->data['text'], 'reply_to_msg_id' => $this->info['id']], ['datacenter' => $this->info['API']->datacenter->curdc]);
break; break;
case 'keyboardButtonCallback': case 'keyboardButtonCallback':
$res = $this->info['API']->method_call_async_read('messages.getBotCallbackAnswer', ['peer' => $this->info['peer'], 'msg_id' => $this->info['id'], 'data' => $this->data['data']], ['noResponse' => $donotwait, 'datacenter' => $this->info['API']->datacenter->curdc]); $res = $this->info['API']->$method('messages.getBotCallbackAnswer', ['peer' => $this->info['peer'], 'msg_id' => $this->info['id'], 'data' => $this->data['data']], ['datacenter' => $this->info['API']->datacenter->curdc]);
break; break;
case 'keyboardButtonGame': case 'keyboardButtonGame':
$res = $this->info['API']->method_call_async_read('messages.getBotCallbackAnswer', ['peer' => $this->info['peer'], 'msg_id' => $this->info['id'], 'game' => true], ['noResponse' => $donotwait, 'datacenter' => $this->info['API']->datacenter->curdc]); $res = $this->info['API']->$method('messages.getBotCallbackAnswer', ['peer' => $this->info['peer'], 'msg_id' => $this->info['id'], 'game' => true], ['datacenter' => $this->info['API']->datacenter->curdc]);
break; break;
} }
return $async ? $res : $this->wait($res); return $async ? $res : $this->wait($res);

View File

@ -223,7 +223,7 @@ trait Tools
public function after($a, $b) public function after($a, $b)
{ {
$a = $this->call($a); $a = $this->call($a());
$deferred = new Deferred(); $deferred = new Deferred();
$a->onResolve(function ($e, $res) use ($b, $deferred) { $a->onResolve(function ($e, $res) use ($b, $deferred) {
if ($e) { if ($e) {