refactor Send(), fixes #6

This commit is contained in:
Aine
2022-08-26 23:06:20 +03:00
parent 4000b39480
commit f2d81495dc
3 changed files with 127 additions and 97 deletions

26
utils/matrix.go Normal file
View File

@@ -0,0 +1,26 @@
package utils
import (
"maunium.net/go/mautrix/event"
"maunium.net/go/mautrix/id"
)
// RelatesTo block of matrix event content
func RelatesTo(noThreads bool, parentID id.EventID) *event.RelatesTo {
if parentID == "" {
return nil
}
if noThreads {
return &event.RelatesTo{
InReplyTo: &event.InReplyTo{
EventID: parentID,
},
}
}
return &event.RelatesTo{
Type: event.RelThread,
EventID: parentID,
}
}