TLSharp icon indicating copy to clipboard operation
TLSharp copied to clipboard

GetHistoryAsync() returns max 100 messages

Open RDSt3ch opened this issue 5 years ago • 1 comments

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?

RDSt3ch avatar Jul 19 '20 16:07 RDSt3ch

Sounds like a restriction of the API.

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

Laiteux avatar Sep 04 '20 04:09 Laiteux