This commit is contained in:
shoopea 2019-05-11 17:13:29 +08:00
parent 23f4120d71
commit ae70c7091a

8
td.go
View File

@ -101,8 +101,8 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
msgs, err := c.GetChatHistory(chat, lastParsedID64, 0, 33, false)
if err != nil {
if err.Error() == "timeout" {
logOnError(err, "Waiting...")
fmt.Printf("Timeout : %d messages retrieved out of %d dating back %s (%d) ...\n", msgCount, msgParsed, lastParsedTime.Format(time.RFC3339), lastParsedID64)
logOnError(err, "Waiting....")
fmt.Printf("Timeout : %d messages retrieved out of %d dating back %s (%d) ...\n", msgCount, msgParsed, lastParsedTime.Format(time.RFC3339), lastParsedID64)
time.Sleep(5 * time.Second)
} else {
logOnError(err, "Cannot get history")
@ -153,7 +153,7 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
lastParsedTime = m.Date
}
if msgParsed%1000 == 0 {
fmt.Printf("Waiting : %d messages retrieved out of %d dating back %s (%d) ...\n", msgCount, msgParsed, lastParsedTime.Format(time.RFC3339), lastParsedID64)
fmt.Printf("Waiting : %d messages retrieved out of %d dating back %s (%d) ...\n", msgCount, msgParsed, lastParsedTime.Format(time.RFC3339), lastParsedID64)
}
}
@ -166,6 +166,8 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
// we should be at the end !
lastParsedID64 = -1
} else {
logOnError(err, "Overflow ...")
fmt.Printf("Overflow : %d messages retrieved out of %d dating back %s (%d) ...\n", msgCount, msgParsed, lastParsedTime.Format(time.RFC3339), lastParsedID64)
time.Sleep(5 * time.Second)
}
}