Skip to content

Bot API 10.3 and module path github.com/bssth/telegram-bot-api/v6 - #1

Merged
bssth merged 66 commits into
masterfrom
claude/magical-curie-we7ndy
Oct 1, 2026
Merged

bssth merged 66 commits into
masterfrom
claude/magical-curie-we7ndy

Conversation

@bssth

@bssth bssth commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Summary

Brings the library from Bot API 6.0 (April 2022, where upstream stopped) to Bot API 10.3 (August 24, 2026) and publishes the fork as github.com/bssth/telegram-bot-api/v6.

Base: upstream PR go-telegram-bot-api#794

Merges go-telegram-bot-api/telegram-bot-api#794 by @kirugan (one commit per Bot API version, 6.1 → 10.3) with authorship preserved. It was never merged upstream.

Spec audit on top of it

Every type, field, method and parameter was checked against the machine-readable Bot API 10.3 specification. About 70 gaps and bugs in go-telegram-bot-api#794 were fixed:

  • The placeholder types VideoQuality, UserRating, UserProfileAudios, GiftBackground and UniqueGiftColors kept raw JSON in an untagged field and decoded nothing. They are now real structs.
  • OwnedGift read unique gifts from a non-existent unique_gift field.
  • repostStory sent postStory parameters. Also fixed: getUserGifts and getChatGifts filters, setStickerSetThumbnail (format, dropping the thumbnail), setGameScore (force, zero score), sendDocument (caption_entities was never sent), sendVideo and sendAnimation (width/height).
  • Added suggested_post_parameters for all send methods, setPassportDataErrors, the missing Passport types, and missing fields on MessageEntity, ExternalReplyInfo, PollOptionAdded/PollOptionDeleted, ChatOwnerLeft, TransactionPartner and inline results.
  • getChatMemberCount replaces the deprecated getChatMembersCount. GetChatMembersCount is kept as a deprecated wrapper.

Other fixes

  • Files nested in polls (question, options, explanation) and in rich messages are now uploaded via attach://. Before, local paths and bytes were serialized into the JSON.
  • Update.FromChat/SentFrom cover all update kinds and no longer panic on callback queries from inline messages.
  • Transport errors no longer leak the bot token.
  • GetFileDirectURL now honours SetFileEndpoint.
  • Added helpers NewEditMessageMedia and NewInputMedia{LivePhoto,Sticker,Location,Venue,Link}.

Module path and versioning

The module path is now github.com/bssth/telegram-bot-api/v6. The major version changes because the API is not source-compatible with upstream v5. BREAKING.md lists every incompatibility with before/after snippets. This PR adds two of them on top of go-telegram-bot-api#794:

  • getChat-only fields were moved from Chat to ChatFullInfo. They were always empty in Chat.
  • Message.PremiumAnimation was removed. It is not part of the Bot API.

Tooling and CI

  • Added internal/cmd/specdiff, which reports missing types, fields, methods and parameters against the latest Bot API spec. It reports 787 gaps on the old upstream code and 0 here. A new weekly workflow runs it.
  • The test workflow now uses current actions, runs on Go 1.24 and on stable, and runs vet and -race. The deprecated codecov v1 step was removed.

Testing

  • go build ./..., go vet ./... and go test -race ./... pass. The integration tests that need a real bot token are skipped.
  • New unit tests cover the spec fixes. New end-to-end tests run against a fake Bot API server (httptest) and check multipart uploads of nested media, token redaction and the custom file endpoint.
  • All package main examples in README and docs compile.
  • go get github.com/bssth/telegram-bot-api/v6@<commit> works from a clean module.
  • Not tested against the real Telegram API.

After merging

Tag v6.0.0 on master, so that go get github.com/bssth/telegram-bot-api/v6@latest resolves to a real version instead of a pseudo-version.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EHdMw9fUyf4m1g524X8rhj


Generated by Claude Code

kirugan and others added 29 commits April 11, 2026 07:47
Brings in the per-version work by Kirill (kirugan) that was submitted to the
abandoned upstream repository but never merged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EHdMw9fUyf4m1g524X8rhj
The upstream repository is abandoned, so the module now lives under this
fork and can be installed with
go get github.com/bssth/telegram-bot-api/v5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EHdMw9fUyf4m1g524X8rhj
Checked every type and method against the machine-readable Bot API 10.3
specification and fixed what was missing or wrong:

Types
- Replace the raw-JSON placeholders VideoQuality, UserProfileAudios,
  UserRating, GiftBackground and UniqueGiftColors with real structs.
- OwnedGift: decode the polymorphic "gift" field into Gift or UniqueGift
  by type (it was read from a non-existent "unique_gift" field).
- PollOptionAdded/PollOptionDeleted: add option_persistent_id,
  option_text and option_text_entities.
- MessageEntity: add unix_time and date_time_format for date_time
  entities; ExternalReplyInfo: add checklist; ChatOwnerLeft: add
  new_owner; TransactionPartner: add paid_media_payload.
- InlineQueryResultVideo/Document: add parse_mode and caption_entities.
- Telegram Passport: add translation and hash to EncryptedPassportElement
  and the missing PassportElementErrorTranslationFile(s) and
  PassportElementErrorUnspecified types.
- Move the getChat-only fields from Chat to ChatFullInfo, where Telegram
  actually returns them, and drop Message.PremiumAnimation, which is not
  part of the Bot API.

Methods
- Add SetPassportDataErrorsConfig (setPassportDataErrors).
- Use getChatMemberCount instead of the deprecated getChatMembersCount.
- Add suggested_post_parameters to all send methods via BaseChat.
- getUserGifts/getChatGifts: add all filter and sorting parameters.
- repostStory: use from_story_id and active_period (it sent postStory
  parameters).
- setStickerSetThumbnail: add format; allow dropping the thumbnail.
- setGameScore: send force, and send a zero score.
- sendDocument: actually send caption_entities.
- sendVideo/sendAnimation: add width and height.
- editMessageText: do not send an empty text along with rich_message.

Uploads
- sendPoll (media, options and explanation media) and rich messages
  (sendRichMessage, sendRichMessageDraft, editMessageText,
  editEphemeralMessageText) can now upload new files via attach://
  instead of serializing local paths or bytes into the JSON.

Other
- Add UpdateTypeChatJoinRequest and UpdateTypeGuestMessage.
- Update.SentFrom/FromChat cover all update kinds and no longer panic on
  callback queries from inline messages.
- Redact the bot token from transport errors returned by MakeRequest
  and UploadFiles.
- Add NewEditMessageMedia and NewInputMedia{LivePhoto,Sticker,Location,
  Venue,Link} helpers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EHdMw9fUyf4m1g524X8rhj
GetChatMembersCount is kept as a deprecated wrapper. GetFileDirectURL used
the package-level FileEndpoint even when a custom file endpoint was set for
a local Bot API server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EHdMw9fUyf4m1g524X8rhj
internal/cmd/specdiff compares the package with the machine-readable Bot
API specification and reports missing types, fields, methods and
parameters. The new Bot API spec workflow runs it weekly so that new Bot
API releases are noticed.

The test workflow now uses current actions, tests on Go 1.24 and the
latest stable Go, and runs vet and the race detector. The deprecated
codecov v1 upload step is dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EHdMw9fUyf4m1g524X8rhj
- Install from github.com/bssth/telegram-bot-api/v5 and explain how to
  migrate from the abandoned upstream module.
- Credit go-telegram-bot-api#794 and list the fixes made
  on top of it.
- Document the moved Chat fields and the removed Message.PremiumAnimation
  in BREAKING.md.
- Fix outdated identifiers in the docs and describe nested media uploads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EHdMw9fUyf4m1g524X8rhj
The API is not source-compatible with upstream v5, so the fork starts a
new major version instead of breaking code that pins /v5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EHdMw9fUyf4m1g524X8rhj
@bssth
bssth merged commit a0db799 into master Oct 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants