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

37
def.go
View File

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