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))
|
t.Fatal(string(b))
|
||||||
} else if err := json.Unmarshal(b, &other); err != nil {
|
} else if err := json.Unmarshal(b, &other); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
} else if now.Unix() != other.Unix() {
|
} else if now.Unix() != other.Get().Unix() {
|
||||||
t.Fatal(other.Unix(), now.Unix())
|
t.Fatal(other.Get().Unix(), now.Unix())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"local/truckstop/config"
|
"local/truckstop/config"
|
||||||
"log"
|
"log"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/matrix-org/gomatrix"
|
"github.com/matrix-org/gomatrix"
|
||||||
|
|
@ -66,17 +68,23 @@ func (m Matrix) Receive() ([]Message, error) {
|
||||||
case "m.room.message":
|
case "m.room.message":
|
||||||
b, ok := event.Body()
|
b, ok := event.Body()
|
||||||
if ok {
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
clientChange := regexp.MustCompile("^@[a-z]+")
|
||||||
for i := range messages {
|
for i := range messages {
|
||||||
for k, v := range config.Get().Clients {
|
if found := clientChange.FindString(messages[i].Content); found != "" {
|
||||||
if v.IDs.Matrix == messages[i].Sender {
|
messages[i].Content = strings.TrimSpace(strings.ReplaceAll(messages[i].Content, found, ""))
|
||||||
messages[i].Sender = k
|
messages[i].Sender = found[1:]
|
||||||
|
} else {
|
||||||
|
for k, v := range config.Get().Clients {
|
||||||
|
if v.IDs.Matrix == messages[i].Sender {
|
||||||
|
messages[i].Sender = k
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
todo:
|
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
|
- 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
|
- modify old items once no longer available; drop stale jobs good candidate but requires new matrix interaction
|
||||||
- more than NTG
|
- more than NTG
|
||||||
- todo: filter out jobs like CA
|
- todo: filter out jobs like CA
|
||||||
subtasks:
|
subtasks:
|
||||||
- banlist criteria like vendors, brokers, metadata
|
- banlist criteria like vendors, brokers, metadata
|
||||||
- quiet hours
|
|
||||||
- setup ma on element !!fluffychat
|
- setup ma on element !!fluffychat
|
||||||
- set up copy for caleb, broc
|
- set up copy for caleb, broc
|
||||||
done:
|
done:
|
||||||
|
- quiet hours
|
||||||
|
- "@caleb commands: args"
|
||||||
- accept after date
|
- accept after date
|
||||||
- accept pause commands
|
- accept pause commands
|
||||||
- accept states via element for one system
|
- accept states via element for one system
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue