Receiving all channel participants through the telethon library

Good afternoon. While studying the telethon library, I came across the GetParticipantsRequest method, which should return an object of the ChannelParticipants class that has a users variable that contains all the channel participants. Using the documentation of the telethon library (Working with Chats and Channels — Telethon 0.18.2 documentation), I wrote this function:

def get_users_from_channel(client, channel_username):
    offset = 0 
    limit = 100 
    all_participants = [] 
    while True: 
        participants = client(GetParticipantsRequest(channel_username, ChannelParticipantsSearch(''), offset, limit, hash=0)) 
        if not participants.users: 
            break 
        all_participants.extend(participants.users) 
        offset += len(participants.users) 
    return all_participants

however, it returns only 201 users out of 291 (in my case). Where did I make a mistake?

I suspect that you are misusing ‘offset’. To be sure, I would have to have the doc for client, but I will let you examine that.