OpenTl.ClientApi
OpenTl.ClientApi copied to clipboard
Unable to load all Dialogs
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 :
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?
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}");
}```
You're right. Just done some tests again, seems there is no way to get the "next slice" from Telegram, even with custom requests.
Hello, I go on with other tests, but with no luck. Someone has some updates?
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);