1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 07:14:39 +01:00
This commit is contained in:
Daniil Gentili 2017-07-27 09:06:03 +02:00
commit 0610e33631
2 changed files with 15 additions and 10 deletions

View File

@ -15,7 +15,7 @@ description: PWRTelegram participant attributes, type and example
|promoted_by|[Chat](Chat.md) | Optional|The user that promoted this participant|
|kicked_by|[Chat](Chat.md) | Optional|The user that kicked this participant|
|date|[int](API_docs/types/int.md) | Yes|When was the user invited|
|role|[string](API_docs/types/string.md) | Yes|user, admin, creator, moderator, editor, creator, kicked|
|role|[string](API_docs/types/string.md) | Yes|user, admin, creator, banned|
|can_edit|[Bool](API_docs/types/Bool.md) | Optional|Can the user edit messages in the channel|
|left|[Bool](API_docs/types/Bool.md) | Optional|Has this user left|
|admin_rights|[ChannelAdminRights](API_docs/types/ChannelAdminRights.md) | Optional|Admin rights|

View File

@ -452,12 +452,19 @@ trait PeerHandler
if (!isset($res['participants']) && isset($res['can_view_participants']) && $res['can_view_participants']) {
$res['participants'] = [];
$limit = 200;
$offset = -$limit;
$filters = ['channelParticipantsBanned', 'channelParticipantsAdmins', 'channelParticipantsKicked', 'channelParticipantsBots', 'channelParticipantsRecent'];
$gres = $this->method_call('channels.getParticipants', ['channel' => $full['InputChannel'], 'filter' => ['_' => 'channelParticipantsRecent'], 'offset' => $offset += $limit, 'limit' => $limit], ['datacenter' => $this->datacenter->curdc]);
$count = $gres['count'];
while (count($filters)) {
$filter = array_pop($filters);
$filters = ['channelParticipantsRecent', 'channelParticipantsAdmins', 'channelParticipantsKicked', 'channelParticipantsBots', 'channelParticipantsBanned'];
foreach ($filters as $filter) {
$offset = -$limit;
try {
$gres = $this->method_call('channels.getParticipants', ['channel' => $full['InputChannel'], 'filter' => ['_' => $filter, 'q' => ''], 'offset' => $offset += $limit, 'limit' => $limit], ['datacenter' => $this->datacenter->curdc]);
} catch (\danog\MadelineProto\RPCErrorException $e) {
if ($e->rpc === 'CHAT_ADMIN_REQUIRED') {
continue;
} else {
throw $e;
}
}
$count = $gres['count'];
while ($offset <= $count) {
foreach ($gres['participants'] as $participant) {
$newres = [];
@ -510,10 +517,8 @@ trait PeerHandler
break;
}
}
if ($offset >= $count) {
break;
}
}
$res['participants'] = array_values($res['participants']);
}
if ($fullfetch || $send) {
$this->store_db($res);