danog / MadelineProto

Async PHP client API for the telegram MTProto protocol
https://docs.madelineproto.xyz
GNU Affero General Public License v3.0
2.81k stars 640 forks source link

getChatInviteImporters #1330

Closed xcgu closed 1 year ago

xcgu commented 1 year ago

Hi

$MadelineProto->messages->getChatInviteImporters( peer: $peer, offset_user: $lastId ?? null, link: $link, offset_date: -1, limit: int );

This mthod is not working as it must. I tried different offset_user with the same limit (I tested 5 and my link has at least 100 importers) but the results are the same.

xcgu commented 1 year ago

I checked this with another mtproto client to check if its server side problem but it was ok so it seems to be madelineproto issue

danog commented 1 year ago

The offset_date should be 0.

xcgu commented 1 year ago

No affect still the same problem Also this is the way I get $lastId: $lastId = end($chatInviteImporters['users'])['id'];

danog commented 1 year ago

Try end($chatInviteImporters['importers'])['user_id']

xcgu commented 1 year ago

No change again. I will provide a complete test with full code.

xcgu commented 1 year ago

This is my test

Here is the full importers: https://gist.github.com/thebrutish/574473005f341266b11f2254bd239278

Then I tried this code:

$i = 1; do { $chatInviteImporters = $MadelineProto->messages->getChatInviteImporters( peer: $peer, offset_user: $lastId ?? null, link: $link, offset_date: 0, limit: 2 ); echo 'Last ID is: ' . ($lastId ?? 'First round'); echo json_encode($chatInviteImporters); echo '

'; $lastId = end($chatInviteImporters['importers'])['user_id']; $i++; } while ($i < 5);

And the result is: https://gist.github.com/thebrutish/6b9f10ce631613f9dbcdeb852875319a

I also tried manually passing offset_user with different user ids but it seems to be ignored totally

Charles30898 commented 1 year ago
danog commented 1 year ago

Damn, this was a nasty one, it turns out offset_date must also be provided for offset_user to work, will document this.