(new): rich message support
Golang lint / lint (pull_request) Successful in 1m20s
Golang lint / lint (push) Successful in 4m8s

(fix): runtime reliability
(tests): regression coverage
(doc): v1.1 release notes
This commit is contained in:
2026-08-12 16:34:44 +03:00
parent 48ddf66540
commit f03a081ed6
83 changed files with 6122 additions and 1925 deletions
+40
View File
@@ -0,0 +1,40 @@
package tgrich
import "errors"
var (
// ErrRichTextTooLong indicates that rich-message text exceeds 32768 UTF-8 characters.
ErrRichTextTooLong = errors.New("rich text too long")
// ErrRichTooManyBlocks indicates that a rich message exceeds 500 blocks and counted nested items.
ErrRichTooManyBlocks = errors.New("rich text too many blocks")
// ErrRichNestingTooDeep indicates that rich formatting exceeds 16 nested levels.
ErrRichNestingTooDeep = errors.New("rich text nesting deep")
// ErrRichTooManyMedia indicates that a rich message contains more than 50 media attachments.
ErrRichTooManyMedia = errors.New("rich text too many media")
// ErrRichTableTooWide indicates that a table contains more than 20 columns.
ErrRichTableTooWide = errors.New("rich text table too wide")
// ErrRichUnknownTag indicates that a rich-text or rich-block implementation is unsupported.
ErrRichUnknownTag = errors.New("rich unknown tag")
// ErrRichListItemMix indicates that ordered and unordered items were mixed in one list.
ErrRichListItemMix = errors.New("rich list items mixed: ordered and unordered")
// ErrRichInvalidListItem indicates that an unordered item uses ordered-list attributes.
ErrRichInvalidListItem = errors.New("rich unordered list item has ordered attributes")
// ErrRichInvalidMedia indicates that a media block contains an incompatible media type.
ErrRichInvalidMedia = errors.New("rich block has incompatible media type")
// ErrRichInvalidBlockType indicates that a block's type discriminator doesn't match its Go type.
ErrRichInvalidBlockType = errors.New("rich block has invalid type")
// ErrRichInvalidHeading indicates that a heading has a size outside 1-6.
ErrRichInvalidHeading = errors.New("rich heading has invalid size")
// ErrRichInvalidMap indicates that a map has invalid coordinates, zoom, or dimensions.
ErrRichInvalidMap = errors.New("rich map has invalid parameters")
// ErrRichInvalidListItemType indicates that an ordered-list marker type is unsupported.
ErrRichInvalidListItemType = errors.New("rich list item has invalid type")
// ErrRichInvalidCheckbox indicates that a checked list item has no checkbox.
ErrRichInvalidCheckbox = errors.New("rich list item is checked without a checkbox")
// ErrRichInvalidTableCell indicates that a table cell has invalid spans or alignment.
ErrRichInvalidTableCell = errors.New("rich table cell has invalid parameters")
// ErrRichThinkingDraftOnly indicates that a thinking block was used outside a draft.
ErrRichThinkingDraftOnly = errors.New("thinking blocks are valid only in rich-message drafts")
// ErrRichEntityMismatch indicates that HTML conversion would lose an explicit entity value.
ErrRichEntityMismatch = errors.New("rich entity value doesn't match visible text")
)