aboutsummaryrefslogtreecommitdiff
path: root/telegram/utils.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2023-11-16 03:38:45 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2023-11-16 03:38:45 +0300
commit6bd837911431ef68d23de1bcbb75893edd39a32b (patch)
tree660d2a497017f027edacedd5d7ab55d75252a924 /telegram/utils.go
parent576acba0d18717da5abc5a232cf92c23c9b8a550 (diff)
Support blockquotes in formatter
Diffstat (limited to 'telegram/utils.go')
-rw-r--r--telegram/utils.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/telegram/utils.go b/telegram/utils.go
index b22f156..9370839 100644
--- a/telegram/utils.go
+++ b/telegram/utils.go
@@ -593,7 +593,7 @@ func (c *Client) messageToText(message *client.Message, preview bool) string {
return "<empty message>"
}
- markupFunction := c.getFormatter()
+ markupMode := c.getFormatter()
switch message.Content.MessageContentType() {
case client.TypeMessageSticker:
sticker, _ := message.Content.(*client.MessageSticker)
@@ -646,7 +646,7 @@ func (c *Client) messageToText(message *client.Message, preview bool) string {
return formatter.Format(
photo.Caption.Text,
photo.Caption.Entities,
- markupFunction,
+ markupMode,
)
}
case client.TypeMessageAudio:
@@ -657,7 +657,7 @@ func (c *Client) messageToText(message *client.Message, preview bool) string {
return formatter.Format(
audio.Caption.Text,
audio.Caption.Entities,
- markupFunction,
+ markupMode,
)
}
case client.TypeMessageVideo:
@@ -668,7 +668,7 @@ func (c *Client) messageToText(message *client.Message, preview bool) string {
return formatter.Format(
video.Caption.Text,
video.Caption.Entities,
- markupFunction,
+ markupMode,
)
}
case client.TypeMessageDocument:
@@ -679,7 +679,7 @@ func (c *Client) messageToText(message *client.Message, preview bool) string {
return formatter.Format(
document.Caption.Text,
document.Caption.Entities,
- markupFunction,
+ markupMode,
)
}
case client.TypeMessageText:
@@ -690,7 +690,7 @@ func (c *Client) messageToText(message *client.Message, preview bool) string {
return formatter.Format(
text.Text.Text,
text.Text.Entities,
- markupFunction,
+ markupMode,
)
}
case client.TypeMessageVoiceNote:
@@ -701,7 +701,7 @@ func (c *Client) messageToText(message *client.Message, preview bool) string {
return formatter.Format(
voice.Caption.Text,
voice.Caption.Entities,
- markupFunction,
+ markupMode,
)
}
case client.TypeMessageVideoNote:
@@ -714,7 +714,7 @@ func (c *Client) messageToText(message *client.Message, preview bool) string {
return formatter.Format(
animation.Caption.Text,
animation.Caption.Entities,
- markupFunction,
+ markupMode,
)
}
case client.TypeMessageContact:
@@ -1500,8 +1500,8 @@ func (c *Client) hasLastMessageHashChanged(chatId, messageId int64, content clie
return !ok || oldHash != newHash
}
-func (c *Client) getFormatter() func(*client.TextEntity) (*formatter.Insertion, *formatter.Insertion) {
- return formatter.EntityToXEP0393
+func (c *Client) getFormatter() formatter.MarkupModeType {
+ return formatter.MarkupModeXEP0393
}
func (c *Client) usernamesToString(usernames []string) string {