Files
latexgrambot/internal/rich/rich.go
corrado.mulas 98a3614d58 latexgrambot: inline LaTeX bot for Telegram in Go
Renders LaTeX expressions into PNG pictures, PDF documents and native
Telegram rich text messages, entirely locally with TeX Live and poppler.

- Chat mode with /image, /pdf, /rich plus per-user preamble and DPI
- Inline mode delivering picture, PDF and rich text results
- Broad default package set preloaded into a TeX format at image build
- MongoDB persistence: settings, users, groups, render statistics
- Private S3-compatible bucket with short-lived presigned URLs
- OpenTelemetry traces over OTLP
- Kubernetes manifests and Argo CD application, Docker Compose, GitHub
  Actions CI, BSD 3-Clause license
2026-10-04 03:42:50 +02:00

29 lines
1008 B
Go

// Package rich builds rich-message payloads for the Bot API 10.x rich
// message endpoints (sendRichMessage and the InputRichMessageContent used in
// inline answers). The pinned telegram-bot-api library predates the rich
// message API, so these are plain JSON-encodable values sent through
// api.MakeRequest.
package rich
// Message is the payload for InputRichMessage (and structurally for
// RichMessage). Only the blocks representation is used.
type Message struct {
Blocks []Block `json:"blocks"`
}
// Block is a RichBlock/InputRichBlock.
type Block struct {
Type string `json:"type"`
Text any `json:"text,omitempty"`
Expression string `json:"expression,omitempty"`
Size int `json:"size,omitempty"`
}
// Inline is a RichText inline node (mathematical_expression, bold, url...).
type Inline struct {
Type string `json:"type"`
Text any `json:"text,omitempty"`
Expression string `json:"expression,omitempty"`
URL string `json:"url,omitempty"`
}