telegramfmt: ignore unrecognized entities
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user