Array it is then

This commit is contained in:
Daniil Gentili 2017-07-27 00:48:19 +02:00
parent ac32bb6bc6
commit 23d2b718a3

View File

@ -452,9 +452,8 @@ trait PeerHandler
if (!isset($res['participants']) && isset($res['can_view_participants']) && $res['can_view_participants']) { if (!isset($res['participants']) && isset($res['can_view_participants']) && $res['can_view_participants']) {
$res['participants'] = []; $res['participants'] = [];
$limit = 200; $limit = 200;
$filters = ['channelParticipantsBanned', 'channelParticipantsAdmins', 'channelParticipantsKicked', 'channelParticipantsBots', 'channelParticipantsRecent']; $filters = ['channelParticipantsRecent', 'channelParticipantsAdmins', 'channelParticipantsKicked', 'channelParticipantsBots', 'channelParticipantsBanned'];
while (count($filters)) { foreach ($filters as $filter) {
$filter = array_pop($filters);
$offset = -$limit; $offset = -$limit;
try { try {
$gres = $this->method_call('channels.getParticipants', ['channel' => $full['InputChannel'], 'filter' => ['_' => $filter, 'q' => ''], 'offset' => $offset += $limit, 'limit' => $limit], ['datacenter' => $this->datacenter->curdc]); $gres = $this->method_call('channels.getParticipants', ['channel' => $full['InputChannel'], 'filter' => ['_' => $filter, 'q' => ''], 'offset' => $offset += $limit, 'limit' => $limit], ['datacenter' => $this->datacenter->curdc]);
@ -519,6 +518,7 @@ trait PeerHandler
} }
} }
} }
$res['participants'] = array_values($res['participants']);
} }
if ($fullfetch || $send) { if ($fullfetch || $send) {
$this->store_db($res); $this->store_db($res);