mirror of
https://github.com/lukaszraczylo/go-telegram.git
synced 2026-06-05 22:43:59 +00:00
60eb0a89b5
Two API fields carry restricted emoji-value sets that the scraper's
curly-quote regex strips during IR extraction (multi-byte boundary
issue): ReactionTypeEmoji.Emoji and sendDice.Emoji. They previously
typed as plain string with no compile-time guarantee on values.
Add hand-curated typed-string enums in api/enums.go (the manual file,
not enums.gen.go):
- DiceEmoji: 6 constants (Dice, Dart, Basketball, Football, Bowling,
SlotMachine) covering Telegram's full set for sendDice.
- ReactionEmoji: 73 constants covering the canonical reaction set
from https://core.telegram.org/bots/api#reactiontypeemoji. Names
follow Unicode CLDR short names where one exists, otherwise stable
common-English labels (e.g. ThumbsUp, Heart, Clown, ManTechnologist).
Wire the field-type override via cmd/genapi/emitter.go:
- fieldTypeOverrides map keyed "<TypeOrParamsName>.<FieldName>".
- goField/multipartFieldEntry consult the override after the enum-plan
lookup; falls through to the default goType when nothing matches.
- methods.tmpl gains goFieldP/multipartFieldEntryP helpers that pass
the params type name as override-parent (the params struct doesn't
share a Go type with the field, so the existing parent="" enum-key
convention is preserved).
Regenerated api/types.gen.go and api/methods.gen.go now type the two
fields as ReactionEmoji and DiceEmoji respectively. No other Emoji
field is affected (override is scoped per parent type). regen-from-
fixture is byte-deterministic across runs.
Add api/emoji_enums_test.go covering const wire values, reflection
checks on field types, and a marshal/unmarshal round-trip for
ReactionTypeEmoji.
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