replace mention name with public key (#4579)
* replace mention with public key * bump version
This commit is contained in:
parent
0bd4a06edc
commit
ea3e59ffee
|
@ -2297,6 +2297,14 @@ func (m *Messenger) sendChatMessage(ctx context.Context, message *common.Message
|
|||
}
|
||||
|
||||
message.DisplayName = displayName
|
||||
|
||||
replacedText, err := m.mentionsManager.ReplaceWithPublicKey(message.ChatId, message.Text)
|
||||
if err == nil {
|
||||
message.Text = replacedText
|
||||
} else {
|
||||
m.logger.Error("failed to replace text with public key", zap.String("chatID", message.ChatId), zap.String("text", message.Text))
|
||||
}
|
||||
|
||||
if len(message.ImagePath) != 0 {
|
||||
|
||||
err := message.LoadImage()
|
||||
|
|
|
@ -63,7 +63,13 @@ func (m *Messenger) EditMessage(ctx context.Context, request *requests.EditMessa
|
|||
|
||||
editMessage := NewEditMessage()
|
||||
|
||||
editMessage.Text = request.Text
|
||||
replacedText, err := m.mentionsManager.ReplaceWithPublicKey(message.ChatId, request.Text)
|
||||
if err != nil {
|
||||
m.logger.Error("failed to replace text with public key", zap.String("chatID", message.ChatId), zap.String("text", request.Text))
|
||||
// use original text as fallback
|
||||
replacedText = request.Text
|
||||
}
|
||||
editMessage.Text = replacedText
|
||||
editMessage.ContentType = request.ContentType
|
||||
editMessage.ChatId = message.ChatId
|
||||
editMessage.MessageId = message.ID
|
||||
|
|
Loading…
Reference in New Issue