sochix / TLSharp

Telegram client library implemented in C#
1.01k stars 380 forks source link

Group Participants can only get 10004 ? #994

Open Vxer-Lee opened 3 years ago

Vxer-Lee commented 3 years ago

When I get all of the group members, I can only get 10004 at most. Why is that?

string gruopName = "PornHub";
var client = NewClient();
await client.ConnectAsync();

var dialogs = (TLDialogs)await client.GetUserDialogsAsync();
var main = dialogs.Chats.ToList().Where(c => c.GetType() == typeof(TLChannel))
            .Cast<TLChannel>()
            .FirstOrDefault(c => c.Title == (gruopName));
var req = new TLRequestGetFullChannel()
{
    Channel = new TLInputChannel() { AccessHash =(long) main.AccessHash, ChannelId = main.Id }
};

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

////we have to do this in slices
var result = new ChannelInfo();
var offset = 0;
while (offset < (res.FullChat as TLChannelFull).ParticipantsCount)
{
    var pReq = new TLRequestGetParticipants()
    {
        Channel = new TLInputChannel() { AccessHash = main.AccessHash.Value, ChannelId = main.Id },
        Filter = new TLChannelParticipantsRecent() { },
        Limit = 200,
        Offset = offset
    };
    var pRes = await client.SendRequestAsync<TLChannelParticipants>(pReq);

    result.Users.AddRange(pRes.Users.ToList().Cast<TLUser>());
    offset += 200;
    await Task.Delay(500);
}
public class ChannelInfo
{
    public TLChannel Channel { get; set; }
    public TeleSharp.TL.Messages.TLChatFull ChatFull { get; set; }
    public List<TLUser> Users { get; set; } = new List<TLUser>();

    private DateTime _dateCreated;
    public DateTime DateCreated
    {
        get { return _dateCreated; }
        set
        {
            _dateCreated = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Channel.Date).ToLocalTime();
        }
    }
}

image

elmagekmosaad commented 3 years ago

https://github.com/sochix/TLSharp/issues/970

Vxer-Lee commented 3 years ago

Anybody here ?

Vxer-Lee commented 3 years ago

😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀 Anybody here ?

jianwei923 commented 3 years ago

Hello, I have the same problem. Have you solved it

Vxer-Lee commented 3 years ago

Hello, I have the same problem. Have you solved it

NO.