From 92c47a28eec248b4530bb1fbe230240a78f8431e Mon Sep 17 00:00:00 2001 From: shoopea Date: Fri, 14 Jun 2019 11:09:20 +0800 Subject: [PATCH] test --- bot.go | 10 +++++----- main.go | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/bot.go b/bot.go index 87c320b..fb47ed9 100644 --- a/bot.go +++ b/bot.go @@ -134,7 +134,7 @@ func botTest(m *tb.Message) { if !m.Private() { return } - if _, ok := clientsKeepAlive[m.Chat.ID]; ok { + if _, ok := clientsKeepAlive.Load(m.Chat.ID); ok { clientSendCWMsg(m.Chat.ID, "🏅Me") c := TGCommand{ @@ -160,7 +160,7 @@ func botMsgRescan(m *tb.Message) { if !m.Private() { return } - if _, ok := clientsKeepAlive[m.Chat.ID]; !ok && m.Chat.ID != cfg.Bot.Admin { + if _, ok := clientsKeepAlive.Load(m.Chat.ID); !ok && m.Chat.ID != cfg.Bot.Admin { c := TGCommand{ Type: commandReplyMsg, Text: "Client not registered", @@ -210,7 +210,7 @@ func botMsgRescanAll(m *tb.Message) { if !m.Private() { return } - if _, ok := clientsKeepAlive[m.Chat.ID]; !ok && m.Chat.ID != cfg.Bot.Admin { + if _, ok := clientsKeepAlive.Load(m.Chat.ID); !ok && m.Chat.ID != cfg.Bot.Admin { c := TGCommand{ Type: commandReplyMsg, Text: "Client not registered", @@ -253,7 +253,7 @@ func botBackupExport(m *tb.Message) { if !m.Private() { return } - if _, ok := clientsKeepAlive[m.Chat.ID]; !ok && m.Chat.ID != cfg.Bot.Admin { + if _, ok := clientsKeepAlive.Load(m.Chat.ID); !ok && m.Chat.ID != cfg.Bot.Admin { c := TGCommand{ Type: commandReplyMsg, Text: "Client not registered", @@ -279,7 +279,7 @@ func botBackupImport(m *tb.Message) { if !m.Private() { return } - if _, ok := clientsKeepAlive[m.Chat.ID]; !ok && m.Chat.ID != cfg.Bot.Admin { + if _, ok := clientsKeepAlive.Load(m.Chat.ID); !ok && m.Chat.ID != cfg.Bot.Admin { c := TGCommand{ Type: commandReplyMsg, Text: "Client not registered", diff --git a/main.go b/main.go index 1ba8af8..847dff5 100644 --- a/main.go +++ b/main.go @@ -154,7 +154,6 @@ func main() { MQTGCmdQueue = make(chan TGCommand, MQTGCmdQueueSize) JobQueue = make(chan Job, JobQueueSize) clientsQueue = make(map[int64]*MQClient) - clientsKeepAlive = make(map[int64]*MQKeepAlive) clientsCW = new(sync.Map) clientsKeepAlive = new(sync.Map)