telegramfmt: ignore unrecognized entities

This commit is contained in:
Tulir Asokan
2026-03-16 21:54:21 +02:00
parent 0122ab91d6
commit 326906644e
2 changed files with 8 additions and 0 deletions
+5
View File
@@ -136,6 +136,11 @@ func Parse(ctx context.Context, message string, entities []tg.MessageEntityClass
br.Value = Style{Type: StyleCustomEmoji, EmojiInfo: params.CustomEmojis[ids.MakeEmojiIDFromDocumentID(entity.DocumentID)]}
case *tg.MessageEntityBlockquote:
br.Value = Style{Type: StyleBlockquote}
case *tg.MessageEntityFormattedDate:
br.Value = Style{Type: StyleFormattedDate}
default:
log.Warn().Any("entity", e).Msg("Unsupported message entity")
continue
}
lrt.Add(br)
}
+3
View File
@@ -70,6 +70,7 @@ const (
StylePhone
StyleSpoiler
StyleBankCard
StyleFormattedDate
)
func (s StyleType) String() string {
@@ -110,6 +111,8 @@ func (s StyleType) String() string {
return "StyleSpoiler"
case StyleBankCard:
return "StyleBankCard"
case StyleFormattedDate:
return "StyleFormattedDate"
default:
return fmt.Sprintf("StyleType(%d)", s)
}