Use carbons for non-native edits too

This commit is contained in:
Bohdan Horbeshko 2024-04-11 20:59:49 -04:00
parent a36856b768
commit f15e44436b

View file

@ -304,20 +304,21 @@ func (c *Client) updateMessageContent(update *client.UpdateMessageContent) {
}
if ok && lastXmppId == xmppId {
replaceId = xmppId
message, err := c.client.GetMessage(&client.GetMessageRequest{
ChatId: update.ChatId,
MessageId: update.MessageId,
})
if err == nil {
isCarbon = c.isCarbonsEnabled() && message.IsOutgoing
} else {
log.Errorf("No message %v/%v found, cannot reliably determine if it's a carbon", update.ChatId, update.MessageId)
}
} else {
log.Infof("Mismatching message ids: %v %v, falling back to separate edit message", lastXmppId, xmppId)
}
}
message, err := c.client.GetMessage(&client.GetMessageRequest{
ChatId: update.ChatId,
MessageId: update.MessageId,
})
if err == nil {
isCarbon = c.isCarbonsEnabled() && message.IsOutgoing
} else {
log.Errorf("No message %v/%v found, cannot reliably determine if it's a carbon", update.ChatId, update.MessageId)
}
text := formatter.Format(
textContent.Text.Text,
textContent.Text.Entities,