1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 13:34:42 +01:00

Fix getSponsoredMessages
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
Alexander Pankratov 2023-01-07 23:27:29 +01:00
parent 2b618e0557
commit 43c68b3a46

View File

@ -43,9 +43,15 @@ trait Ads
if ($cache && $cache[0] > \time()) {
return $cache[1];
}
$result = (yield from $this->methodCallAsyncRead('channels.getSponsoredMessages', ['channel' => $peer]))['messages'];
$this->sponsoredMessages->set($peer, [\time() + 5*60, $result]);
return $result;
$result = (yield from $this->methodCallAsyncRead('channels.getSponsoredMessages', ['channel' => $peer]));
if (array_key_exists('messages', $result)) {
$result = $result['messages'];
} else {
$result = null;
}
$this->sponsoredMessages->set($peer, [\time() + 5*60, $result]);
return $result;
}
/**
* Mark sponsored message as read.