BOT API v10.0#435
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the library to align with Telegram Bot API v10.0, adding new request/response types and model fields for guest mode, managed bot access settings, poll media enhancements, and live photo support, along with bumping the published version to 10.0.0.
Changes:
- Bump artifact/library version references to
10.0.0. - Add Guest Mode + managed bot access settings requests/responses/models.
- Add Live Photo support across requests/models/adapters and extend Polls with media-related fields/parameters.
Reviewed changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updates dependency version examples to 10.0.0. |
| pom.xml | Bumps Maven project version to 10.0.0. |
| gradle.properties | Bumps Gradle VERSION_NAME to 10.0.0. |
| library/src/main/java/com/pengrad/telegrambot/utility/gson/PaidMediaTypeAdapter.java | Adds live_photo discriminator handling for paid media deserialization. |
| library/src/main/java/com/pengrad/telegrambot/utility/gson/OwnedGiftTypeAdapter.java | Removes unused paid media imports. |
| library/src/main/java/com/pengrad/telegrambot/response/SentGuestMessageResponse.kt | Adds response wrapper for guest query results. |
| library/src/main/java/com/pengrad/telegrambot/response/BotAccessSettingsResponse.kt | Adds response wrapper for managed bot access settings. |
| library/src/main/java/com/pengrad/telegrambot/request/SetManagedBotAccessSettings.kt | Adds request to set managed bot access settings. |
| library/src/main/java/com/pengrad/telegrambot/request/GetManagedBotAccessSettings.kt | Adds request to fetch managed bot access settings. |
| library/src/main/java/com/pengrad/telegrambot/request/GetUserPersonalChatMessages.kt | Adds request to fetch a user’s personal chat messages. |
| library/src/main/java/com/pengrad/telegrambot/request/AnswerGuestQuery.kt | Adds request to answer guest queries. |
| library/src/main/java/com/pengrad/telegrambot/request/SendPoll.kt | Adds new poll parameters (media/explanationMedia/membersOnly/countryCodes). |
| library/src/main/java/com/pengrad/telegrambot/request/SendLivePhoto.kt | Adds a new multipart request for sending live photos. |
| library/src/main/java/com/pengrad/telegrambot/request/GetChatAdministrators.java | Adds return_bots option. |
| library/src/main/java/com/pengrad/telegrambot/request/DeleteMessageReaction.kt | Adds request to delete a specific message reaction. |
| library/src/main/java/com/pengrad/telegrambot/request/DeleteAllMessageReactions.kt | Adds request to delete all message reactions. |
| library/src/main/java/com/pengrad/telegrambot/model/User.java | Adds supports_guest_queries field + accessor and equality/toString updates. |
| library/src/main/java/com/pengrad/telegrambot/model/Update.java | Adds guest_message field + accessor and equality/toString updates. |
| library/src/main/java/com/pengrad/telegrambot/model/Message.java | Adds live photo + guest query related fields and accessors. |
| library/src/main/java/com/pengrad/telegrambot/model/ExternalReplyInfo.java | Adds live photo field + accessor and equality/hash/toString updates. |
| library/src/main/java/com/pengrad/telegrambot/model/ChatPermissions.java | Adds can_react_to_messages field + accessor/builder and equality/hash/toString updates. |
| library/src/main/java/com/pengrad/telegrambot/model/ChatMember.java | Adds can_react_to_messages field + accessor and equality/hash/toString updates. |
| library/src/main/java/com/pengrad/telegrambot/model/SentGuestMessage.kt | Adds model for answerGuestQuery result payload. |
| library/src/main/java/com/pengrad/telegrambot/model/BotAccessSettings.kt | Adds model for managed bot access settings. |
| library/src/main/java/com/pengrad/telegrambot/model/Poll.java | Adds new poll fields (media/explanation_media/members_only/country_codes) + accessors and equality/toString updates. |
| library/src/main/java/com/pengrad/telegrambot/model/PollOption.java | Adds media to poll options + accessor and equality/hash/toString updates. |
| library/src/main/java/com/pengrad/telegrambot/model/PollMedia.kt | Adds model representing poll media payload. |
| library/src/main/java/com/pengrad/telegrambot/model/LivePhoto.kt | Adds model representing a live photo (photo array + video). |
| library/src/main/java/com/pengrad/telegrambot/model/paidmedia/PaidMediaLivePhoto.kt | Adds paid media live photo subtype model. |
| library/src/main/java/com/pengrad/telegrambot/model/request/InputPollMedia.kt | Adds marker interface for poll-level media inputs. |
| library/src/main/java/com/pengrad/telegrambot/model/request/InputPollOptionMedia.kt | Adds marker interface for poll-option media inputs. |
| library/src/main/java/com/pengrad/telegrambot/model/request/InputMedia.java | Makes input media usable as poll media/option media via marker interfaces. |
| library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaLivePhoto.kt | Adds input media type for live photos. |
| library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaLocation.kt | Adds location poll media input. |
| library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaVenue.kt | Adds venue poll media input. |
| library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaSticker.kt | Adds sticker input media type. |
| library/src/main/java/com/pengrad/telegrambot/model/request/InputPollOption.java | Adds media field/setter to poll options for sending. |
| library/src/main/java/com/pengrad/telegrambot/model/request/InputPaidMediaLivePhoto.kt | Adds paid-media input type for live photos. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return context.deserialize(object, PaidMediaPhoto.class); | ||
| } else if (PaidMediaVideo.TYPE.equals(discriminator)) { | ||
| return context.deserialize(object, PaidMediaVideo.class); | ||
| } else if (PaidMediaLivePhoto.TYPE.equals(discriminator)) { | ||
| return context.deserialize(object, PaidMediaLivePhoto.class); |
| var media: InputPollMedia? by optionalRequestParameter() | ||
| var explanationMedia: InputPollMedia? by optionalRequestParameter() | ||
| var membersOnly: Boolean? by optionalRequestParameter() | ||
| var countryCodes: List<String>? by optionalRequestParameter() | ||
|
|
| class SendLivePhoto private constructor( | ||
| chatId: Long? = null, | ||
| channelUsername: String? = null, | ||
|
|
||
| livePhotoUrl: String? = null, | ||
| livePhotoFile: File? = null, | ||
| livePhotoBytes: ByteArray? = null, | ||
| ) : AbstractMultipartRequest<SendLivePhoto>( | ||
| chatId = chatId, | ||
| channelUsername = channelUsername, | ||
|
|
||
| contentParameterName = "live_photo", | ||
| contentUrl = livePhotoUrl, | ||
| contentFile = livePhotoFile, | ||
| contentBytes = livePhotoBytes, | ||
|
|
||
| defaultFileName = ContentTypes.PHOTO_FILE_NAME, | ||
| defaultContentType = ContentTypes.PHOTO_MIME_TYPE, | ||
| ) { |
pengrad
left a comment
There was a problem hiding this comment.
🔴 Real bugs
-
LivePhoto model is wrong (line 2495).
The spec says LivePhoto = photo? + file_id, file_unique_id, width, height, duration (required) + mime_type?, file_size?. The PR models it as {photo, video} — there is no video
field, and all the file-identity/dimension fields are missing. Incoming LivePhoto objects (on Message, PollMedia, PaidMediaLivePhoto) will deserialize to almost nothing. -
DeleteMessageReaction signature is wrong (line 17057).
Doc params: chat_id, message_id (required) + optional user_id, actor_chat_id. There is no reaction parameter at all. The PR takes a required type: ReactionType (serialized as
type), which the API doesn't accept, and omits the real user_id/actor_chat_id. -
DeleteAllMessageReactions signature is wrong (line 17101).
Doc params: chat_id (required) + optional user_id, actor_chat_id. There is no message_id — the method clears up to 10 000 reactions added by a given user/chat across the whole
chat. The PR makes message_id required and omits user_id/actor_chat_id. -
sendLivePhoto is missing the required photo parameter (line 10463).
The method requires two files: live_photo (the video) and photo (the static photo) — both Required. The PR's SendLivePhoto (via single-content AbstractMultipartRequest) only
sends live_photo. The request can't be built correctly. Also, the URL constructors are dead weight: the doc states "Sending live photos by a URL is currently unsupported." -
InputMediaLivePhoto is missing the required photo field (line 8828).
Doc: type, media (video), photo (static, required), plus caption fields (those are inherited from the InputMedia base, so OK). The PR adds only has_spoiler and the video; the
required static photo is absent — so it's broken in sendMediaGroup/editMessageMedia too. -
InputPaidMediaLivePhoto is missing the required photo field (line 9170).
Doc: type, media (video), photo (static). The PR sets only media.
Note for 4–6: the underlying gap is that the live-photo input types need to attach a second file (photo), which the current single-content multipart/InputMedia attachment machinery doesn't model. This needs real plumbing, not just a field.
|
🟡 Minor
|
|
Will AI replace us? Not yet... |
No description provided.