(new): support Bot API 10.3
Golang lint / lint (push) Failing after 1m37s

(fix): finalize v2 contracts
(tests): cover v2 migration
(doc): prepare release guidance
This commit is contained in:
2026-09-08 23:21:38 +03:00
parent 24040fe164
commit d78526242b
88 changed files with 2321 additions and 918 deletions
+66 -1
View File
@@ -1,6 +1,6 @@
package tgrich
import "git.scuroneko.dev/scuroneko/laniakea/tgapi"
import "git.scuroneko.dev/scuroneko/laniakea/v2/tgapi"
// Caption creates a media-block caption without a credit.
//
@@ -390,6 +390,8 @@ type RichTable struct {
IsBordered bool
// IsStriped reports whether the table has striped rows.
IsStriped bool
// IsCompact requests smaller table-cell padding.
IsCompact bool
// Caption is the optional table caption.
Caption *tgapi.RichText
}
@@ -425,6 +427,14 @@ func (t *RichTable) SetStriped(b bool) *RichTable {
return t
}
// SetCompact requests smaller table-cell padding.
//
// Since: Bot API 10.3
func (t *RichTable) SetCompact(b bool) *RichTable {
t.IsCompact = b
return t
}
// SetCaption sets the table caption.
//
// Since: Bot API 10.2
@@ -442,6 +452,7 @@ func (t *RichTable) Build() tgapi.InputRichBlockTable {
Cells: t.Cells,
IsBordered: t.IsBordered,
IsStriped: t.IsStriped,
IsCompact: t.IsCompact,
Caption: t.Caption,
}
}
@@ -477,6 +488,20 @@ func MapWithCaption(loc tgapi.Location, zoom uint8, width, height uint16, captio
return tgapi.InputRichBlockMap{Type: tgapi.InputRichTypeMap, Location: loc, Zoom: zoom, Width: width, Height: height, Caption: &caption}
}
// Buttons creates a row of 1-8 rich buttons.
//
// Since: Bot API 10.3
func Buttons(buttons []tgapi.RichMessageButton) tgapi.InputRichBlockButtons {
return tgapi.InputRichBlockButtons{Type: tgapi.InputRichTypeButtons, Buttons: buttons}
}
// ButtonsWithAlign creates a button row aligned left, center, or right.
//
// Since: Bot API 10.3
func ButtonsWithAlign(buttons []tgapi.RichMessageButton, align tgapi.RichBlockButtonAlign) tgapi.InputRichBlockButtons {
return tgapi.InputRichBlockButtons{Type: tgapi.InputRichTypeButtons, Buttons: buttons, Align: align}
}
// Animation creates an animation block without a caption.
//
// Since: Bot API 10.2
@@ -568,3 +593,43 @@ func VoiceNoteWithCaption(voiceNote tgapi.InputMedia, caption tgapi.RichBlockCap
func Thinking(text tgapi.RichText) tgapi.InputRichBlockThinking {
return tgapi.InputRichBlockThinking{Type: tgapi.InputRichTypeThinking, Text: text}
}
// Button embeds a button in rich text.
//
// Since: Bot API 10.3
func Button(button tgapi.RichMessageButton) tgapi.RichTextButton {
return tgapi.RichTextButton{Button: button}
}
// ExpandableBlockquote creates a quotation corresponding to <blockquote expandable>.
//
// Since: Bot API 10.3
func ExpandableBlockquote(text tgapi.RichText) tgapi.InputRichBlockExpandableBlockQuotation {
return tgapi.InputRichBlockExpandableBlockQuotation{Type: tgapi.InputRichTypeExpandableBlockQuotation, Text: text}
}
// ExpandableBlockquoteWithCredit creates an expandable quotation with its source.
//
// Since: Bot API 10.3
func ExpandableBlockquoteWithCredit(text, credit tgapi.RichText) tgapi.InputRichBlockExpandableBlockQuotation {
block := ExpandableBlockquote(text)
block.Credit = &credit
return block
}
// Document creates a general-file block corresponding to <tg-document>.
//
// Since: Bot API 10.3
func Document(document tgapi.InputMedia) tgapi.InputRichBlockDocument {
document.Type = tgapi.InputMediaTypeDocument
return tgapi.InputRichBlockDocument{Type: tgapi.InputRichTypeDocument, Document: document}
}
// DocumentWithCaption creates a general-file block with a caption.
//
// Since: Bot API 10.3
func DocumentWithCaption(document tgapi.InputMedia, caption tgapi.RichBlockCaption) tgapi.InputRichBlockDocument {
block := Document(document)
block.Caption = &caption
return block
}