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

@@ -59,6 +59,14 @@ func (b *Bot) Error(ctx context.Context, roomID id.RoomID, message string, args
}
}
// Notice sends a notice message to the matrix room
func (b *Bot) Notice(ctx context.Context, roomID id.RoomID, message string, args ...interface{}) {
b.lp.Send(roomID, &event.MessageEventContent{
MsgType: event.MsgNotice,
Body: fmt.Sprintf(message, args...),
})
}
// Start performs matrix /sync
func (b *Bot) Start() error {
if err := b.migrate(); err != nil {