Skip to content

Commit 3269066

Browse files
committed
telegramfmt: ignore unrecognized entities
1 parent 0122ab9 commit 3269066

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pkg/connector/telegramfmt/convert.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ func Parse(ctx context.Context, message string, entities []tg.MessageEntityClass
136136
br.Value = Style{Type: StyleCustomEmoji, EmojiInfo: params.CustomEmojis[ids.MakeEmojiIDFromDocumentID(entity.DocumentID)]}
137137
case *tg.MessageEntityBlockquote:
138138
br.Value = Style{Type: StyleBlockquote}
139+
case *tg.MessageEntityFormattedDate:
140+
br.Value = Style{Type: StyleFormattedDate}
141+
default:
142+
log.Warn().Any("entity", e).Msg("Unsupported message entity")
143+
continue
139144
}
140145
lrt.Add(br)
141146
}

pkg/connector/telegramfmt/tags.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ const (
7070
StylePhone
7171
StyleSpoiler
7272
StyleBankCard
73+
StyleFormattedDate
7374
)
7475

7576
func (s StyleType) String() string {
@@ -110,6 +111,8 @@ func (s StyleType) String() string {
110111
return "StyleSpoiler"
111112
case StyleBankCard:
112113
return "StyleBankCard"
114+
case StyleFormattedDate:
115+
return "StyleFormattedDate"
113116
default:
114117
return fmt.Sprintf("StyleType(%d)", s)
115118
}

0 commit comments

Comments
 (0)