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