Skip to content
This repository was archived by the owner on Dec 5, 2021. It is now read-only.
This repository was archived by the owner on Dec 5, 2021. It is now read-only.

TLSharp Get All Members In Group #934

@kratossz

Description

@kratossz

Hi, i want to get all members in group but my code only attracts 10k members.

`
public static async Task GetChatInfo(string groupName)
{
if (! await AuthUser()) return null;
var result = new ChannelInfo();
var dialogs = (TLDialogs)await client.GetUserDialogsAsync();
var main = dialogs.chats.lists.Where(c => c.GetType() == typeof(TLChannel))
.Cast()
.FirstOrDefault(c => c.title == (groupName));
var req = new TLRequestGetFullChannel()
{
channel = new TLInputChannel() { access_hash = main.access_hash.Value, channel_id = main.id }
};

        var res = await client.SendRequestAsync<TeleSharp.TL.Messages.TLChatFull>(req);

        //we have to do this in slices
        var offset = 0;
        result.Channel = main;
        result.ChatFull = res;
        while (offset < (res.full_chat as TLChannelFull).participants_count)
        {
            var pReq = new TLRequestGetParticipants()
            {
                channel = new TLInputChannel() { access_hash = main.access_hash.Value, channel_id = main.id },
                filter = new TLChannelParticipantsRecent() { },
                limit = 200,
                offset = offset
            };
            var pRes = await client.SendRequestAsync<TLChannelParticipants>(pReq);
            result.Users.AddRange(pRes.users.lists.Cast<TLUser>());
            offset += 200;
            await Task.Delay(500);
        }

        return result;
    }

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions