aboutsummaryrefslogtreecommitdiff
path: root/telegram/handlers.go
diff options
context:
space:
mode:
authorbodqhrohro <bodqhrohro@gmail.com>2020-01-13 20:22:45 +0300
committerbodqhrohro <bodqhrohro@gmail.com>2020-01-13 20:22:45 +0300
commitbc37cf0c4f0d58752f92238a013513be9aa3caff (patch)
treebaa9b23aff598e5fd6489c46feba79f01c945ae3 /telegram/handlers.go
parentcfc9e1d52292b69260ba38d8652b8a5f67787a67 (diff)
Apply formatting to edited messages
Diffstat (limited to 'telegram/handlers.go')
-rw-r--r--telegram/handlers.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/telegram/handlers.go b/telegram/handlers.go
index 2756a2c..e768f04 100644
--- a/telegram/handlers.go
+++ b/telegram/handlers.go
@@ -9,6 +9,7 @@ import (
"strings"
"sync"
+ "dev.narayana.im/narayana/telegabber/telegram/formatter"
"dev.narayana.im/narayana/telegabber/xmpp/gateway"
log "github.com/sirupsen/logrus"
@@ -236,9 +237,14 @@ func (c *Client) updateNewMessage(update *client.UpdateNewMessage) {
// message content updated
func (c *Client) updateMessageContent(update *client.UpdateMessageContent) {
+ markupFunction := formatter.EntityToMarkdown
if update.NewContent.MessageContentType() == client.TypeMessageText {
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)
}
}