test intercept setting

This commit is contained in:
shoopea 2020-02-10 10:03:56 +08:00
parent fdffad7532
commit d2b0ab0da3
2 changed files with 28 additions and 17 deletions

View File

@ -29,7 +29,10 @@ func loadClients() error {
muxClients.Lock() muxClients.Lock()
for _, c := range clts { for _, c := range clts {
cx := ChirpClient{} cx := ChirpClient{
Config: ChirpConfig{
InterceptPillage: true,
}}
copier.Copy(&cx, &c) copier.Copy(&cx, &c)
cx.Active = false cx.Active = false
/* /*
@ -183,6 +186,9 @@ func getLockedClient(id int64, createMissing bool) (*ChirpClient, bool) {
c := ChirpClient{ c := ChirpClient{
TGUserID64: id, TGUserID64: id,
Active: false, Active: false,
Config: ChirpConfig{
InterceptPillage: true,
},
} }
c.Mux.Lock() c.Mux.Lock()
muxClients.RUnlock() muxClients.RUnlock()

37
def.go
View File

@ -78,23 +78,28 @@ type MQClient struct {
Queue amqp.Queue `json:"-"` Queue amqp.Queue `json:"-"`
} }
type ChirpConfig struct {
InterceptPillage bool `json:"intercept_pillage"`
}
type ChirpClient struct { type ChirpClient struct {
HeartBeat time.Time `json:"heart_beat"` HeartBeat time.Time `json:"heart_beat"`
Login string `json:"nickname"` Login string `json:"nickname"`
Build string `json:"build"` Build string `json:"build"`
Active bool `json:"active"` Active bool `json:"active"`
TGUserID64 int64 `json:"tg_user_id"` TGUserID64 int64 `json:"tg_user_id"`
MQ MQClient `json:"mq"` MQ MQClient `json:"mq"`
CWUserID64 int64 `json:"user_id"` CWUserID64 int64 `json:"user_id"`
CWGuildID64 int64 `json:"guild_id"` CWGuildID64 int64 `json:"guild_id"`
CWRole string `json:"role"` CWRole string `json:"role"`
CWState string `json:"state"` CWState string `json:"state"`
CWClass string `json:"class"` CWClass string `json:"class"`
CWBusyUntil time.Time `json:"busy_until"` CWBusyUntil time.Time `json:"busy_until"`
CWLastUpdate time.Time `json:"last_update"` CWLastUpdate time.Time `json:"last_update"`
GameIdle bool `json:"game_idle"` GameIdle bool `json:"game_idle"`
BotIdle bool `json:"bot_idle"` BotIdle bool `json:"bot_idle"`
Mux sync.Mutex `json:"-"` Mux sync.Mutex `json:"-"`
Config *ChirpConfig `json:"config"`
} }
type MQKeepAlive struct { type MQKeepAlive struct {