diff --git a/messagetracking.go b/messagetracking.go index b8bab39..477b2cf 100644 --- a/messagetracking.go +++ b/messagetracking.go @@ -105,7 +105,7 @@ func errorToStatusReason(err error) (reason event.MessageStatusReason, status ev } } -func (portal *Portal) sendErrorMessage(evt *event.Event, err error, confirmed bool, editID id.EventID) id.EventID { +func (portal *Portal) sendErrorMessage(evt *event.Event, err error, msgType string, confirmed bool, editID id.EventID) id.EventID { if !portal.bridge.Config.Bridge.MessageErrorNotices { return "" } @@ -113,9 +113,9 @@ func (portal *Portal) sendErrorMessage(evt *event.Event, err error, confirmed bo if confirmed { certainty = "was not" } - msg := fmt.Sprintf("\u26a0 Your message %s bridged: %v", certainty, err) + msg := fmt.Sprintf("\u26a0 Your %s %s bridged: %v", msgType, certainty, err) if errors.Is(err, errMessageTakingLong) { - msg = "\u26a0 Bridging your message is taking longer than usual" + msg = fmt.Sprintf("\u26a0 Bridging your %s is taking longer than usual", msgType) } content := &event.MessageEventContent{ MsgType: event.MsgNotice, @@ -206,7 +206,7 @@ func (portal *Portal) sendMessageMetrics(evt *event.Event, err error, part strin checkpointStatus := status.ReasonToCheckpointStatus(reason, statusCode) portal.bridge.SendMessageCheckpoint(evt, status.MsgStepRemote, err, checkpointStatus, ms.getRetryNum()) if sendNotice { - ms.setNoticeID(portal.sendErrorMessage(evt, err, isCertain, ms.getNoticeID())) + ms.setNoticeID(portal.sendErrorMessage(evt, err, msgType, isCertain, ms.getNoticeID())) } portal.sendStatusEvent(origEvtID, evt.ID, err) } else {