feat: sync bot api formatted text parse modes
Sync telesrv 00630bc (feat(botapi): support formatted text parse modes). Skipped telesrv docs changes per public sync rules.
This commit is contained in:
parent
afc73ca761
commit
2965f5d47d
11 changed files with 1684 additions and 85 deletions
|
|
@ -402,6 +402,9 @@ func apiMessageEntities(in []domain.MessageEntity, users map[int64]domain.User)
|
|||
"offset": entity.Offset,
|
||||
"length": entity.Length,
|
||||
}
|
||||
if entity.Type == domain.MessageEntityBlockquote && entity.Collapsed {
|
||||
item["type"] = "expandable_blockquote"
|
||||
}
|
||||
if entity.URL != "" {
|
||||
item["url"] = entity.URL
|
||||
}
|
||||
|
|
@ -418,6 +421,10 @@ func apiMessageEntities(in []domain.MessageEntity, users map[int64]domain.User)
|
|||
if entity.DocumentID != 0 {
|
||||
item["custom_emoji_id"] = strconv.FormatInt(entity.DocumentID, 10)
|
||||
}
|
||||
if entity.Type == domain.MessageEntityFormattedDate {
|
||||
item["unix_time"] = entity.Date
|
||||
item["date_time_format"] = botAPIFormattedDateFormat(entity)
|
||||
}
|
||||
out = append(out, item)
|
||||
}
|
||||
return out
|
||||
|
|
@ -461,6 +468,10 @@ func botAPIEntityType(in domain.MessageEntityType) (string, bool) {
|
|||
return "email", true
|
||||
case domain.MessageEntityPhone:
|
||||
return "phone_number", true
|
||||
case domain.MessageEntityBankCard:
|
||||
return "bank_card_number", true
|
||||
case domain.MessageEntityFormattedDate:
|
||||
return "date_time", true
|
||||
default:
|
||||
return "", false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue