1
0
mirror of https://github.com/danog/MadelineProto.git synced 2025-01-23 04:11:11 +01:00

Button bugfix

This commit is contained in:
Daniil Gentili 2021-04-07 15:39:30 +02:00
parent fea7d6577e
commit ad4294423f
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -63,13 +63,17 @@ class Button implements \JsonSerializable, \ArrayAccess
*/
public function __construct(MTProto $API, array $message, array $button)
{
if (!isset($message['from_id']) // No other option
// It's a channel/chat, 100% what we need
|| $message['peer_id']['_'] !== 'peerUser'
// It is a user, and it's not ourselves
|| $message['peer_id']['user_id'] !== $API->authorization['user']['id']
) {
$this->peer = $message['peer_id'];
} else {
$this->peer = $message['from_id'];
}
$this->button = $button;
$this->peer = $message['peer_id'] === [
'_' => 'peerUser',
'user_id' => $API->authorization['user']['id']
]
? $message['from_id']
: $message['peer_id'];
$this->id = $message['id'];
$this->API = $API;
$this->session = $API->getWrapper()->getSession()->getLegacySessionPath();