Apply formatting to edited messages
This commit is contained in:
parent
cfc9e1d522
commit
bc37cf0c4f
|
@ -9,6 +9,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"dev.narayana.im/narayana/telegabber/telegram/formatter"
|
||||||
"dev.narayana.im/narayana/telegabber/xmpp/gateway"
|
"dev.narayana.im/narayana/telegabber/xmpp/gateway"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
@ -236,9 +237,14 @@ func (c *Client) updateNewMessage(update *client.UpdateNewMessage) {
|
||||||
|
|
||||||
// message content updated
|
// message content updated
|
||||||
func (c *Client) updateMessageContent(update *client.UpdateMessageContent) {
|
func (c *Client) updateMessageContent(update *client.UpdateMessageContent) {
|
||||||
|
markupFunction := formatter.EntityToMarkdown
|
||||||
if update.NewContent.MessageContentType() == client.TypeMessageText {
|
if update.NewContent.MessageContentType() == client.TypeMessageText {
|
||||||
textContent := update.NewContent.(*client.MessageText)
|
textContent := update.NewContent.(*client.MessageText)
|
||||||
text := fmt.Sprintf("✎ %v | %s", update.MessageId, textContent.Text.Text)
|
text := fmt.Sprintf("✎ %v | %s", update.MessageId, formatter.Format(
|
||||||
|
textContent.Text.Text,
|
||||||
|
formatter.SortEntities(textContent.Text.Entities),
|
||||||
|
markupFunction,
|
||||||
|
))
|
||||||
gateway.SendMessage(c.jid, strconv.FormatInt(update.ChatId, 10), text, c.xmpp)
|
gateway.SendMessage(c.jid, strconv.FormatInt(update.ChatId, 10), text, c.xmpp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue