OpenTl.ClientApi icon indicating copy to clipboard operation
OpenTl.ClientApi copied to clipboard

Unable to load all Dialogs

Open bsod79 opened this issue 6 years ago • 4 comments

Hello,

I'm trying to load all the Dialogs. I'm correctly getting the TDialogSlice and handling it in my code

var chats = this.TGClientAPI.MessagesService.GetUserDialogsAsync(300).Result; if (chats.GetType() == typeof(TDialogsSlice)) { ..... } else { ..... }

As a Result I get : image

My idea was to load remaing data, but with no luck. I tried also with a customrequest setting but always getting 0 or the same data as first request.

Am I doing something wrong?

bsod79 avatar Jan 08 '19 10:01 bsod79

I also tried it, but looks like there is no continuation parameter or method to get the next slice.

I know there is example code. But better use the is operator.

var chats = await TelegramClient.MessagesService.GetUserDialogsAsync(300);

if (chats is TDialogsSlice dialogSlice)
{
	Console.WriteLine($"Received dialog slice {dialogSlice.Chats.Count}");
}
else
if (chats is TDialogs dialogs)
{
	Console.WriteLine($"Received dialog {dialogs.Chats.Count}");
}```

KoalaBear84 avatar Jan 08 '19 12:01 KoalaBear84

You're right. Just done some tests again, seems there is no way to get the "next slice" from Telegram, even with custom requests.

bsod79 avatar Jan 08 '19 14:01 bsod79

Hello, I go on with other tests, but with no luck. Someone has some updates?

bsod79 avatar Feb 14 '19 13:02 bsod79

Hi,

I do that, but SendRequestAsync stop the execution without reason!

var tchannel = new TChannel();  // TODO: handle null reference
var userDialogs = await _clientApi.MessagesService.GetUserDialogsAsync();
foreach(var chat  in userDialogs.As<TDialogsSlice>().Chats)
{
    if(chat.GetType().ToString() == "OpenTl.Schema.TChannel")
    {
        var channel = ((TChannel)chat);
        if (channel.Title == "destination")    // TODO: change before production
        {
            tchannel = channel;
        }
    }
}

var destChannel = new TInputChannel()
{
    ChannelId = tchannel.Id,
    AccessHash = tchannel.AccessHash
};

var requestcl = new RequestGetParticipants
{
    Channel = destChannel,
    Limit = int.MaxValue,
    Offset = 0,
};

var participants = (TChannelParticipants) await _clientApi.CustomRequestsService.SendRequestAsync(requestcl);

imclint21 avatar Jan 19 '20 18:01 imclint21