From 14980979629c09025d537b4ac190f8c8d7e7651b Mon Sep 17 00:00:00 2001 From: shoopea Date: Sat, 11 May 2019 17:06:00 +0800 Subject: [PATCH] test --- td.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/td.go b/td.go index 9e86f67..e086b82 100644 --- a/td.go +++ b/td.go @@ -96,6 +96,7 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) { } for lastParsedID64 >= 0 { + prevLastParsedID64 := lastParsedID64 msgs, err := c.GetChatHistory(chat, lastParsedID64, 0, 33, false) if err != nil { if err.Error() == "timeout" { @@ -158,6 +159,10 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) { } else { lastParsedID64 = -1 } + if prevLastParsedID64 == lastParsedID64 { + // we should be at the end ! + lastParsedID64 = -1 + } } log.Printf("Exported %d messages.\n", msgCount) fmt.Printf("Exported %d messages.\n", msgCount)