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 {
return err
}
states := map[string]map[config.State]struct{}{}
for _, msg := range messages {
if _, ok := states[msg.Sender]; ok {
continue
func() {
states := map[string]map[config.State]struct{}{}
for _, msg := range messages {
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{}{}
for _, state := range parseOutStates([]byte(msg.Content)) {
states[msg.Sender][state] = struct{}{}
}
}
setNewStates(states)
setNewStates(states)
}()
return nil
}