sochix / TLSharp

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

GetHistoryAsync() returns max 100 messages #965

Open RDSt3ch opened 4 years ago

RDSt3ch commented 4 years ago

Hey all, i am trying to retrieve message of a channel using TLsharp, i am using "GetHistoryAsync()" method to retrieve the history of the messages in the channel but it gives max 100 last messages although its "limit" override is set to a higher value. and this is the way i am working with it:

TLInputPeerChannel PeerChannel = new TLInputPeerChannel()
                        {
                            ChannelId = chat.ID,
                            AccessHash = (long)chat.AccessHash
                        };
TLAbsMessages AbsHistory = await frmLogin.Client.GetHistoryAsync(PeerChannel, limit: Limit);
TLChannelMessages History = (TLChannelMessages)AbsHistory;
List<TLAbsMessage> HistoryMessages = History.Messages.ToList();
List<TLMessage> Messages = HistoryMessages.ConvertAll<TLMessage>
                            (new Converter<TLAbsMessage, TLMessage>(AbsMessageToMessage));

do you have any idea what am I missing here?

Laiteux commented 4 years ago

Sounds like a restriction of the API.

Use min_id/max_id parameters for pagination: https://core.telegram.org/method/messages.getHistory#parameters