feat: Support Bot API 9.6 & 10.0, multipart fixes — closes #279 #280, fixes #273 #274 #271 #277#281
Open
Zoomish wants to merge 7 commits into
Open
feat: Support Bot API 9.6 & 10.0, multipart fixes — closes #279 #280, fixes #273 #274 #271 #277#281Zoomish wants to merge 7 commits into
Zoomish wants to merge 7 commits into
Conversation
…rams.go for consistency with Telegram Bot API
…ethods_params.go for improved consistency
…verage for BotID functionality
…ostStoryParams for consistency
- Introduced InputMediaLivePhoto type for handling live photo media in messages. - Updated buildRequestForm to support InputMediaLivePhoto. - Enhanced poll structures to include new fields for media and persistent IDs. - Added new methods for managing bot tokens and guest queries in the Bot API. - Updated chat permissions and user models to include new capabilities related to bot management and guest queries.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #281 +/- ##
==========================================
- Coverage 45.50% 44.50% -1.01%
==========================================
Files 29 30 +1
Lines 2138 2274 +136
==========================================
+ Hits 973 1012 +39
- Misses 1111 1205 +94
- Partials 54 57 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
negasus
requested changes
May 13, 2026
Contributor
negasus
left a comment
There was a problem hiding this comment.
Also, please, use gofmt before send PR
- Removed the BotID method from the Bot struct, simplifying the token parsing logic. - Updated the ID method to directly parse the bot ID from the token. - Deleted the TestBot_BotID test case as it is no longer applicable. - Made minor formatting adjustments in various model files for consistency.
Author
Done — ran gofmt on the whole tree and pushed |
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
This PR brings the client in line with Bot API 9.6 (April 3, 2026) and Bot API 10.0 (May 8, 2026), fixes several open bugs, and adjusts request building where the API now expects different shapes or extra attachments.
Bot API 9.6 - managed bots & polls ( #279 )
can_manage_bots.KeyboardButtonRequestManagedBot(request_id, optionalsuggested_name,suggested_username) andKeyboardButton.request_managed_bot.Update.managed_botasManagedBotUpdated(includesuserandbotper API).managed_bot_created(ManagedBotCreated),poll_option_added/poll_option_deletedwith structures matching the API (poll_message,option_persistent_id,option_text,option_text_entities).getManagedBotToken,replaceManagedBotToken(returns new token string),savePreparedKeyboardButton(user_id+KeyboardButton), response typePreparedKeyboardButtonwithidonly; parameter JSON uses documented field names (e.g.user_idfor managed-bot calls).Poll/PollOption/PollAnswerupdated for quizzes with multiple correct answers (correct_option_ids), optional revoting, descriptions,persistent_id/option_persistent_ids, option attribution andaddition_date;SendPollParamsextended (correct_option_ids, description/media/explanation fields,members_only,country_codes, revote/shuffle/add-options/hide-results flags, etc.).ReplyParameters.poll_option_idandMessage.reply_to_poll_option_iduse string persistent identifiers as in the API.Bot API 10.0 - guest mode, reactions admin, polls/media, live photos, access settings ( #280 )
User.supports_guest_queries;Messageguest fields (guest_bot_caller_user,guest_bot_caller_chat,guest_query_id);Update.guest_message;answerGuestQuerywithguest_query_id+result(InlineQueryResult);SentGuestMessagewithinline_message_id.can_react_to_messagesonChatPermissionsandChatMemberRestricted;getChatAdministratorsgains optionalreturn_bots.deleteMessageReaction(chat_id,message_id, optionaluser_id,actor_chat_id) anddeleteAllMessageReactions(chat_id, optionaluser_id,actor_chat_id) - aligned with the current method tables (not the olderreaction/message_idmistake).PollMedia;Poll/PollOptionincoming media fields;SendPollParamsmedia/explanation_mediaviaInputMedia(InputPollMedia union);InputPollOptionembeds typedmediain JSON via custom marshal; newInputMediaSticker,InputMediaLocation,InputMediaVenue; existingInputMediaLivePhotocompleted (photo,has_spoiler, attachments for multipart).sendLivePhoto(live_photo+photofiles, captions, etc.);LivePhotoand paid variants (PaidMediaLivePhoto,InputPaidMediaLivePhoto) for sending/receiving;Message/ExternalReplyInfolive_photo; multipart builder handles a secondattach://for live-photo payloads where needed.video_chat_*(replacing deprecatedvoice_chat_*keys onMessage).BotAccessSettings;getManagedBotAccessSettings/setManagedBotAccessSettings;getUserPersonalChatMessages(user_id, requiredlimit).Bugfixes & ergonomics
SendChecklistParams.ChatIDand some other paramschat idfield has wrong typeintinstead ofint64#273CanSendOtherMessagesvariable #271Breaking changes
Poll/SendPollParams:correct_option_id→correct_option_ids([]int).user_id/actor_chat_id(anddeleteAllMessageReactionsno longer takesmessage_id).PollOptionAdded/PollOptionDeletedreshaped;poll_option_id/reply_to_poll_option_idare strings.Message: service fields for video chats usevideo_chat_*JSON keys.*Params: stricter or wider chat-id types (int64,any) - callers passing channel/usernames or large IDs should verify compile-time types.Test plan - 3/3 ✅
go build ./...go vet ./...go test ./...