update pause/unpause

This commit is contained in:
shoopea 2021-11-08 14:27:49 +08:00
parent 7db13a764c
commit 9a1ba7e7f2
2 changed files with 18 additions and 14 deletions

20
bot.go
View File

@ -78,10 +78,6 @@ func botPause(m *tb.Message) {
if co, ok := srv.Status.Companies[cc.CompanyID]; ok { if co, ok := srv.Status.Companies[cc.CompanyID]; ok {
if clt, ok2 := srv.Status.Clients[co.ClientID]; ok2 { if clt, ok2 := srv.Status.Clients[co.ClientID]; ok2 {
clt.Paused = true clt.Paused = true
}
}
}
}
if !srv.Status.Paused { if !srv.Status.Paused {
srv.Pause() srv.Pause()
} else { } else {
@ -89,6 +85,12 @@ func botPause(m *tb.Message) {
} }
return return
} }
}
}
}
bot.SendChat(bot.Config.ChatID, "You are not playing and cannot pause the game.")
return
}
func botUnpause(m *tb.Message) { func botUnpause(m *tb.Message) {
PrintText(m) PrintText(m)
@ -97,10 +99,6 @@ func botUnpause(m *tb.Message) {
if co, ok := srv.Status.Companies[cc.CompanyID]; ok { if co, ok := srv.Status.Companies[cc.CompanyID]; ok {
if clt, ok2 := srv.Status.Clients[co.ClientID]; ok2 { if clt, ok2 := srv.Status.Clients[co.ClientID]; ok2 {
clt.Paused = false clt.Paused = false
}
}
}
}
if !srv.NeedPause() { if !srv.NeedPause() {
srv.Unpause() srv.Unpause()
} else { } else {
@ -108,6 +106,12 @@ func botUnpause(m *tb.Message) {
} }
return return
} }
}
}
}
bot.SendChat(bot.Config.ChatID, "You are not playing and cannot unpause the game.")
return
}
func botDelete(m *tb.Message) { func botDelete(m *tb.Message) {
logInfoDebug("[%d] %s(%d) | %s(%d) : delete : %s\n", m.ID, m.Chat.Title, m.Chat.ID, m.Sender.Username, m.Sender.ID, m.Text) logInfoDebug("[%d] %s(%d) | %s(%d) : delete : %s\n", m.ID, m.Chat.Title, m.Chat.ID, m.Sender.Username, m.Sender.ID, m.Text)

View File

@ -1,6 +1,6 @@
// Code generated by version.sh (@generated) DO NOT EDIT. // Code generated by version.sh (@generated) DO NOT EDIT.
package main package main
var githash = "3194cb3" var githash = "7db13a7"
var buildstamp = "2021-11-08_06:19:35" var buildstamp = "2021-11-08_06:27:36"
var commits = "168" var commits = "169"
var version = "3194cb3-b168 - 2021-11-08_06:19:35" var version = "7db13a7-b169 - 2021-11-08_06:27:36"