This commit is contained in:
shoopea 2019-05-11 17:06:00 +08:00
parent 70d026c2e1
commit 1498097962

5
td.go
View File

@ -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)