From da40b74b6c2ffbde263659dc57635e3c5b5fcddf Mon Sep 17 00:00:00 2001 From: shoopea Date: Tue, 5 Nov 2019 10:43:06 +0800 Subject: [PATCH] update --- main.go | 3 +++ td.go | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 10029ff..8db58cb 100644 --- a/main.go +++ b/main.go @@ -107,6 +107,9 @@ func main() { ownUserID32 = OwnUserID(client) ownUserID64 = int64(OwnUserID(client)) + lastChatTDMsg = make(map[int64]time.Time) + lastChatTDMsgMux = make(map[int64]*sync.Mutex) + MQCWMsgQueue = make(chan ChatWarsMessage, 100) for w := 1; w <= 3; w++ { go MQSendMsgWorker(w, MQCWMsgQueue) diff --git a/td.go b/td.go index f5fe75e..86ef6c3 100644 --- a/td.go +++ b/td.go @@ -75,8 +75,7 @@ func ListenTG(c *tdlib.Client) { lastChatMsgMux.RUnlock() lastChatMsgMux.Lock() if _, ok := lastChatTDMsg[m.ChatID64]; !ok { - initTime := time.Now().Add(-1 * time.Second) - lastChatTDMsg[m.ChatID64] = initTime + lastChatTDMsg[m.ChatID64] = time.Now().Add(-1 * time.Second) lastChatTDMsgMux[m.ChatID64] = new(sync.Mutex) } lastChatMsgMux.Unlock()