Bot API 10.3 and module path github.com/bssth/telegram-bot-api/v6 - #1
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
VideoQuality,UserRating,UserProfileAudios,GiftBackgroundandUniqueGiftColorskept raw JSON in an untagged field and decoded nothing. They are now real structs.OwnedGiftread unique gifts from a non-existentunique_giftfield.repostStorysentpostStoryparameters. Also fixed:getUserGiftsandgetChatGiftsfilters,setStickerSetThumbnail(format, dropping the thumbnail),setGameScore(force, zero score),sendDocument(caption_entitieswas never sent),sendVideoandsendAnimation(width/height).suggested_post_parametersfor all send methods,setPassportDataErrors, the missing Passport types, and missing fields onMessageEntity,ExternalReplyInfo,PollOptionAdded/PollOptionDeleted,ChatOwnerLeft,TransactionPartnerand inline results.getChatMemberCountreplaces the deprecatedgetChatMembersCount.GetChatMembersCountis kept as a deprecated wrapper.Other fixes
attach://. Before, local paths and bytes were serialized into the JSON.Update.FromChat/SentFromcover all update kinds and no longer panic on callback queries from inline messages.GetFileDirectURLnow honoursSetFileEndpoint.NewEditMessageMediaandNewInputMedia{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.mdlists 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 fromChattoChatFullInfo. They were always empty inChat.Message.PremiumAnimationwas removed. It is not part of the Bot API.Tooling and CI
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.vetand-race. The deprecated codecov v1 step was removed.Testing
go build ./...,go vet ./...andgo test -race ./...pass. The integration tests that need a real bot token are skipped.httptest) and check multipart uploads of nested media, token redaction and the custom file endpoint.package mainexamples in README and docs compile.go get github.com/bssth/telegram-bot-api/v6@<commit>works from a clean module.After merging
Tag
v6.0.0onmaster, so thatgo get github.com/bssth/telegram-bot-api/v6@latestresolves to a real version instead of a pseudo-version.🤖 Generated with Claude Code
https://claude.ai/code/session_01EHdMw9fUyf4m1g524X8rhj
Generated by Claude Code