Files
go-telegram/docs/reference
lukaszraczylo 6ab80c27e1 fix(api): emit bare interface for all sealed-interface unions
Optional fields whose type was a sealed-interface union without an
auto-decode discriminator (BotCommandScope, InputMedia, InputPaidMedia,
InputProfilePhoto, InputStoryContent, InputMessageContent,
InputPollMedia, InputPollOptionMedia, InlineQueryResult,
PassportElementError) were emitted as *<Union> — pointer to interface,
which is a Go anti-pattern: interfaces are already nil-able, and
callers were forced to take addresses of concrete variants.

The codegen path goType() guarded against pointer-wrapping using
knownDiscriminators (only 13 unions with auto-decode dispatch), missing
the 10 marker-only sealed interfaces. New package var
knownInterfaceTypes is built from buildUnionTypeSet at emitter
construction and covers both kinds. goType() now consults that.

Net effect:
- api/methods.gen.go: 3 *BotCommandScope and 2 *InputPollMedia fields
  become bare interface
- api/types.gen.go: 14 *InputMessageContent and 1 *InputPollOptionMedia
  fields become bare interface

Regression tests in api/unionparam_test.go cover both shapes:
direct concrete-variant assignment, and nil omitempty on the bare
interface field.
2026-05-09 19:06:59 +01:00
..

API Reference

Auto-generated from Go source comments by gomarkdoc. Do not edit by hand — run make docs to regenerate.

Packages

Package Description
api Telegram Bot API types and method wrappers — 176 methods, 301 types, fully generated
client Bot client, codec, HTTP doer, retry middleware
transport Long-poll and webhook transports
dispatch Update router, filters, handler groups, named handlers
dispatch/conversation Multi-step conversation state machines
dispatch/filters/message Message filters — Command, Text, IsReply, etc.
dispatch/filters/callback Callback query filters
dispatch/filters/inline Inline query filters
dispatch/filters/chatmember Chat member update filters
dispatch/filters/chatjoinrequest Join request filters
dispatch/filters/precheckoutquery Pre-checkout filters for payments

Also see