todo, impl changing sender via @name but not test
parent
9d855e0f30
commit
7ec4ce79dd
|
|
@ -16,7 +16,7 @@ func TestTimeMarshal(t *testing.T) {
|
|||
t.Fatal(string(b))
|
||||
} else if err := json.Unmarshal(b, &other); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if now.Unix() != other.Unix() {
|
||||
t.Fatal(other.Unix(), now.Unix())
|
||||
} else if now.Unix() != other.Get().Unix() {
|
||||
t.Fatal(other.Get().Unix(), now.Unix())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import (
|
|||
"fmt"
|
||||
"local/truckstop/config"
|
||||
"log"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/matrix-org/gomatrix"
|
||||
|
|
@ -66,20 +68,26 @@ func (m Matrix) Receive() ([]Message, error) {
|
|||
case "m.room.message":
|
||||
b, ok := event.Body()
|
||||
if ok {
|
||||
messages = append(messages, Message{Sender: event.Sender, Content: b})
|
||||
messages = append(messages, Message{Sender: event.Sender, Content: strings.TrimSpace(b)})
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
clientChange := regexp.MustCompile("^@[a-z]+")
|
||||
for i := range messages {
|
||||
if found := clientChange.FindString(messages[i].Content); found != "" {
|
||||
messages[i].Content = strings.TrimSpace(strings.ReplaceAll(messages[i].Content, found, ""))
|
||||
messages[i].Sender = found[1:]
|
||||
} else {
|
||||
for k, v := range config.Get().Clients {
|
||||
if v.IDs.Matrix == messages[i].Sender {
|
||||
messages[i].Sender = k
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return messages, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
todo:
|
||||
- "caleb: commands: args"
|
||||
- change matrix so I test my custom logic even if I dont fetch remote
|
||||
- warn/err/etc. on clobbering ids.matrix since clients can mess with one another
|
||||
- modify old items once no longer available; drop stale jobs good candidate but requires new matrix interaction
|
||||
- more than NTG
|
||||
- todo: filter out jobs like CA
|
||||
subtasks:
|
||||
- banlist criteria like vendors, brokers, metadata
|
||||
- quiet hours
|
||||
- setup ma on element !!fluffychat
|
||||
- set up copy for caleb, broc
|
||||
done:
|
||||
- quiet hours
|
||||
- "@caleb commands: args"
|
||||
- accept after date
|
||||
- accept pause commands
|
||||
- accept states via element for one system
|
||||
|
|
|
|||
Loading…
Reference in New Issue