Use notice instead of error for expected "errors"

Notice() is like Error(), but:

- the message is not sent to the error log (and Sentry)
- the message sent to the room is not prefixed with `ERROR: `
This commit is contained in:
Slavi Pantaleev
2022-08-23 17:51:34 +03:00
parent 99e62a54a5
commit b79a728967
3 changed files with 12 additions and 4 deletions

View File

@@ -28,7 +28,7 @@ func (b *Bot) getOwner(ctx context.Context, evt *event.Event) {
}
if cfg.Owner == "" {
b.Error(span.Context(), evt.RoomID, "owner is not set yet")
b.Notice(span.Context(), evt.RoomID, "owner is not set yet")
return
}
@@ -52,7 +52,7 @@ func (b *Bot) setOwner(ctx context.Context, evt *event.Event, owner string) {
}
if !cfg.Allowed(b.noowner, evt.Sender) {
b.Error(span.Context(), evt.RoomID, "you don't have permission to do that")
b.Notice(span.Context(), evt.RoomID, "you don't have permission to do that")
return
}