Async button
This commit is contained in:
parent
d44e35f514
commit
688283e3a0
2
docs
2
docs
@ -1 +1 @@
|
|||||||
Subproject commit e8e22ca165ac1bc8a7435d5d55b3e94b1883d9d8
|
Subproject commit 3dbba4bc60dc830c08d5343e438bcd003ba9d1c5
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user