This commit is contained in:
shoopea 2019-06-14 11:09:20 +08:00
parent 6ea9dd94e8
commit 92c47a28ee
2 changed files with 5 additions and 6 deletions

10
bot.go
View File

@ -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",

View File

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