nest a function for readable

master
Bel LaPointe 2022-01-11 23:13:36 -05:00
parent 4ffc6bba8c
commit 8f681c7927
1 changed files with 12 additions and 10 deletions

22
main.go
View File

@ -49,17 +49,19 @@ func matrixrecv() error {
if err != nil { if err != nil {
return err return err
} }
states := map[string]map[config.State]struct{}{} func() {
for _, msg := range messages { states := map[string]map[config.State]struct{}{}
if _, ok := states[msg.Sender]; ok { for _, msg := range messages {
continue if _, ok := states[msg.Sender]; ok {
continue
}
states[msg.Sender] = map[config.State]struct{}{}
for _, state := range parseOutStates([]byte(msg.Content)) {
states[msg.Sender][state] = struct{}{}
}
} }
states[msg.Sender] = map[config.State]struct{}{} setNewStates(states)
for _, state := range parseOutStates([]byte(msg.Content)) { }()
states[msg.Sender][state] = struct{}{}
}
}
setNewStates(states)
return nil return nil
} }