This commit is contained in:
shoopea 2019-05-06 11:37:16 +08:00
parent 7a2e1bebfe
commit 52029dac8a

6
td.go
View File

@ -98,7 +98,7 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
if err != nil { if err != nil {
if err.Error() == "timeout" { if err.Error() == "timeout" {
logOnError(err, "Waiting...") logOnError(err, "Waiting...")
fmt.Printf("Waiting : %d messages retrieved out of %d dating back %s ...\n", msgCount, msgParsed, lastParsedTime.Format(time.RFC3339)) fmt.Printf("Waiting : %d messages retrieved out of %d dating back %s (%d) ...\n", msgCount, msgParsed, lastParsedTime.Format(time.RFC3339), lastParsedID64)
time.Sleep(5 * time.Second) time.Sleep(5 * time.Second)
} else { } else {
logOnError(err, "Cannot get history") logOnError(err, "Cannot get history")
@ -139,14 +139,14 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
msgCount = msgCount + 1 msgCount = msgCount + 1
} }
default: default:
log.Printf("getHistory : no handler for %s\n", msg.Content.GetMessageContentEnum()) log.Printf("getHistory(%d) : no handler for %s\n", msg.ID, msg.Content.GetMessageContentEnum())
} }
if m.ID64 < lastParsedID64 { if m.ID64 < lastParsedID64 {
lastParsedID64 = msg.ID lastParsedID64 = msg.ID
lastParsedTime = time.Unix(int64(m.Date), 0) lastParsedTime = time.Unix(int64(m.Date), 0)
} }
if msgParsed%1000 == 0 { if msgParsed%1000 == 0 {
fmt.Printf("Waiting : %d messages retrieved out of %d dating back %s ...\n", msgCount, msgParsed, lastParsedTime.Format(time.RFC3339)) fmt.Printf("Waiting : %d messages retrieved out of %d dating back %s (%d) ...\n", msgCount, msgParsed, lastParsedTime.Format(time.RFC3339), lastParsedID64)
} }
} }