mirror of
https://github.com/lukaszraczylo/go-telegram.git
synced 2026-06-05 22:43:59 +00:00
f899cc2663
GetChatAdministrators returns []ChatMember, where ChatMember is a sealed-interface union. The codegen template emitted the generic client.Call[..., []ChatMember] for it — encoding/json cannot unmarshal a slice of an interface (no discriminator-aware path), so every real response from Telegram failed at the parse step: telegram: parse: json: cannot unmarshal api.ChatMember into Go struct field Result[[]ChatMember].Result of type api.ChatMember Fix is in cmd/genapi/methods.tmpl: add a third branch alongside the existing single-union branch. When a method returns []<union>, emit CallRaw + json.Unmarshal into []json.RawMessage + per-element Unmarshal<Union>(e). Mirrors what GetChatMember (single-element) already does, applied uniformly so any future slice-of-union method Telegram introduces inherits the right shape. Survey of v1.1.1 across all 23 sealed-interface unions confirms GetChatAdministrators was the only broken site; the fix regenerates just that one method body. New regression tests in api/getchatadministrators_test.go cover the typical admin+owner response and the empty-array case.
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
- Project home — landing page with examples and overview
- GitHub repository
- pkg.go.dev — official Go package documentation