add !pm banlist:totals, fix notices on reactions
This commit is contained in:
2
vendor/gitlab.com/etke.cc/linkpearl/justfile
generated
vendored
2
vendor/gitlab.com/etke.cc/linkpearl/justfile
generated
vendored
@@ -21,6 +21,6 @@ vuln:
|
||||
|
||||
# run unit tests
|
||||
test:
|
||||
@go test ${BUILDFLAGS} -coverprofile=cover.out ./...
|
||||
@go test -coverprofile=cover.out ./...
|
||||
@go tool cover -func=cover.out
|
||||
-@rm -f cover.out
|
||||
|
||||
11
vendor/gitlab.com/etke.cc/linkpearl/send.go
generated
vendored
11
vendor/gitlab.com/etke.cc/linkpearl/send.go
generated
vendored
@@ -21,15 +21,24 @@ func (l *Linkpearl) Send(roomID id.RoomID, content interface{}) (id.EventID, err
|
||||
|
||||
// SendNotice to a room with optional relations, markdown supported
|
||||
func (l *Linkpearl) SendNotice(roomID id.RoomID, message string, relates ...*event.RelatesTo) {
|
||||
var withRelatesTo bool
|
||||
content := format.RenderMarkdown(message, true, true)
|
||||
content.MsgType = event.MsgNotice
|
||||
if len(relates) > 0 {
|
||||
withRelatesTo = true
|
||||
content.RelatesTo = relates[0]
|
||||
}
|
||||
|
||||
_, err := l.Send(roomID, &content)
|
||||
if err != nil {
|
||||
l.log.Error().Err(UnwrapError(err)).Str("roomID", roomID.String()).Msg("cannot send a notice int the room")
|
||||
l.log.Error().Err(UnwrapError(err)).Str("roomID", roomID.String()).Str("retries", "1/2").Msg("cannot send a notice into the room")
|
||||
if withRelatesTo {
|
||||
content.RelatesTo = nil
|
||||
_, err = l.Send(roomID, &content)
|
||||
if err != nil {
|
||||
l.log.Error().Err(UnwrapError(err)).Str("roomID", roomID.String()).Str("retries", "2/2").Msg("cannot send a notice into the room even without relations")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user