mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 04:08:59 +01:00
Fix #1490
This commit is contained in:
parent
00d0eb9f7b
commit
0df07f3a37
@ -389,8 +389,9 @@ abstract class AbstractMessage extends Update implements SimpleFilters
|
||||
*/
|
||||
public function read(bool $readAll = false): bool
|
||||
{
|
||||
if (DialogId::isSupergroupOrChannel($this->chatId)) {
|
||||
return $this->getClient()->methodCallAsyncRead(
|
||||
DialogId::isSupergroupOrChannel($this->chatId) ? 'channels.readHistory':'messages.readHistory',
|
||||
'channels.readHistory',
|
||||
[
|
||||
'peer' => $this->chatId,
|
||||
'channel' => $this->chatId,
|
||||
@ -398,6 +399,16 @@ abstract class AbstractMessage extends Update implements SimpleFilters
|
||||
]
|
||||
);
|
||||
}
|
||||
$this->getClient()->methodCallAsyncRead(
|
||||
'messages.readHistory',
|
||||
[
|
||||
'peer' => $this->chatId,
|
||||
'channel' => $this->chatId,
|
||||
'max_id' => $readAll ? 0 : $this->id,
|
||||
]
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set maximum Time-To-Live of all messages in the specified chat.
|
||||
|
@ -31,8 +31,6 @@ use const DIRECTORY_SEPARATOR;
|
||||
use const E_ALL;
|
||||
use const MADELINE_WORKER_TYPE;
|
||||
use const PHP_INT_SIZE;
|
||||
use const PHP_MAJOR_VERSION;
|
||||
use const PHP_MINOR_VERSION;
|
||||
|
||||
use const PHP_SAPI;
|
||||
use const SIG_DFL;
|
||||
|
@ -76,7 +76,8 @@ final class Builder
|
||||
}
|
||||
private array $methodsCalled = [];
|
||||
private array $methodsCreated = [];
|
||||
private function methodCall(string $method): string {
|
||||
private function methodCall(string $method): string
|
||||
{
|
||||
$this->methodsCalled[$method] = true;
|
||||
return $this->methodsCreated[$method]
|
||||
? "\$this->$method(\$stream)"
|
||||
@ -231,10 +232,12 @@ final class Builder
|
||||
return $result;
|
||||
', 'array', static: $type === 'JSONValue');
|
||||
}
|
||||
private function w(string $data): void {
|
||||
private function w(string $data): void
|
||||
{
|
||||
fwrite($this->output, $data);
|
||||
}
|
||||
public function m(string $methodName, string $body, string $returnType = 'mixed', bool $public = false, bool $static = true): void {
|
||||
public function m(string $methodName, string $body, string $returnType = 'mixed', bool $public = false, bool $static = true): void
|
||||
{
|
||||
$this->methodsCreated[$methodName] = $static;
|
||||
$public = $public ? 'public' : 'private';
|
||||
$static = $static ? 'static' : '';
|
||||
@ -339,7 +342,7 @@ final class Builder
|
||||
|
||||
$initial_constructors = array_filter(
|
||||
$this->TL->getConstructors()->by_id,
|
||||
fn (array $arr) => $arr['type'] === 'Update'
|
||||
static fn (array $arr) => $arr['type'] === 'Update'
|
||||
|| $arr['predicate'] === 'rpc_result'
|
||||
|| !$arr['encrypted']
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user