check msg prefix before parse for both new-!state, !available
This commit is contained in:
7
main.go
7
main.go
@@ -60,6 +60,9 @@ func matrixrecv() error {
|
||||
log.Printf("looking for states")
|
||||
states := map[string]map[config.State]struct{}{}
|
||||
for _, msg := range messages {
|
||||
if !strings.HasPrefix(msg.Content, "!state") {
|
||||
continue
|
||||
}
|
||||
if _, ok := states[msg.Sender]; ok {
|
||||
continue
|
||||
}
|
||||
@@ -74,10 +77,10 @@ func matrixrecv() error {
|
||||
log.Printf("looking for pauses")
|
||||
pauses := map[string]time.Time{}
|
||||
for _, msg := range messages {
|
||||
if _, ok := pauses[msg.Sender]; ok {
|
||||
if !strings.HasPrefix(msg.Content, "!available ") {
|
||||
continue
|
||||
}
|
||||
if !strings.HasPrefix(msg.Content, "!available ") {
|
||||
if _, ok := pauses[msg.Sender]; ok {
|
||||
continue
|
||||
}
|
||||
t, err := time.ParseInLocation(
|
||||
|
||||
Reference in New Issue
Block a user