test
This commit is contained in:
parent
71ee2eb14b
commit
dc1289a876
8
td.go
8
td.go
@ -70,7 +70,9 @@ func ListenCW(c *tdlib.Client) {
|
||||
func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
|
||||
var lastMsgID64 int64 = int64(math.MaxInt64)
|
||||
var msgCount int32 = 0
|
||||
var msgParsed int32 = 0
|
||||
var lastMsgTime time.Time = time.Now()
|
||||
var lastParsedTime time.Time = time.Now()
|
||||
var chat int64
|
||||
var m ChatWarsMessage
|
||||
|
||||
@ -94,6 +96,8 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
|
||||
}
|
||||
} else if msgs.TotalCount > 0 {
|
||||
for _, msg := range msgs.Messages {
|
||||
msgParsed = msgParsed + 1
|
||||
lastParsedTime = time.Unix(int64(msg.Date), 0)
|
||||
switch msg.Content.GetMessageContentEnum() {
|
||||
case tdlib.MessageTextType:
|
||||
if msg.ForwardInfo == nil {
|
||||
@ -128,6 +132,10 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
|
||||
lastMsgTime = time.Unix(int64(m.Date), 0)
|
||||
}
|
||||
msgCount = msgCount + 1
|
||||
if msgCount%1000 == 0 {
|
||||
fmt.Printf("Waiting : %d messages retrieved from %s ...\n", msgCount, lastMsgTime.Format(time.RFC3339))
|
||||
}
|
||||
|
||||
}
|
||||
default:
|
||||
log.Printf("getHistory : no handler for %s\n", msg.Content.GetMessageContentEnum())
|
||||
|
Loading…
Reference in New Issue
Block a user